Voltage Limiting

I was reading a thread on CD and someone said that in addition to current limiting, you can also voltage limit motors. I know I can use talon to current limit but how do I implement voltage limiting?

It will help to know what language you are using.


Sure you can. Just never allow the motors to go above some output percentage in code.

Except, as the battery changes your output changes. You’ll need to scale it by using the current battery voltage versus some “nominal” value to prevent that. There is a talon-srx built in voltage limiting feature that we used extensively in LabView last year. Unfortunately I don’t know what the java version of that is - it was part of the CTRE library of vi’s.

I don’t think that voltage limits are a natively supported feature in the same way that current limits are. I would say the easiest workaround would likely be to enable voltage compensation with

talon.configVoltageCompSaturation(double voltage, int timeoutMs);

And then programmatically limit your voltage by never sending a command above your voltage limit.

EDIT: actually you should set the “voltage” argument to your desired voltage limit, then your commands -1 to 1 are scaled with respect to that. So I think if you set


commanding 0.5 in PercentOutput control mode would output 3V, commanding 1 would output 6V etc. I can’t test that right now but I suspect that this is what you’d want. That would work as a voltage limit I think.

As someone who knows almost nothing about motors, do motors have a constant resistance? Can you just do a current limit with V = IR applied?


The current will be a function of the difference between the applied voltage and the back-emf voltage. So, you need to know the back-emf voltage to calculate the current limit voltage. Once you know the back-emf, V=IR still applies, but the resistance does have a temperature dependency. However, R will increase with temperature, so your current limit will become more conservative as the motor heats up.

Due to a brush DC motor’s back EMF and the motor coil’s impedance characteristics the motor coil’s resistance at rest will not work without considering the phase angles in the quantities making them no longer simple decimal numbers but complex numbers (polar or imaginary notation) and those precise numbers at any given moment would best be estimated with calculus.

Here’s some information on modelling a DC brush motor for a simulation:

Inductors and capacitors have a quality called impedance which has a real element we think of as resistance but a complex quantity induced by the way a coil’s magnetic properties work, or a capacitor’s storage of energy works. We say current leads the voltage with capacitors, or voltage leads the current with coils. This relationship would become very clear if you test either compentent with an oscilloscope outfitted with 2 channels one measuring voltage and the other measuring current (using a current probe if you can). You’ll see the leading/lagging very clearly.

There is an option to configure the peak output of the TalonSRX in terms of the percent output.

configPeakOutputForward(percentForward, timeoutMs)
configPeakOutputReverse(percentReverse, timeoutMs)

With voltage compensation enabled, this function can easily be used to set a voltage limit. The peak output forward ensures that the TalonSRX never commands a percent output above the limit and the peak output reverse ensures that the TalonSRX never commands a percent output below that limit.

Edit [Clarification]: This capping of output is effective in all control modes.

OP, FYI, there’s a lot of folks around here who have done some pretty advanced work into the nature of various limiting strategies for electrical & physical values on motors. If you’re willing to share, do you have an end goal in mind? The community here may have some good suggestions to guide you!

Not really tbh. We got some 775pros for next season so just making sure we keep our chances of burnin them out the lowest possible

I did a copy paste from one of my posts from another thread about this issue:

Here’s a way to visualize what different limits do to motor performance. Every PM motor has a speed/torque curve and a speed/current curve that looks like this (just look at the yellow line and the blue line for now):

This is what a 775pro does with 12V applied. If you limit the voltage the lines will keep the same slopes and simply move down the graph. If you limit the current, the graphs will truncate at said current limit. So if you limit the current to 50 Amps, then draw a horizontal line starting at 50 until it intersects the blue line and that is your new speed/current curve. If you limit the velocity, the graphs will get lopped off at said velocity. Limit the speed to 10,000 RPM then draw a vertical line starting at 10,000 RPM until it hits the yellow line and that is your new speed/torque curve. You can do both at the same time to make yet another funny looking curve. Current limiting is the way to go when it comes to keeping the smoke in the motors because the motor performs as expected until its overloaded. There is some debate on how good a Talon does it’s current limit, but we have found that it works good enough to save motors.