Shop OBEX P1 Docs P2 Docs Learn Events
S-curve motion generator — Parallax Forums

S-curve motion generator

mwrobertsmwroberts Posts: 77
edited 2025-08-21 03:04 in Propeller 2

Here is a s-curve step/dir motion generator I was working on a while back.
It could use some work, but it shows how to generate a trapezoidal with s-curve velocity profile for a given distance and feed rate.

Comments

  • MicksterMickster Posts: 2,874

    Mine works beautifully and is generated in real-time. The full motion profile is only part of the problem; one needs to account for short moves that don't reach slew and also on-the-fly velocity/acceleration changes.

    Craig

  • @Mickster said:
    The full motion profile is only part of the problem; one needs to account for short moves that don't reach slew and also on-the-fly velocity/acceleration changes.

    Yes, it doesn't handle short moves where block time is shorter than the acceleration time constant. To handle them correctly, the decel ramp starts before the accel ramp finishes, giving constant velocity while overlapped.
    I should fix that, but software preprocessing of the move could lower the move feedrate so the blocktime is a bit longer than the acceleration time constant. That may not work properly if there are many short moves in a row. The feed rate override can be accomplished by making the PASM interpolation loop counter longer... the one set to 200 counts with the clock speed set at 200Mhz to get 1uSec interpolation period.
    This program outputs step/dir pulses in realtime.

Sign In or Register to comment.