Using odrive to have my motor output a constant torque

I’m trying to use Odrive to drive a motor at a constant torque. The intent is to simulate a torque that wind would apply to the blades of a wind turbine. The motor’s output shaft is coupled to another motor’s shaft, which is being driven as a generator. Then the power that the generator-motor outputs is recorded for each input torque. The problem is that I’m struggling to have the Odrive drive the motor with a constant torque. Unsure if I’m using the torque control mode incorrectly, but when I set a torque it either does nothing at all (most of the time) or it turns on, turns for half a second and then the motor shuts back off. What should I do?

Are you in any error state e.g. ERROR_OVERSPEED when it shuts off? (use dump_errors(odrv0) to display errors or dump_errors(odrv0, True) to display and then reset them)

If it’s overspeed, then just increase controller.config.vel_limit

2 Likes

I was getting ERROR_OVERSPEED but I’ve already increased the vel_limit appropriately. Then for a while I was getting UNKNOWN_TORQUE. I since then reset the config and reentered all of the parameters paying extra attention to Kv of the motor, and ran it again at an attempted torque of 0.2, which is below my max set torque of 1.99, and likely well below my max velocity which is set at 60. Now when I run it I get no errors after running it, but it only spins the motor for about a quarter turn before slowing to a halt. Not sure what’s going wrong here.

Sounds like something is wrong with the encoder. Maybe it is slipping on the shaft, losing pulses somehow, or it is not configured properly e.g. cpr, pole_pairs