0
$\begingroup$

I looked everywhere I could but didn't find a useful answer, so let me explain here:

My controller is giving a position goal, and while this position is not achieved, the linear actuator is controlled to move at a constant speed through a PID. When the position is reached, the speed is 0.

More precisely:

Inputs: position_desired, velocity_desired

basic_PWM = velocity_desired/max_actuator_velocity * 255 #Compute proportionally some feedforward basic PWM to reach approximately the desired speed
While position_desired not reached:
    Compute PID output based on velocity error (velocity_desired - velocity_measured) => PID_output
    Command = basic_pwm + PID_output 
    Send PWM command to motor
Command = 0 #when position is reached, stop motor
Send PWM command to motor

The closest name I could find is "velocity controller with position condition", but that doesn't sound very clean to me, is there a conventional name for this type of controller?

Thank you!

$\endgroup$
3
  • $\begingroup$ are you saying that the velocity stays constant, and then drops to zero instantly? $\endgroup$
    – jsotola
    Commented Feb 19, 2022 at 18:17
  • $\begingroup$ Yes, the position is not very important in my application, I need the velocity to stay constant during the entire stroke and then stop. For info, my velocity is 10mm/s, and 1mm is enough accuracy for the position, and passing directly from 10mm/s to 0mm/s enables 1mm position accuracy . $\endgroup$
    – JoElPoncho
    Commented Feb 19, 2022 at 18:53
  • $\begingroup$ i do not know the name, but it is like a velocity controller with emergency stop $\endgroup$
    – jsotola
    Commented Feb 19, 2022 at 19:08

1 Answer 1

0
$\begingroup$

I would use a simple PIDF controller. The PIDF controller is just like a PID controller, but with a feed-forward term. The feed-forward term consumes the desired velocity, multiplies with a scalar constant, and then adds that to the output of the PID controller. This allows for an immediate velocity that then gets adjusted by the PID part to take into account fluctuations in battery power or changes in friction. Then, once the error is within a certain range, you could turn off the feed-forward term and the integral term in the PID to allow for proportional control with damping.

This will require some tuning, but it should be simple enough to implement. Does this make sense?

$\endgroup$
2
  • $\begingroup$ Thank you! Actually, I think it is approximately what I did, with the difference that when the position "error" is within a certain range, I stop both the PID and the feedforward term. But in the case you propose, the PD controller at the end is for position while the PIDF before that is for velocity right? $\endgroup$
    – JoElPoncho
    Commented Mar 4, 2022 at 14:27
  • $\begingroup$ Yes, PIDF for velocity, but then PD control the position. You could then turn off the D-term if you are still not converging, but this is something you will have to experiment with. If my answer (and comments) are satisfactory, please mark the question as answered. $\endgroup$ Commented Mar 4, 2022 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.