I have my new odrive setup with a limit switch at the end of one axis. After homing axis0 remains in an error state (AXIS_ERROR_MIN_ENDSTOP_PRESSED). Using odrivetool, I can clear the error, then can jog the axis around normally. However, when I write a python script which follows the same process, I’m unable to move the axis. If I then launch odrivetool and do dump_errors, I see that it’s still in the same error state. But now I can’t clear it (even from odrivetool), and only a reboot will get things going again.
Here’s my python script.
import odrive
from odrive.enums import *
import time
import math
PULLEY_PCD = 19.1*0.001 # m
AXIS_RANGE = 0.8 # m
HOMING_TIMEOUT = 20 # s
print("finding an odrive...")
od = odrive.find_any()
# Clear any errors (both axes)
od.axis0.clear_errors()
od.axis1.clear_errors()
axis = od.axis0
# mo = axis0.motor
# Ask axis to home
axis.controller.config.homing_speed = 0.7
axis.requested_state = AXIS_STATE_HOMING
print("Homing")
t_start = time.time()
while axis.current_state != AXIS_STATE_IDLE and ((time.time() - t_start) <= HOMING_TIMEOUT):
pass
if (time.time() - t_start > HOMING_TIMEOUT):
print("...timed out")
axis.requested_state = AXIS_STATE_IDLE
quit()
else:
print("...homed")
# Clear the homing active error
axis.clear_errors()
# Put odrive in closed loop mode
axis.controller.config.input_mode = AXIS_STATE_CLOSED_LOOP_CONTROL
axis.controller.config.input_mode = INPUT_MODE_TRAP_TRAJ
# Prompt user for target location, do some validation then command move axis
while(True):
print("Enter axis target (m):")
target_m = float(input())
if(target_m > AXIS_RANGE):
target_m = AXIS_RANGE
elif(target_m < 0):
target_m = 0
target_turns = target_m / (PULLEY_PCD*math.pi)
print("target: " + str(target_m) + "m, " + str(target_turns) + " turns")
# od.axis0.clear_errors()
axis.controller.input_pos = target_turns
while axis.current_state != AXIS_STATE_IDLE:
pass
print("Movement complete")
If I push the axis off the limit switch, then trying jogging the axis (from within my python program) it now works as expected. But I still have the issue with the error, which is to say it won’t move while it’s on the limit switch, and clearing the error from within my python program using
During that process some settings seemed to get lost, so I’ve dismantled my system (i.e. no load on the motor) and have re run the calibration process, then saved the configuration. All seems well, but when I do odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL, I get motor error MOTOR_ERROR_UNKNOWN_PHASE_ESTIMATE. odrv0.axis0.motor.is_calibrated is showing as True, and the encoder seems to be working fine. I’m using a D6374 I bought from the store.
I seem to have resolved this by erasing the entire configuration and starting from scratch. I’ll report back later on whether the firmware upgrade has solved my AXIS_ERROR_MIN_ENDSTOP_PRESSED error problem.
Hi, I just uploaded 0.5.2 firmware on Odrive 3.6-56V and configured min_endstop and axis homing at startup.
I’m getting the same error (AXIS_ERROR_MIN_ENDSTOP_PRESSED) when homing on startup.
I don’t understand why since I followed the docs page on homing to set it up.
I also have a problem: after autohoming, the motor goes to the indicated offset position, but after that it puts extra turns in the negative direction, and I can’t solve it.
I am using an incremental encoder ,this happens if the distance to homing is more than 2 turns
Firmware 0.5.4 and 0.5.3
If send command: odrv0.axis0.requested_state = AXIS_STATE_IDLE
Then everything works correctly.
Help me please!