Welcome to JetCobot repository
7. Calibrate the robot arm joints
Calibrate the robot arm joints
Note: Jetcobot robot arm has been calibrated before leaving the factory. Please do not calibrate unless necessary. If you confirm that you need to calibrate the robot arm, please follow the content of this tutorial.
This course calibrates the six joints of the robot arm, excluding the calibration gripper.
1. API Introduction
release_all_servos()
Function explanation: Release the torque of all joints of the robot arm. After release, the robot arm will no longer maintain the posture and can be moved by hand.
Parameter explanation:
Return value: None
set_servo_calibration()
Function explanation: Set the current servo angle to zero.
Parameter explanation:
Return value: None
2. Important code explanation
Code path: ~/jetcobot_ws/src/jetcobot_calibration/scripts/cali_joints.ipynb
Create three buttons to control the functions of releasing, calibrating, and reading the robot arm.
x# 读取机械臂关节角度 Readbutton_Read = widgets.Button( description='Read', button_style='info', # 'success', 'info', 'warning', 'danger' or '' tooltip='Description', icon='uncheck' )
# 校准机械臂 Calibrationbutton_Calibration = widgets.Button( description='Calibration', button_style='success', # 'success', 'info', 'warning', 'danger' or '' tooltip='Description', icon='uncheck' )
# 松开机械臂 Releasebutton_Release = widgets.Button( description='Release', button_style='danger', # 'success', 'info', 'warning', 'danger' or '' tooltip='Description', icon='uncheck' )
# 按键按下事件处理 Key press event processingdef on_button_clicked(b): with output: print("Button clicked:", b.description) if b.description == 'Read': with output: print("read joints:", mc.get_angles())
elif b.description == 'Calibration': for i in range(1, 7): mc.set_servo_calibration(i) time.sleep(1) mc.power_on() with output: print("calibration complete") elif b.description == 'Release': mc.release_all_servos() # 关联按键事件回调 Button event callbacksbutton_Read.on_click(on_button_clicked) button_Calibration.on_click(on_button_clicked) button_Release.on_click(on_button_clicked)
3. Run the program
Click the Run the entire program button on the jupyterlab toolbar, and then pull it to the bottom.

You can see three buttons displayed.

Click the [Release] button to release the torque of the robotic arm, so that the robotic arm is in a free twisting state, and then align the calibration points of the six joints of the robotic arm. Joints 1 and 2 are shown in the figure below. For other joints, please check the corresponding positions of the joints on the robotic arm.

After confirming that the calibration points of the six joints are aligned, click the [Calibration] button to start calibration. It takes about a few seconds. Do not change the posture of the robot arm before receiving the [calibration complete] prompt. After the calibration is completed, the [calibration complete] prompt will be printed, and the robot arm will be powered on and the posture will be fixed.

Click [Read] to read the angle of the robot arm. If the angle values read are all around 0 degrees, the calibration is complete.