The motor doesnt rotate

Hello everybody,
This is my first experience with odrive and i have some troubles. I am using the code below. During the calibration works makes the rotation forward and backwards, but when i try to make one rotation doesn’t move with my_drive.axis0.controller.input_pos=1.0. Any ideas why is happening this error? Do you have a simple code for this components ?

Thanks in advance.

Those are the components:

  • Motor ODrive D5065 270KV
  • Stepper Online PLE Series Planetary Gearbox Gear Ratio 10:1
  • ODrive Motor controller board V3.6
  • Encoder AMT 102 CUI INC
  • ODrive power resistor 50W
  • Power supply


from __future__ import print_function
import odrive
from odrive.enums import *
import time


print("finding an odrive")
my_drive = odrive.find_any()

#my_drive = odrive.find_any("serial:/dev/ttyUSB0")

print("starting calibration")

my_drive.axis0.controller.config.vel_limit=0.25

my_drive.axis0.requested_state=AXIS_STATE_FULL_CALIBRATION_SEQUENCE

while my_drive.axis0.current_state != AXIS_STATE_IDLE :
    print("my_drive.axis0.current_state 1",my_drive.axis0.current_state)
    time.sleep(0.1)

print("my_drive.axis0.current_state 2",my_drive.axis0.current_state)
my_drive.axis0.requested_state =AXIS_STATE_CLOSED_LOOP_CONTROL

print("my_drive.axis0.requested_state 3",my_drive.axis0.requested_state )
my_drive.axis0.controller.input_pos=1.0
print("my_drive.axis0.requested_state 4",my_drive.axis0.requested_state )

print("bus voltage is " + str(my_drive.vbus_voltage)+ "V")
starting calibration
my_drive.axis0.current_state 1 4
my_drive.axis0.current_state 1 4
my_drive.axis0.current_state 1 7
my_drive.axis0.current_state 1 7
my_drive.axis0.current_state 1 7
my_drive.axis0.current_state 2 1
my_drive.axis0.requested_state 3 0
my_drive.axis0.requested_state 4 0
bus voltage is 24.048267364501953V

Sorry to hear you’re having trouble. Looks like you have an OVERSPEED error. This usually happens when my_drive.axis0.controller.config.vel_limit is too low. Set it higher :slight_smile:

Thanks for replying.
I have change the vel_limit = 3 # [turn/s] and now rotates !!! when i introduce odrv0.axis0.controller.input_pos =5 rotates but when it finish rotate keeps moving like a pendulum. And when introduce odrv0.axis0.controller.input_pos =50 doesnt make the pendulum. Is it normal?

That can be normal with high cogging. Try increasing controller.config.pos_gain and controller.config.vel_gain

Thank you very much!!! now works fine

1 Like