-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accelerating / decelerating from current speed? #1
Comments
My assumption was to start from zero speed. But you can change that. Motion command would need then the start speed and calculations would add that value too. Same if you want the motion not to end at zero speed but at a higher speed. |
I was trying to do that with arduino, but a real time calculation is too expensive for its processor (so I cannot debug my code reliably). Using arrays is also impossible - 400 long array is not enough to store acceleration at 400 microseconds delay between steps. It would take hundred of thousands entries in the array to accelerate with smooth S-curve at higher stepping rate. I'm waiting for ESP32 board, and I'll try to find some logic. I just thought you have it already :-) PS. I'm controlling stepper motor speed via BLE module, and because of the bluetooth communication latency, I have to smooth (PWM-like) acceleration between received speed values. PS 2. You can mark my question as an "enhancement request" or something, because there's no issue in your code at all :-) Thanks for reply! Kindly, |
I will have a look at the idea of setting a non-null entry speed. I think
it can be done with a table not very large and using linear interpolation,
but the devil is always in the details, and not having that implemented
means there could be an elephant in the room going unnoticed.
…On Mon, Mar 4, 2019 at 8:03 PM philip100 ***@***.***> wrote:
I was trying to do that with arduino, but a real time calculation is too
expensive for its processor. Using arrays is also impossible - 400 long
array is not enough to store acceleration at 400 microseconds delay between
steps. It would take hundred of thousands entries in the array to
accelerate with smooth S-curve at higher stepping rate.
I'm waiting for ESP32 board, and I'll try to find some logic. I just
thought you have it already :-)
PS. I'm controlling stepper motor speed via BLE module, and because of the
bluetooth communication latency, I have to smooth (PWM-like) acceleration
between received speed values.
Thanks for reply!
Kindly,
Artur.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAccyN_DWLPlzlxRoOGgdRUzGJckZ0Nwks5vTW3ugaJpZM4bc3CC>
.
|
@philip100 One detail as I review the code is that using digitalWrite or digitalRead on an Arduino UNO or Mega is painfully slow and that will affect the timing of the operation. I got away using those because the ESP32 is a 240Mhz 32-bit processor that handles them much faster. What are the max speed, max distance, and max acceleration values you want to achieve? |
Hi Arthus,
Ok, let us have a look at it.
If you want to plan a move of L steps, with v0 initial and v1 final speed,
vm as max speed and "a" acceleration values, then the calculation would be:
accel_steps=abs(vm^2-v0^2)/(2*a);
decel_steps=abs(vm^2-v1^2)/(2*a);
N=L-accel_steps-decel_steps; // it might be zero or negative is there is
not enough space to achieve the desired motion in the available number of
steps !!!
Please note I have coded it as if v1 or v0 could be larger than vm (that
should not happen as vm is supposed to the be the max speed).
Does that make sense?
…On Mon, Mar 4, 2019 at 9:55 PM Miguel Sanchez ***@***.***> wrote:
I will have a look at the idea of setting a non-null entry speed. I think
it can be done with a table not very large and using linear interpolation,
but the devil is always in the details, and not having that implemented
means there could be an elephant in the room going unnoticed.
On Mon, Mar 4, 2019 at 8:03 PM philip100 ***@***.***> wrote:
> I was trying to do that with arduino, but a real time calculation is too
> expensive for its processor. Using arrays is also impossible - 400 long
> array is not enough to store acceleration at 400 microseconds delay between
> steps. It would take hundred of thousands entries in the array to
> accelerate with smooth S-curve at higher stepping rate.
>
> I'm waiting for ESP32 board, and I'll try to find some logic. I just
> thought you have it already :-)
>
> PS. I'm controlling stepper motor speed via BLE module, and because of
> the bluetooth communication latency, I have to smooth (PWM-like)
> acceleration between received speed values.
>
> Thanks for reply!
>
> Kindly,
> Artur.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#1 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAccyN_DWLPlzlxRoOGgdRUzGJckZ0Nwks5vTW3ugaJpZM4bc3CC>
> .
>
|
Thank you so much for spending your time on this
The basic idea is to run steps until "speed" value is above 0 (zero), so the distance is not important (at least to me) in this scenario. The maximum speed I'm looking for is about 100 microseconds delay between each step (I think it's optimum max speed, considering 16 microstepping).
In theory, yes it make sense :-D Once again, thanks! Kindly, |
Hi misan. Unfortunatelly I failed using your equations :-/ I've seen on youtube something exactly what I'm looking for: https://www.youtube.com/watch?v=vD_VCBO1lw4 Very sadly, it's written in micropython, so I'll have to search for the solution using Arduino IDE. Thanks anyway. Kindly, |
Sorry, vm - is max speed (or feedrate), v0 and v1 are both speeds too
(initial and end speeds), all of them in steps/second (that comes from
mm/sec times steps/mm)
a is the acceleration in mm/s^2
What you show in the video matches the setup I proposed you above and like
that case (assuming they represent speed and not distance), the only the
first movement initial speed is 0.
…On Thu, Mar 7, 2019 at 10:35 PM philip100 ***@***.***> wrote:
Hi misan.
Unfortunatelly I failed using your equations :-/
Well, I don't actually understand what kind of data you consider to be vm ,
v0 , v1 and a . Number of microseconds? a percentage of speed perhaps?
I've seen on youtube something exactly what I'm looking for:
https://www.youtube.com/watch?v=vD_VCBO1lw4
Thanks anyway.
Kindly,
Artur.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAccyGYrVoxooK7nY2QpdVGCeMsx4G4fks5vUYX_gaJpZM4bc3CC>
.
|
I believe you're right (you're the master of the math here :-) ), I just can't get my head around this. I'll try to figure this out. Thanks for help! Kindly, |
I will give it a go when I have a moment to make it clearer how it can
operate
El vie., 8 mar. 2019 19:25, philip100 <[email protected]> escribió:
… I believe you're right (you're the master of the math here :-) ), I just
can't get my head around this.
I'll try to figure this out. Thanks for help!
Kindly,
Artur.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAccyEOQ9rXIfPuRA3IXg1Ne1F8Zz1vsks5vUqrzgaJpZM4bc3CC>
.
|
Hello.
First - a really good piece of math! It helped me a lot
I wonder if if there's any way to use your calculations for accelerating / decelerating from current speed? I cannot seem to find any logic to do that.
Any suggestions?
Kindly,
Artur.
The text was updated successfully, but these errors were encountered: