Homing Script
You should ensure that the movement direction for homing (positive, negative) matches the movement of the servo under position control (positive negative).
# Test 2 - Homing
if not run_axis_config():
popup("configuration failed to run", title="Axis Homing", warning=False, error=True, blocking=True)
halt
end
popup("Ready for Homing?", title="Servo Test2", blocking=True)
popup("Moving axis to ZERO", title="Servo Test2", blocking=True)
axis_group_movej("positioner", [0], 0.1, 0.1)
popup("Home axis to ZERO position?", title="Home Axis", blocking=True)
homing_method = 35 #home to position method. you may need method 37 for your servo
if ethercat_home_axis("axis1", homing_method,0,[],[]) == False:
popup("Homing failed", title="Home Axis", blocking=True, error=True)
end
popup("Turn axis 3 times without homing", title="Test2-Homing", blocking=True)
# we expect the axis to go back to zero after each rotation
i = 0
while i < 3:
axis_group_movej("positioner", [d2r(0)], 0.4, 0.4)
sleep(0.5)
axis_group_movej("positioner", [d2r(360)], 0.4, 0.4)
sleep(0.5)
i = i + 1
end
popup("Turn 3 times with homing after each turn", title="Test2-Homing", blocking=True)
# we expect that the servo will just rotate 3 times, resetting to zero after each rotation
i = 0
while i < 3:
axis_group_movej("positioner", [d2r(0)], 0.4, 0.4)
sleep(0.5)
axis_group_movej("positioner", [d2r(360)], 0.4, 0.4)
sleep(0.5)
ethercat_home_axis("axis1", homing_method,0,[],[])
i = i + 1
end