Precise Motor Control


This year my team is spinning a CIM motor to move a throwing arm and I will have to keep the CIM going at a specific speed. I was wondering how the control values -1 <-> 1 (fed to a Jaguar) compare to the CIM’s RPM? Is there a more efficient to go about controlling the motor? Thank you!

You could figure out how a power value compares to an RPM through trial and error, but I would not recommend it at all.

Instead, if you have an encoder or a potentiometer around, you can use a PID control loop. There are numerous paper on CD of the code and use. The loop will use the present and past velocities of the arm (this is why you need a sensor) in comparison to the target velocity in order to compute an updated motor value. The motor value will get updated many times a second, helping your arm reach target velocity quite quickly (“quickly” depends on what motors, gearing, and mechanical arm you have). Good control loops represent programming on a higher level and can simplify quite a bit of work for your drivers, so they can focus on driving.

If you have any more questions, feel free to PM me.

The most efficient way of controlling a motor’s RPM precisely is to have some sort of sensor control it (such as an encoder) and using a control system monitor the power sent to the Jaguar. The most common types used for robotics are PID and Bang-Bang, which have been documented well around chiefdelphi.

Think of the values as a percentage of the voltage of the battery, being sent to the motor. How you get around that depends on what language you use to code.

The only issue with that is, depending on the specific speed controller, the value to power graph is not linear, is different for each type of speed controller, and can be different between two controllers of the same model.

Thanks! I’ll look into using an encoder!

Not as common, but used successfully by some teams, is TBH. You’ll find LabVIEW, C, and Java examples in this thread:

Would TBH be more viable than PID for an application with a continuously changing setpoint (such as regulating drive wheel speed)?

Controllers are characterized by such factors as dynamic response, stability, steady-state accuracy, etc. Since PID has 3 tuning parameters and TBH has only one, PID can handle a wider range of applications.

I suspect TBH would not work as well as PID for the application you described. You might not be able to set the TBH gain high enough to get the response you want without causing instability.

Any teams out there who have used TBH successfully for drivetrain wheel speed control?