Control Mode
The default control mode is position control. If you want a different mode, you can change .controller.config.control_mode. Possible values are:
CTRL_MODE_POSITION_CONTROL
CTRL_MODE_VELOCITY_CONTROL
CTRL_MODE_CURRENT_CONTROL
CTRL_MODE_VOLTAGE_CONTROL - this one is not normally used.
Hello. I am not sure when to use any of these control modes or which one is the most “acceptable”. ?What is the logic behind when deciding which one to pick?. Can you please, provide couple examples to grasp the difference? Can I set two different control modes for example CTRL_MODE_POSITION_CONTROL and CTRL_MODE_VELOCITY_CONTROL at the same time?
I am very confused. Thanks
It’s one mode or the other, you can’t combine them.
Position control mode attempts to rotate to and hold at the position of the given setpoint (encoder position).
Velocity control attempts to maintain the specified velocity, I believe in encoder counts per second.
Current control just feeds the motor the given amount of current.
Voltage control supplies the given amount of voltage.
You’ll generally use either position or velocity. When changing positions in position mode you can (I believe) supply a velocity to use during the change.
Use position mode if you want to get stepper-like functionality - suitable for automation style tasks like CNC. Use velocity mode if you want to maintain a given speed regardless of load on the motor - suitable for something like an electric skateboard.
Use current mode if you want to exert a constant amount of torque - I think?
Not sure about voltage mode.
2 Likes
The documentation mentions the control modes but they are not explained. Thank you very much for taking the time to answer the inquiries . I have a better idea now of what the control modes are all about. Again, thanks.
1 Like