PWM for torque control

Hello,
I am recently developing a force-controller robot using ODrive. I found a lot of tutorials but no one could tell me how to do the torque control using PWM. Does ODrive support torque control using PWM?

Best regards,
Chao

e.g.

odrv0.config.gpio4_mode = GPIO_MODE_PWM
 odrv0.config.gpio4_pwm_mapping.min = -2
 odrv0.config.gpio4_pwm_mapping.max = 2
 odrv0.config.gpio4_pwm_mapping.endpoint = odrv0.axis0.controller._input_torque_property

Don’t forget to configure an appropriate vel_limit or disable torque_mode_vel_limit

1 Like

Thank you so much.

I tried to disable the velocity limit by “odrv0.axis0.controller.torque_mode_vel_limit = False” and “odrv0.axis0.controller.enable_torque_mode_vel_limit = False”, but it returns with error “AttributeError: Attribute torque_mode_vel_limit not found” and “AttributeError: Attribute enable_torque_mode_vel_limit not found”, respectively.

Additionally, I got one more issue about the PWM torque mapping. I will new a topic to discuss this issue.

Best regards,
Chao