Maximum motor power

Is it possible to limit the motor power with ODrive? Previously I previously used VESC, which has motor power limitation implemented, but due ODrive’s superior controller I switched.

If not, is it planned to implement such feature?

You could limit the motor power via the DC Bus Positive Current limit - assuming your supply is constant voltage, then a current limit on the DC bus would translate to a motor power limit.

True dat, I will test it out thanks!

Tested this today in velocity mode, but it doesn’t work as I hoped. When the current is exceeding the limit, the motor fails with “MOTOR_ERROR_DC_BUS_OVER_CURRENT” and stops.
I hoped the motor would just slow down to not exceed the current limit, not stop. Is there a solution to this implemented that I need to enable?

maybe try this!


The DC voltage exceeded the limit configured in config.dc_bus_overvoltage_trip_level.

Confirm that you have a brake resistor of the correct value connected securely and that config.brake_resistance is set to the value of your brake resistor.

You can monitor your PSU voltage using liveplotter in odrivetool by entering start_liveplotter(lambda: [odrv0.vbus_voltage]). If during a move you see the voltage rise above your PSU’s nominal set voltage then you have your brake resistance set too low. This may happen if you are using long wires or small gauge wires to connect your brake resistor to your odrive which will added extra resistance. This extra resistance needs to be accounted for to prevent this voltage spike. If you have checked all your connections you can also try increasing your brake resistance by ~ 0.01 Ohm at a time to a maximum of 0.05 greater than your brake resistor value.

No, the issue is that I had misunderstood how DC_BUS_MAX_POSITIVE_CURRENT works. It triggers an immediate error instead of dynamically reducing the current (like motor.config.torque_lim).

The OP needs a “constant power” mode, whereby the the value of (speed * torque) is what is limited, instead of just speed and torque individually.

It should be possible to fix this, but it’d require a firmware mod.
Or else, if the python code is fast enough, it could adjust motor.config.torque_lim on the fly.

What we need is a motor.config.power_lim


At one time, it was planned to create a “Power Manager” that would handle N motors and limit the power both into the board and at each motor. It’s been very low priority for several years now :stuck_out_tongue:

I implemented a 100Hz controller to limit/reduce the rps as the torque rises to get a power limit. It was not perfect but did the job for this project. A “Power Manager” is exactly what I (we?) need.

As we say in Norway: “Whoever waits for something good, waits not in vain” :heart_eyes:


Can you post the algorithm you use to calculate power/limit power?

I did the calculation with external sensors (torque and velocity), not inside the ODrive. The formula is however the same:
P[w] = vel[rad/s] * torque[Nm],

where the velocity is estimated in the encoder loop and the torque is calculated from the current Iq_measured times the torqueconstant (8.27/kv)