7、Calibration of the robot arm
Introduction of API
Function：When the position is adjusted to zero, there is impalignment of the port of the robot arm, and the wrong joint can be calibrated using this method.
servo_no：Value range 1~6，represents 6 joint points.
Function: Determines whether the current robot arm is in a writeable state
Return value：1 means writeable, 0 means you can't write, -1 indicates an error.
Function: Set 6 joints to the initial position.
Content of code
from pymycobot.mycobot import MyCobot from pymycobot import PI_PORT, PI_BAUD # hen using the Raspberry Pi version of myCobot, you can refer to these two variables for MyCobot initialization # Initailize a MyCobot object mc = MyCobot(PI_PORT, PI_BAUD) # Detect whether the robot arm can burn into the program if mc.is_controller_connected() != 1: print("Connect the robot arm correctly for program writing") exit(0) # Fine-tune the robot arm to ensure that all snaps in the adjusted position are aligned # Based on the alignment of the robot arm port, only a case is given here mc.send_angles([0, 0, 18, 0, 0, 0], 20) # Calibrate the position at this time, and the angle position after calibration is represented[0,0,0,0,0,0]，The potential value is represented [2048,2048,2048,2048,2048,2048] # The for loop is equivalent to the set_gripper_ini() method for i in range(1, 7): mc.set_servo_calibration(i)