9. Skip to content

9. RealSense Camera Intrinsic & Extrinsic Calibration#

An Automated Method for Extrinsic and Intrinsic Calibration of End-of-Arm Cameras

Reminder

Contact the technical-support team to obtain the calibration-board PDF, ArUco-marker PDF, and the complete calibration-script package.

Prerequisites:

9.1 Environment Setup#

9.1.1 Python Environment#

Hardware supported: Intel RealSense cameras and USB cameras (default device ID 0)

Dependency Version
pyrealsense2 2.55.1.6486
pyyaml 3.4.4

9.1.2 RealSense Camera Driver#

Dependency Version
Intel RealSense SDK 2.0 2.0

9.1.2.1 Calibration Board#

Download and print the calibration board:

Calibration Board

Note: Print at 100 % scale!

9.1.3 Environment Installation Steps#

Activate the conda virtual environment

sudo apt-get update
Install pyrealsense2:

pip install pyrealsense2 -i https://pypi.tuna.tsinghua.edu.cn/simple

9.1.4 Physical Setup (eye-in-hand)#

Place the calibration board approximately 10 cm from the robot-base centre and 6 cm sideways so that it remains visible in all 20 poses the automatic hand-eye routine cycles through. After the run, open the folder calib/hand_eye_640x480/20250513112255 (auto-generated) and verify that the board never leaves the camera field of view; if it does, shift the board and re-calibrate.

Calibration Board
Calibration Board

9.1.5 Physical Setup (eye-to-hand)#

Mount the calibration board on the robot end-effector to establish the transform between the camera and the robot-base coordinate system.

Calibration Board

9.1.6 Calibration-Board Parameters#

The software expects a 10 × 8 interior-corner pattern. Board specifications:

Calibration-Board Parameters

If you switch to a different board, update the corresponding values at line 115 of the script.

9.2 Launch the Robot Arm Control Service#

Open a terminal and start the arm control service:

airbot_fsm -i <INTERFACE> -p <PORT>
or
airbot_server -i <INTERFACE> -p <PORT>

  • <INTERFACE> interface name shown by ip link ; default device names are canX (X starts at 0), e.g. can0, can1.
  • <PORT> – gRPC server listen port. Use a unique port for each device, e.g. 50000, 50001, 50010. Key points: Example:
    airbot_server -i can0 -p 50051
    

9.3 Run Automated Camera Intrinsic & Extrinsic Calibration#

9.3.1 Camera Intrinsic & Eye-in-Hand Calibration#

Open a terminal in the script folder and run:

conda activate airbot
python3 -m airbot_calibration -t hand_in_eye_auto

## If automatic calibration fails, use manual calibration: drag the arm to different positions, ensure the calibration board remains fully in view, and press ESC to save the images.
python3 -m airbot_calibration -t hand_in_eye

Note

To change the RealSense resolution, edit the resolution parameter in cam_calibration_real_3.0/configs/rs_camera.yaml.

Script commands

Run results:

Script commands

Visualization analysis report

Visualization Report 1
Visualization Report 2

The program automatically performs both intrinsic and extrinsic camera calibration and saves the analysis report in a folder similar to:

Report directory

Calibration accuracy requirement: Projection Error < 0.03. Since this value is affected by robot positioning accuracy, calibrate the arm first to ensure its positioning meets the spec. If the camera calibration does not satisfy the criterion, slightly reposition the calibration board and rerun the process.

Report directory

9.3.2 Camera Intrinsic & Eye-to-Hand Calibration#

Open a terminal in the script directory and run:

conda activate airbot
python3 -m airbot_calibration -t hand_to_eye -c usbcam 

## To specify a USB camera, add -d:
python3 -m airbot_calibration -t hand_to_eye -c usbcam -d 0
## For additional options see the source code.

## The same script can be used when auto poses are insufficient:
python3 -m airbot_calibration -t hand_in_eye -c realsense 
Manually drag the arm to 40 poses that span the camera field of view, ensuring full coverage for optimal calibration; the analysis report is saved in the same manner as the hand-in-eye section.

9.4 Intrinsic & Extrinsic Accuracy Check#

Replace the calibration board with the ArUco target sheet and run the supplied aruco_detect_realsense.py script. After the run, move the generated Calibration_Report.txt into cam_calibration_real/configs/.

python3 -m aruco_detect_realsense

The expected verification result is shown below; if the average error exceeds 1 mm, recalibrate the camera intrinsics and extrinsics.

Intrinsic Accuracy

If the following exception appears, the ArUco validation sheet is outside the camera FOV. Reposition it so the entire sheet is visible; run airbot_realsense.py to preview the current view.

Exception Handling

After the run, the program visualises both intrinsic and extrinsic results:

  • Intrinsic calibration verification:Intrinsic result visualization, displays five markers in the camera frame together with the four inter-marker distances in the camera frame (true distance = 150 mm). The average error between the four outer markers and the central marker is shown in the top-left corner.

    Intrinsic Marker

  • Extrinsic calibration verification: Extrinsic result visualization, displays the same five markers in the robot-base frame with the corresponding distances. The average error is again shown in the top-left corner.

    Extrinsic Marker

9.5 Exception Handling#

If more than 10 % of the images contain the message shown below:

Recalibrate

repeat the calibration procedure, placing the calibration board as accurately as described in the initial setup step.