How to achieve free rolling under position control

Hi,

I’m trying to achieve the following with odrive & D6374-150kv:

  1. Accelerate a mobile robot or such quickly to a certain dedicated speed.
  2. Letting it roll forward freely without the motor to break or accelerate
  3. After a certain distance, take control back and break the mobile so that it stops to a given position.

This would be straight forward without point 2. - just to set vel_limit and input_pos and that’s it.

I have tried the following:

my_drive.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
start_pos = my_drive.axis0.controller.input_pos
my_drive.axis0.motor.config.current_lim = 30
my_drive.axis0.controller.input_pos = start_pos + 10.0

time to accelerate

time.sleep(0.1)
my_drive.axis0.motor.config.current_lim = 1

time for free rolling

time.sleep(0.5)

take the control back and stop at

my_drive.axis0.motor.config.current_lim = 30
my_drive.axis0.controller.input_pos = start_pos + 10.0

Both 1. acceleration and 2. free rolling works OK by setting the current limit low, but taking control back and moving to the final position do not work, and odrive gives motor failed error.

I’m still new with odrive, thus there’s probably an obvious solution to this.
Could you please advice how to achieve the points 1-3.

All in all, odrive is a really great product. I’m already impressed with its capabilities and easy ways to control with python.

Is it feasible to change control modes during operation? ie change controller.config.control_mode to velocity for part 1, torque mode for part 2, and position mode for part 3?

Yes you can change the control mode during operation.

1 Like

Thanks for your help!
Changing the control modes like towen suggested worked perfectly.

BR,
Juha