Can not set the torque_setpoint

Hi, I struggle to run a brushed motor with ODrive.

I add a function to run brushed motor in motor.cpp.

I can run brushed motor if I set torque_setpoint directly(set as “12” in below picture).

But, I cannot do that if I set torque_setpoint through controller.


What is the problem?

My ODrive configuration is below.

odrv0.axis0.controller.config.control_mode = CONTROL_MODE_TORQUE_CONTROL;

odrv0.axis0.controller.config.input_mode = INPUT_MODE_PASSTHROUGH;


Sorry, I had set vel_lim and torque_lim very small.

It works now.

1 Like

Awesome! Can you submit a pull request to the github?

OK, I submit a pull request after refactoring.

My code is made from this one.

I finished to refactring and I up my brushed control code.

My code supports torque,velocity,and position cotrol in closed loop.
you can use it in the same way as bldc motor.
Please note that this does not support sensorless control.
If you want to use

odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_BRUSHED

odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

and you can set the setpoint you like.

If not work well ,please tune PID gain.

1 Like