Hi, so there are a couple of different things I think that are causing confusion. The primary one is what weput in the documentation: “Note: The motor current, and the current drawn from the power supply, is not the same in general. You should not look at the power supply current to see what is going on with the motor current.”
The motor current is indeed proportional to torque, while the power supply current is proportional to motor power. At low speeds, they are very different: high torque but almost no power, this is why you see it drop when you stop the motor.
To see the actual motor current, you can use the liveplotter. By default it’s plotting the position of motor 0, but you can change the code: change
my_odrive.motor0.current_control.Iq_measured to plot the motor current instead.
.vel_lim is not used in current mode (CURRENT_CONTROL_MODE). Current mode will just put the current you ask for on the motor, no limits applied. That is, if you ask for a current then your motor will get a torque and just accelerate, until it hits the base speed for your bus voltage, at which point it’s not possible to go any faster (ignoring field weakening, which is not used). You can use the ODrive Motor Guide to check the base speed of your motor and bus voltage.
We can add a speed-limited current control mode, I think it’s something I think other people can make use of too. So here is my understanding of what you want, let me know how accurate that is:
- Nominal current command, sent in realtime from some source. We can use
current_setpoint for that.
- I think it makes sense to use
vel_lim for this.
- A ramp-down gradient to make the transition into vel_limit operation smooth. This is actually equivalent to
vel_gain, so we can use that.