Single Rotary Axis Calibration
Image: Sample four points at 0,90,180 and 270 to calculate the axis of rotation. The example script rotates 90 degrees after each point is sampled.
The calibration of a single rotary axis is performed by resampling a single point at four different positions around the axis of rotation. These sampled points are used to calculate the frame that is at the rotation center, with the z-axis of the frame aligned with the axis of rotation, pointing out from the motor shaft. This basic script will prompt you to freedrive to the target point at different positions, sample the points, then run the calibration function (calibrate_rotary_axis) and store the result to the global variable CAL_AX1_ROTARY.
# Single Rotary Axis Calibration
def move_axis(group_name, axis1_position):
msg1 = group_name
msg1 = str_cat(msg1, " will now move to [")
msg1 = str_cat(msg1, to_str(axis1_position))
msg1 = str_cat(msg1, "] degrees")
popup(msg1, "Axis is about to move!", warning=True, error=False, blocking=True)
ethercat_enable_axis("axis1")
axis_group_movej(group_name, [d2r(axis1_position)], 1, 1)
ethercat_disable_axis("axis1")
end
def teachCalPointAxis(position1, ref_frame):
move_axis("positioner", position1)
freedrive_mode()
msg = "Freedrive to the calibration point, then click Continue"
popup(msg, "Axis Calibration", blocking=True)
p = get_pose("tcp", ref_frame)
end_freedrive_mode()
return p
end
#-----------------------------------------------------------
# Provide a function to configure your base ethercat setup
#-----------------------------------------------------------
if not run_axis_config():
popup("configuration failed to run", title="Axis Calibration", warning=False, error=True, blocking=True)
halt
end
# Teach the pose of axis1 relatitve to the robot base.
# The robot base should not move
popup("Ready to Calibrate Axis1?", title="Axis Calibration", warning=False, error=False, blocking=True)
p1 = teachCalPointAxis( 0.0, "base")
p2 = teachCalPointAxis( 90.0, "base")
p3 = teachCalPointAxis(180.0, "base")
p4 = teachCalPointAxis(270.0, "base")
move_axes("positioner", 0)
CAL_AX1_ROTARY = calibrate_rotary_axis([p1, p2, p3, p4],[])[0]
popup("Axis1 pose saved in the installation variable CAL_AX1_ROTARY", "Calibration")
# Teach the pose of axis2 relatitve to axis1
# Axis1 should not move
popup("Completed Single rotary axis calibration.", "Calibration")