Motor enable/disable over USB?

It seems there should be an easy answer to this. Is there a simple way to enable/disable axes via USB and python? The default way I have done this is to set all gains to 0. But we have run into two issues:

  1. Then you have to remember the gains and reset them. Admittedly a trivial operation. But if you re-enable the gains after moving the motor around and not re-setting the set position or the integrator error you might be in for a jolt.

  2. In one case we observed anomalous, almost random rotation of the motor when the gains were set to 0. I am not sure why this happened.

In principal I would like to be able to kill the motor, and then re-enable it with it to auto set the new home position to it’s current location. Ideally this would be done in firmware so you don’t have to worry about remembering gains and positions across python sessions.

Any suggestions would be great.

Thanks for the awesome driver.

Nick

personnally, i used a fixed odrive configuration that python re-executes upon startup, then i simply read the motors positions prior to send movement commands => this way i can just kill and restart my python scripts, it’s seamless.

about disabling motors, i will have the very same need very soon. my intention is to use a current_lim set to 0.0
i guess that it should prevent any current being sent to motors, thus effectively disabling them. i have not tested it yet but should do it very soon

however, that assumes that motors do not fight against gravity or another mecanic force. if that is the case, then i guess you will somehow need to save motors positions prior to terminating your script and restore it with positionning commands (using the right velocity scheme…).

We will have support for disabling the PWM to the motor with firmware v0.4.0. However the effect is very similar to setting the current_lim to 0 right now. I think we will also include setting the position setpoint and current positon to zero when re-enabling position control for safety reasons, as you suggest.

Until then, yes I think you are stuck with:

  1. set current_gain to 0 to disable
  2. to enable:
    1. read current position
    2. write curent position to setpoint
    3. write current_gain back to running value