Electrical power reporting with moteus
TLDR: As of firmware release 2024-05-20 moteus can now report a pretty good estimate of the electrical (and thus mechanical) output power going to the motor. You can get that through all the language binding options or in tview!
Background
Brushless motor controllers like moteus act like step down DC/DC converters. Their input is a higher voltage and low current, while the output to the motor is low voltage and higher current. If working properly, the output current is driven so as to produce torque at the output shaft.
Now, for some definitions and descriptions:
Electrical power: Electrical power can be calculated by multiplying the current along a circuit multiplied by the voltage drop in that circuit.
Mechanical power: The mechanical power applied to a rotating shaft can be found by multiplying the torque by the rotational speed.
Input electrical power: The input electrical power is the input voltage (which for a BLDC controller will be high), multiplied by the input current. For a BLDC controller, this input current will be lower than the output current and is what your power supply or battery sees. Notably, of these quantities, moteus only has the ability to directly measure the input voltage, and has no facility to measure the input current.
Output electrical power: The output electrical power is the output phase voltage, which for a BLDC controller will be lower than the input voltage, multiplied by the output phase current. Notably, moteus only has a direct measurement of the output current although it can approximate the output voltage by using the PWM ratio and the input voltage.
Efficiency: The overall efficiency of a motor controller is the output mechanical power divided by the input electrical power. This will always be less than 100%. The difference goes to losses in the BLDC controller electronics, electrical losses in the motor, electrical losses in the wiring, and mechanical losses in the motor.
Prior to this new feature, moteus would only report the quantities it could directly measure: the input voltage, and the output current. That meant that many other quantities of interest, like input current, input power, and output power, were very hard to reason about.
What’s new
As of firmware release 2024-05-20, moteus now estimates the output phase voltage based on its PWM output. It then uses that combined with the output current to estimate the output electrical power, which is then reported over CAN both through the diagnostic and register interface.
The input electrical power and output electrical power are related by the “electrical efficiency”, which is always higher than the overall efficiency and for most operation with moteus is in the 85-95% range. This means that you can get a decent estimate of input electrical power from the output electrical power, and if you don’t need to be too accurate, you can even assume they are the same.
When the input power estimate is known, you can use the input voltage to estimate input current, which lets you size batteries and power supplies. It also lets you see how close you are to the currently configured electrical power limit.
Finally, the output electrical power can be used as an approximation of the output mechanical power, although it is less accurate in that regard. For instance, applying torque at zero speed still consumes electrical power, even though it generates zero mechanical power.
How to read it
In tview, you can see the current estimate in servo_stats.electrical_power_W
. Over the register interface, it is accessible as register 0x007. The python and C++ libraries also support accessing it by specifying custom query resolutions.
Good luck!