10. Skip to content

10. Visual 3D Grasping#

A step-by-step method for picking and placing objects on a table with an AIRBOT arm and vision system.

Note

Contact the technical-support team to obtain the required source file Stacking_Bricks.zip.

Prerequisites:

Note

MUST perform camera intrinsic and extrinsic calibration before any visual grasping task!!!

10.1 Environment Setup#

10.1.1 Python Environment#

The vision hardware used in this article is the Intel RealSense camera family.

Dependency Version
pyrealsense2 2.55.1.6486

10.1.2 RealSense Camera Driver#

Dependency Version
Intel RealSense SDK 2.0 2.0

10.1.3 Physical Setup#

Choose a desktop with a white background whenever possible. This demo uses color-space segmentation to detect small wooden blocks; blue, green, or red backgrounds may cause recognition to fail.

10.1.4 Environment Installation Steps#

Install RealSense camera driver. On Ubuntu you can skip manually downloading the SDK—just run:

Activate the conda virtual environment

conda activate [airbot]

Install pyrealsense2:

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

10.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

10.3 Run stacking_bricks.py – the arm-vision vertical-grasp demo.#

10.3.1 Download and extract Stacking_Bricks.zip:#

#Must match the `<PORT>` used in the previous step (`airbot_fsm -i can0 -p 50051`).
python3 -m stacking_bricks -p 50051

Package contents explained

文件包内容
- stacking_bricks.py – implements vision-based vertical grasping

  • brick_detect_realsense.py – Performs brick detection with the RealSense camera.

  • arm_kdl.py – AIRBOT_Play kinematics

  • airbot_realsense.py – RealSense configuration

  • configs – camera parameters & calibration data

10.3.2 Intrinsic & extrinsic parameter configuration#

For details on obtaining the intrinsic and extrinsic parameters, please refer to Automated Camera Intrinsic & Extrinsic Calibration

Save the .txt file obtained from Automated Camera Intrinsic & Extrinsic Calibration in this directory; the program will automatically read the camera's intrinsic and extrinsic parameters from it.

内外参路径

10.3.3 Program Execution & Demonstration#

Open a terminal in the package directory.

conda activate airbot
python3 -m stacking_bricks

Once the program is running, the screen will show:

  • Green rectangles mark the detected small bricks, with parameters for brick color and its coordinates in the camera frame
  • This demo can detect blue, green, and red bricks
Brick Detection

Press q to close the window and start stacking; a darker background is recommended for higher recognition accuracy.