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
sleep(2)
odrv0.axis0.controller.input_torque = 0
odrv0.axis1.controller.input_torque = 0
#MOTORS WORK AS EXPECTED UNTIL HERE
odrv0.axis0.controller.config.input_mode = INPUT_MODE_TRAP_TRAJ
odrv0.axis1.controller.config.input_mode = INPUT_MODE_TRAP_TRAJ
#MOTORS GO CRAZY