<div dir="ltr"><div>Hi Markus, </div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Hope this helps!</div><div><br></div><div>Best regards,</div><div><br></div><div>JIQ</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 20, 2018 at 12:53 PM, markus <span dir="ltr"><<a href="mailto:markus@bibi.ca" target="_blank">markus@bibi.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br>
<br>
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.<br>
<br>
So the question I have is what is the correct value to update the timer at the end of those 200ms?<br>
 -  10Hz<br>
 - 100Hz<br>
<br>
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.<br>
<br>
Comments, thoughts?<br>
<span class="HOEnZb"><font color="#888888">Markus<br>
______________________________<wbr>_________________<br>
DPRGlist mailing list<br>
<a href="mailto:DPRGlist@lists.dprg.org">DPRGlist@lists.dprg.org</a><br>
<a href="http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org" target="_blank" rel="noreferrer">http://lists.dprg.org/<wbr>listinfo.cgi/dprglist-dprg.org</a><br>
</font></span></blockquote></div><br></div>