True position/speed control

14 years 9 months ago #5720531 by jcweber
True position/speed control was created by jcweber
<P style="MARGIN: 0px">In regards to PID loops:
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">I haven't had much luck with PIDs. I think they are more for simple point to point position control on servos. So here's what I'm thinking:
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">To move from one point to another, the motors must be accelerated and decelerated. By allowing the user to set a value for acceleration, deceleration, and maximum speed, the behavior of the robot can be controlled precisely.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">Before a move is actually made, the software does a series of calculations to determine the top speed that can be attained, and the positions at which acceleration should end and deceleration should begin in order to attain a trapezoidal velocity curve.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">Calculated speed may be less than desired speed, but that is not a problem for short moves. Maximum speed will be used for moves that are long enough to allow the motors to accelerate to their maximum velocity. For short moves, acceleration is more important than max speed.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">To perform a move, breakpoints on the trapezoidal velocity curve must be found. The points where accel ends and decel begins, as well as the end point position, must be calculated.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">For a speed-controlled system, the accel and decel breakpoints must be used to calculate what speed will be achieved by accelerating at the specified value of accel to the breakpoint position. That new speed is saved with the breakpoint position. The same values of speed and distance are used to calculate the break point where decel is to begin.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">So to perform a move, the robot must be accelerated from a speed of zero to top speed, and then decelerated at the appropriate point to arrive at the desired position. The simplest system would just set the speed of the motors, and then turn the motors off when the end point is reached using a PID for control. In an actual system it's not practical.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">The basic equ for motion are as follows:
<P style="MARGIN: 0px">VELOCITY = STARTING VELOCITY + ACCELERATION X TIME
<P style="MARGIN: 0px">DISTANCE = STARTING VELOCITY X TIME + 1/2ACCELERATION X TIME ^2
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">From that we get:
<P style="MARGIN: 0px">DISTANCE = (VELOCITY^2 - STARTING VELOCITY^2)/(2 X ACCELERATION)
<P style="MARGIN: 0px">We can use this equ to compute the distance required to change speeds.
<P style="MARGIN: 0px">For a short move, the distance required to accel to the desired speed and then deccel to a stop may exceed the distance to move. In such a case, deceleration must begin at some speed less than max.
<P style="MARGIN: 0px">
<P style="MARGIN: 0px">This suggestion my help or make things worse. I don't know.
<P style="MARGIN: 0px">

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.078 seconds