ODrive S1 configuration and calibration via Python

I am trying to create a python script to calibrate various motors with S1 board. I am starting with the BotWheel. So the script seems to work fine until I request motor calibration. Nothing happens, no beep etc. I dump the errors from my Python script and it shows one active error without any detail. So I kill my script and go over to the odrivetool and connect. (my script configuration is still in place). I dump errors, no active error which is weird; anyway then via odrivetool I change the requested_state to MOTOR_CALIBRATION and I get the beep and successfully calibrate the motor. Oh yeah, did the same thing with the GUI with same result i.e. successful motor calibration without changing any configuration. Does anyone know why I can’t run MOTOR_CALIBRATION from my Python, is there some trick I am not aware of …

thanks

I’d be happy to help you out, but first I’ll need to see how you’re running motor calibration from your Python script. Could you please share a snippet? The whole script would be ideal, but I understand if privacy is a concern. Feel free to DM me if that is the case.

Hi thanks here is the small snippet of the motor function: how do I attach the entire python file?

def motor_calibration(self):
self._find_odrive()

    print("Calibrating Odrive for RBE-202024-003 motor (you should hear a "
          "beep)...")

    self.odrv_axis.requested_state = AxisState.MOTOR_CALIBRATION
    while self.odrv_axis.current_state != AXIS_STATE_IDLE:
        time.sleep(1)

    if self.odrv_axis.disarm_reason != 0:
        print("Disarmed: {}".format(self.odrv_axis.disarm_reason))
        print("Current state: {}".format(self.odrv_axis.current_state))
        sys.exit(1)
        #self.clear_errors()

    # Wait for calibration to take place
    time.sleep(20)

    self.show_errors()