Motor will not spin after calibration attempts

Hello, I am having some trouble using setting the velocity of a motor connected to an ODrive Pro.

The motor I am using, the GARTT ML5210, does work during the initial calibration – it does one full rotation clockwise, then stops – however, the ODrive Pro seems to refuse to service any commands that control the motor after this calibration sequence completes.

Here is the Python script I wrote:

import odrive
from odrive.enums import *
from time import sleep
from fibre.libfibre import ObjectLostError

class ODrive_Control:
    def __init__(self, motor_kv):
        self.odrive = odrive.find_any()
        self.motor_kv = motor_kv
    
    def perform_calibration(self):
        # Erase configuration, reboot.
        try:
            self.odrive.erase_configuration()
        except ObjectLostError:
            pass
        
        self.odrive = odrive.find_any()

        # This is where the manually defined parameters will go.
        self.odrive.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
        self.odrive.axis0.motor.config.torque_constant = 8.27 / self.motor_kv
        self.odrive.axis0.controller.config.vel_limit = 20
        self.odrive.axis0.controller.input_torque = 0.1
        self.odrive.axis0.motor.config.requested_current_range = 100
        self.odrive.axis0.controller.config.vel_gain = 0.02 * self.odrive.axis0.motor.config.torque_constant
        self.odrive.axis0.controller.config.input_mode = INPUT_MODE_PASSTHROUGH

        # Perform automatic motor calibration.
        self.odrive.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

        while self.odrive.axis0.current_state != AXIS_STATE_IDLE:
            pass
        
        # Save, reboot.
        try:
            self.odrive.save_configuration()
        except ObjectLostError:
            pass

        self.odrive = odrive.find_any()

    def set_axis_state(self, axis, state):
        if axis.requested_state is not state:
            axis.requested_state = state
    
    def set_axis_control_mode(self, axis, mode):
        if axis.controller.config.control_mode is not mode:
            axis.controller.config.control_mode = mode

    def set_position(self, newPosition=0):
        self.set_axis_state(self.odrive.axis0, AXIS_STATE_CLOSED_LOOP_CONTROL)
        self.set_axis_control_mode(self.odrive.axis0, INPUT_MODE_POS_FILTER)
        self.odrive.axis0.controller.input_pos = newPosition

    def set_velocity(self, newVelocity=0):
        self.set_axis_state(self.odrive.axis0, AXIS_STATE_CLOSED_LOOP_CONTROL)
        self.set_axis_control_mode(self.odrive.axis0, CONTROL_MODE_VELOCITY_CONTROL)
        self.odrive.axis0.controller.input_vel = newVelocity

    def reboot(self):
        self.__do_safe_call(self.odrive.reboot())
        self.odrive = odrive.find_any()

m = ODrive_Control(340)
print(f'Performing calibration on {m}...')
m.perform_calibration()
m.set_velocity(5)

Checking the error state via odrivetool shows the following:

In [1]: dump_errors(odrv0)
system: no error
axis0
  axis: no error
  motor: Error(s):
    MOTOR_ERROR_UNKNOWN_TORQUE
    MOTOR_ERROR_UNKNOWN_VOLTAGE_COMMAND
  sensorless_estimator: no error
  encoder: not found
  controller: not found

For reference, I am powering it with a 24VDC power supply that can supply up to a maximum of 1 Ampere (for testing purposes).

So, yeah. I am at a loss. If anyone could possibly steer me in the right direction, I would extremely appreciate it. If not, hopefully someone may stumble across this in the future and find an answer they’re looking for.

1 Like

I had a similar problem (torque mode not working) the solution that I found, witch some help, can be found here: No torque in torque mode - #49 by TeunD. Maybe it gives you some ideas or things to try.

Thank you for your response! Unfortunately this didn’t seem to do the trick.

However, I did a deeper dive and found that the motor actually returns the following error in odrivetool (after updating to the dev branch):

In [1]: dump_errors(odrv0)
system: no error
axis0
  error: no error
  procedure_result: ProcedureResult.NO_RESPONSE
  last_drv_fault: none

I went to read the documentation and didn’t find any indication of what this means, however, so I’m a bit confused. But, since the motor should turn in both directions, it seems as if the calibration failed and then threw this error.

No response means the encoder is not sending any data to the ODrive. Please make sure it’s plugged in correctly, has power, and the ODrive is in the correct mode.

Thank you for the response! I solved the issue a few days ago and forgot to respond here, but it was indeed due to the encoder. Once I fixed it and calibrated it, the motor worked like a charm.

1 Like