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