I need to solve this problem but I’m really not much good at algebra.
I want to move a motor a set distance d.
It needs to ramp up to speed in a set amount of time tr
then cruise along for a set amount of time tc
then ramp down again (for now I am leaving both ramp up/down times the same).
I need to figure out the top speed it should reach, and the distance moved during each of the different phases (so I can tell it to accelerate for x amount of distance travelled), and the amount of acceleration to apply so it goes the right distance.
I am pretty sure there is always only one unique solution for this but things don’t seem to cancel out as I’d hoped. My head hurts. Can anyone help me figure this out ?
these should be correct as starting equations:
tr = v/a (time spent accelerating from zero is equal to speed over acceleration)
v = dc/tc (speed is distance over time)
As I understand this your total distance travelled, d, and acceleration time, t_r, and cruise time, t_c, are specified, and you thus wish to solve for the “cruising speed”, v.
d = d_c + 2d_r
d_r = ½vt_r
d_c = vt_c
So,
d = v(t_r + t_c)
thus the required “cruising speed” is
v = d/(t_r + t_c)
The required constant acceleration/deceleration is then
a = v/t_r
I think this model might be a bit too simple to translate into an actual physical system, however.
I misread looks like you got the same thing actually but just sovled for speed first !
thanks for the help I will double check with that method but it seems to work out
edit: oops t=2t_r+t_c I’ll have to check the end bit again
PS @Barnaby_Coote
I have put in a lot of work into the space , the fact that you are building real stuff and bumping into real engineering problems makes it all make sense .
A potential problem I can see with this is that you will have a performance envelope of movement commands that your system will be able to satisfy, depending on the values of the variables and the maximum acceleration you can provide via your motors. Another problem is that there is no such thing as a constant acceleration in reality.
The library I’m using uses a close approximation that appears to be near enough and should have about the same amount of error for each motor. Its minute anyway. I can feed it acceleration and max speed values and it does the ramping which is why I needed those values. Both motors are starting and stopping at exactly the same time which is just what i want !