Weird behaviour of motors when setting them to Torque mode then Trajectory mode

I’m working on cable robot where I need to do two phases of setup. first, set certain torque values to the motors, to have tension on all cables. Then change the mode to Trajectory mode to start the next phase. However, although phase 1 (torque) works well, when I enter trajectory mode the motors spin - and unwind the cable - weirdly then stop!! I think they spin back to the point before starting the torque mode(?)

Is that a known problem? or am I doing something wrong? How can I enter trajectory mode while keeping the motors at their current position?

here is a snippet of the code:

odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis1.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

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

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

odrv0.axis0.motor.config.torque_constant = 8.23 / 270
odrv0.axis1.motor.config.torque_constant = 8.23 / 270

#Set torque of each motor
odrv0.axis0.controller.input_torque = -0.03
odrv0.axis1.controller.input_torque = 0.03


odrv0.axis0.controller.input_torque = 0
odrv0.axis1.controller.input_torque = 0


odrv0.axis0.controller.config.input_mode = INPUT_MODE_TRAP_TRAJ
odrv0.axis1.controller.config.input_mode = INPUT_MODE_TRAP_TRAJ


Hi there!

You’re never actually setting the motors to position mode - if you change from torque control to position control, it should work a lot better! Trapezoidal trajectories on torque don’t tend to work too well :wink:

1 Like

Thanks for the third time Solomon!!!

Indeed I figured out that’s the problem, but in essence I think it should’ve send an error, or just don’t move at all, it confused me a bit!!

Nevertheless, thank you