[Dprglist] motion profiling with stepper motors
Jose Quinones
avayanings at gmail.com
Tue Mar 20 11:24:01 PDT 2018
Hi Markus,
What I have done in the past is use the timer which computes the step
length to update subsequent step lengths. In other words, whenever there is
a step, I issue an interrupt which changes the duration of the next step
length in number of ticks. This will make each step shorter and shorter
until you reach the target speed.
I do not recall the exact equation to do this but you should be able to
derive it. I think it is something in the order of (TICKS_START -
TICKS_END)/TOTAL_MILLI_SECONDS.
Say you want to go from 100 Hz to 1000 Hz electrical frequency in 100 ms.
You need to transform this into ticks for your timer and then use something
like the equation above to determine how much you will decrease the step
length in time, which in turn will give you a faster speed. Because you are
always decreasing the step length by the same amount, you end up with a
constant acceleration.
Hope this helps!
Best regards,
JIQ
On Tue, Mar 20, 2018 at 12:53 PM, markus <markus at bibi.ca> wrote:
> I started playing around with motion profiling and thought using a stepper
> was easier for experimenting. I've implemented "constant acceleration" and
> started to wonder what the correct implementation is when the stepper
> frequency is below the update frequency.
>
> Let's say motion profiling updates the frequency every 10ms and the
> acceleration limit is set to 5Hz/10ms. So at the initial update the
> frequency is set to 5Hz - 1ms later we could/should set the frequency to
> 10Hz but that's not possible because the period of one 5Hz cycle is 200ms.
>
> So the question I have is what is the correct value to update the timer at
> the end of those 200ms?
> - 10Hz
> - 100Hz
>
> Both seem wrong, if I set it to 10Hz it's not really "constant
> accelleration" at low speeds from a wall clock perspective. And if I set it
> to 100Hz I might exceed the "constant accelleration" from the motors
> perspective.
>
> Comments, thoughts?
> Markus
> _______________________________________________
> DPRGlist mailing list
> DPRGlist at lists.dprg.org
> http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dprg.org/pipermail/dprglist-dprg.org/attachments/20180320/e4c96d2e/attachment-0001.html>
More information about the DPRGlist
mailing list