yahboom
HomeTutorialsProduct
Solution
Blog
Online Store
About Us
EN/中文
Store
ROSMASTER M1 PRO📖
0.Robot Configuration and Operation Guidelines
  • 0.Unboxing and Review
  • 1.Assembly Videos
  • 2.User Manual
  • 3.Enter Docker (For Raspberry Pi)
  • 4.FAQ
  • 5.RobotManager User Guide
1.Chassis Control Course
  • 1.Robot Information Publishing
  • 2.Robot Handle Control
  • 3.Robot Keyboard Control
  • 4.Linear Velocity Calibration
  • 5.Angular Velocity Calibration
  • 6.Robot URDF Model
  • 7.Robot EKF State Estimation
2.Lidar Course
  • 1.Lidar Introduction And Use
  • 2.Lidar Obstacle Avoidance
  • 3.Lidar Following
  • 4.Lidar Guard
  • 5.Lidar Patrol
  • 6.GMapping-SLAM Mapping
  • 7.Cartographer-SLAM Mapping
  • 8.Slam-Toolbox Mapping
  • 9.Lifelong Mode Mapping
  • 10.Navigation2 Single Point Navigation
  • 11.Navigation2 Multi Point Navigation
  • 12.Cartographer Relocalization Navigation
  • 13.Slam-Toolbox Localization Navigation
  • 14.Synchronous Mapping And Navigation
  • 15.Aruco Visual Relocalization Navigation
  • 16.Mobile App Mapping And Navigation
3.USB Camera-Depth Camera Course
  • 1.USB Camera Introduction
  • 2.USB Camera Intrinsic Calibration
  • 3.Nuwa-HP60C Camera Introduction (Depth Camera Only)
  • 4.Depth Pseudo Color Image (Depth Camera Only)
  • 5.Depth Camera Distance Measurement (Depth Camera Only)
  • 6.Block Volume Calculation (Depth Camera Only)
  • 7.Edge Detection (Depth Camera Only)
  • 8.RTAB-Map SLAM Mapping (Depth Camera Only)
  • 9.RTAB-Map Navigation (Depth Camera Only)
4.Robotic Arm and 3D Space Gripping Course
  • 1.Robotic Arm Basic Usage
  • 2.Robotic Arm Kinematics
  • 3.Robotic Arm Chassis Coordination Control
  • 4.AprilTag ID Sorting
  • 5.AprilTag Height Anomaly Sorting
  • 6.AprilTag Tracking and Grasping
  • 7.Color Block Sorting
  • 8.Color Block Height Anomaly Sorting
  • 9.Color Block Tracking and Grasping
  • 10.Wood Block Shape Sorting
  • 11.KCF Tracking and Grasping Objects
  • 12.Mediapipe Gesture ID Sorting AprilTag
  • 13.Mediapipe Gesture Height Sorting AprilTag
  • 14.Desktop Tracking and Grasping AprilTag
  • 15.3D Spatial Tracking AprilTag
  • 16.Transformer Model Tracking Algorithm
  • 17.Line Following Obstacle Clearing
5.Road network planning and navigation
  • 1.Introduction To Road Network Planning
  • 2.Road Network Annotation
  • 3.Planning And Navigation Between Waypoints
  • 4.Road Network Navigation In Any Pose
  • 5.Path Re-planning
6.OpenClaw Basic Course
  • 1.Introduction to OpenClaw
  • 2.OpenClaw Core Concepts
  • 3.OpenClaw API-KEY Configuration
  • 4.OpenClaw Switch Models
  • 5.OpenClaw System Prompt Words
  • 6.OpenClaw Common CLI Commands
7.OpenClaw Interaction Method
  • 1.OpenClaw Webchat Interaction
  • 2.OpenClaw Tui Interaction
  • 3.OpenClaw Voice Dialogue Interaction
  • 4.OpenClaw WhatsApp Interaction
8.OpenClaw Development
  • 1.OpenClaw Connecting to Robot MCP Service
  • 2.Robot CLI Command Tool
  • 3.robot-control Plugin Tool
  • 4.reply-bridge Plugin Tool
  • 5.OpenClaw Multimodal Vision
  • 6.OpenClaw Chassis Control
  • 7.OpenClaw Robotic Arm Control
  • 8.OpenClaw Skills Development
  • 9.OpenClaw Scheduled Tasks
  • 10.OpenClaw Multi-Agent Intelligent Agent
  • 11.OpenClaw Active Interaction
  • 12.OpenClaw Vector Memory
9.OpenClaw Embodied intelligent application
  • 1.OpenClaw Target Tracking
  • 2.OpenClaw Arm Tracking And Grasping
  • 3.OpenClaw Arm Fixed-point Placement
  • 4.OpenClaw Waste Sorting
  • 5.OpenClaw SLAM Mapping And Navigation
  • 6.OpenClaw Navigation Transport
  • 7.OpenClaw AprilTag Grasping
  • 8.OpenClaw Color Line Patrol
  • 9.OpenClaw Visual Distance Measurement
10.OpenClaw scenario sandbox
  • 1.Map Description and Props Placement
  • 2.Building the Sandbox Map
  • 3.Visual Relocalization Marker
  • 4.Map Mapping Marker
  • 5.Sandbox Scenario Comprehensive Case
11.AI Large Model Basics
  • 1.AI Large Model Types and Principles
  • 2.RAG Retrieval Enhancement and Model Training Samples
  • 3.Embodied Intelligent Robot System Architecture
  • 4.Embodied Intelligent Functions Core Source Code
12.AI large Model Development
  • 1.Register a Model Service Provider Account
  • 2.Configuring API-KEY
  • 3.Introduction to Dify
  • 4.Basic Dify Features
  • 5.AI Large Model Development - Chatbot
  • 6.Deploy the RAG Knowledge Base
  • 7.RAG Knowledge Base + Chatbot
  • 8.AI Agent Workflow
  • 9.Custom Wake-up Response
13.AI Model - Voice Version
  • 1.Semantic Understanding and Command Following
  • 2.Multimodal Visual Understanding
  • 3.Multimodal Visual Understanding and Robotic Arm Gripping
  • 4.Multimodal Visual Understanding and SLAM Navigation
  • 5.Robotic arm gripping+Multimodal visual understand+SLAM navigation
  • 6.Intention Understanding
14.AI Model - Text Version
  • 1.Semantic Understanding and Command Following
  • 2.Multimodal Visual Understanding
  • 3.Multimodal Visual Understanding and Robotic Arm Gripping
  • 4.Multimodal Visual Understanding and SLAM Navigation
  • 5.Robotic arm gripping+Multimodal visual understand+SLAM navigation
  • 6.Intention estimation
15.Mediapipe Visual Course
  • 1.Hand detection
  • 2.Posture detection
  • 3.Overall detection
  • 4.Facial Landmark Detection
  • 5.Face detection
  • 6.Face special effects
  • 7.3D object recognition
  • 8.Brush
  • 9.Finger control
  • 10.Palm target positioning
  • 11.Fingertip trajectory recognition
  • 12.Fingertip gesture control robotic arm
  • 13.Gesture grabbing and releasing objects
  • 14.Finger control robotic arm
  • 15.Medipipe gesture control robotic arm action group
16.MoveIt2 Simulation Course
  • 1.MovelT2 configuration
  • 2.MovelT2 simulation-reality linkage
  • 3.Random movement
  • 4.Forward kinematics design
  • 5.Inverse kinematics design
  • 6.Cartesian path
  • 7.Trajectory Planning
  • 8.Collision Detection
  • 9.Scene Design
  • 10.3D perception obstacle‑avoidance
17.Multi-vehicle Course
  • 1.Multi-vehicle Control
  • 2.Multi-vehicle Navigation
  • 3.Multi-vehicle Formation
18.YOLO26 Development
  • 1.CLI Use
  • 2.Object Detection
  • 3.Instance Segmentation
  • 4.Pose Estimation
  • 5.Image Classification
  • 6.Oriented Object Detection
  • 7.YOLOv26 + DeepSORT Tracking
  • 8.Monocular Depth Estimation
19.Control Board STM32 Driver Course
  • 0.Notes (Must Read)
  • 1.About Expansion Board
  • 2.STM32 Development Environment
  • 3.Button Control
  • 4.FreeRTOS Application
  • 5.Serial Communication
  • 6.SBUS Model Aircraft Remote Control
  • 7.CAN Bus Communication
  • 8.RGB Colorful Light Bar
  • 9.Timer Interrupt to Control PWM Servo
  • 10.Control Serial Port Servos
  • 11.Nine-axis Attitude Sensor to Obtain Data
  • 12.Control Motor
  • 13.Timer Captures the Encoder Data
  • 14.1 Kinematic Analysis of Mecanum Wheel
  • 14.2 Kinematic Analysis of Ackerman
  • 14.3 Kinematic Analysis of 4WD
  • 15.PID Control Robot Movement
20.Docker Course
  • 1.Docker Introduction and Installation
  • 2.Docker Basic Commands
  • 3.Docker Submission and Multi-Terminal Access
  • 4. Docker Startup Script
  • 5.Docker-Vscode Environment Construction
21.Image Processing Basics Course
  • 1. Introduction to Open Source CV
  • 2. Image reading and display
  • 3. Image writing
  • 4. Image quality
  • 5. Pixel Operation
  • 6. Image zoom
  • 7. Image cutting
  • 8. Image translation
  • 9. Image Mirroring
  • 10. Affine Transformation
  • 11. Image Rotation
  • 12. Perspective Transformation
  • 13. Grayscale processing
  • 14. Image Binarization
  • 15. Edge Detection
  • 16. Line drawing
  • 17. Rectangle and circle drawing
  • 18. Drawing text and pictures
22.Linux System Course
  • 1.Introduction to Linux system
  • 2.Ubuntu file system
  • 3.Ubuntu common commands
  • 4.Ubuntu common editors
  • 5.Ubuntu software operation commands
  • 6.Virtual machine installation
  • 7.SSH remote control
  • 8.VNC remote control
  • 9.Transfer files remotely
  • 10.Driver library and communication
  • 11.Static IP and hotspot mode
  • 12.Bind device ID
  • 13.Capacity expansion and resource allocation
  • 14.Update system software sources
  • 15.Set root user password
  • 16.sudo free password
  • 17.Connect to WiFi network
  • 18.View system version
  • 19.Customized service management
  • 20.Back up system image
23.ROS2 Basic Course
  • 1.Introduction to ROS2
  • 2.ROS2 install Humble
  • 3.ROS2 development environment
  • 4.ROS2 workspace
  • 5.ROS2 function package
  • 6.ROS2 node
  • 7.ROS2 topic communication
  • 8.ROS2 service communication
  • 9.ROS2 action communication
  • 10.ROS2 custom interface message
  • 11.ROS2 parameter service case
  • 12.ROS2 meta-function package
  • 13.ROS2 distributed communication
  • 14.ROS2 DDS
  • 15.ROS2 time related API
  • 16.ROS2 common command tools
  • 17.ROS2 rviz2 use
  • 18.ROS2 rqt toolbox
  • 19.ROS2 Launch startup file configuration
  • 20.ROS2 recording and playback tool
  • 21.ROS2 URDF model
  • 22.ROS2 Gazebo simulation platform
  • 23.ROS2 TF2 coordinate transformation
24.Main Control Course
Jetson Orin Nano_NX
  • 1.Jetson Orin board introduction
  • 2.Restore the factory image system
  • 3.Backup SSD system
  • 4.SSD expansion
  • 5.Network configuration
  • 6.SSH remote login
  • 7.VNC remote control
  • 8.Remote file transfer
  • 9.Jtop tool
  • 10.Exchange space expansion
Raspberry Pi
  • 1. Introduction to Raspberry PI 5
  • 2. Raspberry PI system installation and backup
  • 3. Powering the Raspberry PI 5
  • 4. Startup of Raspberry PI 5
  • 5. Update and upgrade operating system
  • 6. Introduction to raspi-config tool
  • 7. config.txt file description
  • 8. Network Configuration
  • 9. remote access
  • 10. Transfer files remotely
  • 11. Set display resolution and rotation
  • 12. Set screen to sleep
  • 13. Play audio and video
  • 14. Using USB camera
  • 15. Using MIPI camera
  • 16. Get real-time temperature of Raspberry Pi
RDKX5
  • 1.Introduction to RDK X5 board
  • 2.Write system file
  • 3.Hardware interface description
  • 4.Install case and other accessories
  • 5.Network configuration
  • 6.Remote login
  • 7.Update system
  • 8.srpi-config user guide
  • 9.config. txt configuration file
  • 10.Self-startup setting
  • 11.RDK exclusive command usage
  • 12.Linux command usage
  • 13.GPIO readwrite operation
  • 14.Image classification algorithm
  • 15.Use USB camera
  • 16.Use MIPI camera
  • 17.Binocular camera depth algorithm
  • 18. Controlling RGB Cooling Fans
Download
  • System File
  • Code
  • 3D Model File
  • Software Tools
  • Hardware_Info
  • Deb function package
  • Dify AI Agent
Download ZIP

Welcome to ROSMASTER M1 PRO repository

2.OpenClaw Arm Tracking And Grasping

OpenClaw Arm Tracking And Grasping

OpenClaw Arm Tracking And Grasping1. Course Content2. Preparation3. Arm Tracking And Grasping Target Case (Depth Camera)4. Grasping Color Blocks (Monocular Camera)5. Source Code Analysis5.1 pick() — Grasping an item with the depth camera5.2 _get_grasp_point() — Obtain the grasp point coordinates (depth camera)5.3 Grasping Color Blocks (USB Monocular Camera)6. Parameter Debugging7. Function Q&AHow to adjust when the grasp position is inaccurate and deviates from the ideal grasp point?How to adjust the grasp_offset offset

1. Course Content

  • Learn to control the robotic arm to grasp the target object through OpenClaw. The depth camera can track and grasp the target through point cloud information. The monocular camera grasping function grasps the specified color block (red, yellow, blue, green) on the plane.

2. Preparation

  • Start the MCP service. If you need voice replies, you must add the use_tts parameter: use_tts:=true, otherwise it can be omitted.

ros2 launch yahboomcar_bringup mcp_service.launch.py use_camera:=true

image-20260910094302276

 

3. Arm Tracking And Grasping Target Case (Depth Camera)

Tip

  • You can write the command yourself according to your needs. The following is a case demonstration. Just choose any one of the interaction methods. The demonstration here uses the web-based WebChat as an example.

Important

  • The block grasped in the depth camera demonstration here is a 4x4x4cm wooden block. Tracking and grasping can grasp any target object. Since the servo has no torque feedback, the gripper's gripping closed angle needs to be specified through parameters. If the gripper grasps too loosely or too tightly, it can be fine-tuned through parameters.

  • The monocular USB camera demonstration uses 3 x 3 x 3 cm color wooden blocks for grasping.

image-20260909093526854

 

 

 

  • Grasp the orange block in front of you

image-20260429175210006

 

  • The figure below shows the tracking process of grasping the target. The robot will first adjust the chassis position to ensure that the target is within the grasping range of the robotic arm.

image-20260429175705463

  • After the chassis adjustment is complete, the grasp point will be obtained as shown below. The program will automatically draw an image of the grasp point, which can be used to determine whether there is depth data near the grasp point. Image path: ~/yahboomcar_ros2_ws/yahboomcar_ws/cache/grasp_point_image.png

Tip

  • Under normal circumstances, actual and estimate should basically overlap, proving that the grasp point has accurate camera depth data. If the two points do not overlap, it proves that there is no camera depth data near the grasp point, and the grasp may have an obvious deviation.

image-20260429190123543

 

  • Target grasping skills

    • OpenClaw controls the robot to grasp the target object. It will first read the robotic arm grasping skill and carry out the operation by referring to the SOP process.

    • For the robotic arm grasping skill, refer to: [OpenClaw Skills Development]

 

4. Grasping Color Blocks (Monocular Camera)

image-20260924171352720

 

  • The MCP server will then start the color detection node through a subprocess to detect the target color block.

image-20260924160220834

  • If no color block is detected due to the influence of ambient light, you can press the "C" key to perform color calibration. For the color calibration method, refer to the color calibration steps in the preceding course 【Robotic Arm and 3D Space Gripping Course — Color Block Color Sorting】.

  • If the camera is overexposed or too dark due to the influence of ambient light, you can refer to the method in the preceding course 【USB Camera & Depth Camera Vision Course — USB Camera Introduction】 to turn off auto exposure and manually adjust the camera exposure value. Save the parameters and restart the program for them to take effect.

 

5. Source Code Analysis

  • Source code path

xxxxxxxxxx
~/yahboomcar_ros2_ws/yahboomcar_ws/src/multi_brains_pre/multi_brains_pre/action_controller.py

The core function functions of the grasping program are all defined in the ActionController class, and can be called by OpenClaw after being registered through the MCP Tool interface. The following is an explanation of the source code of each key function.

5.1 pick() — Grasping an item with the depth camera

Process Description:

  1. Start tracking: Based on the target bounding box detected by vision (x1,y1,x2,y2), call the /start_track service to start Smart Tracker target tracking.

  2. _adjust_grasp_pose(): Internally loops through the process of "align the camera → measure the object's 3D pose → move the chassis" until the target is within the grasping range.

  3. _get_grasp_point(): Call /get_box_center to obtain the pixel coordinates of the grasp point, and convert them to spatial coordinates in combination with the 3D pose service. For detailed source code and explanation, see below:

  4. _grasp() (internal method): Solve the 6 joint angles through inverse kinematics (IK), publish them to the arm6_joints topic to drive the robotic arm, and then close the gripper.

  5. Automatic retreat: After grasping is complete, retreat by the auto_back_dist distance to avoid collisions and entering the costmap obstacle area.

​x
    def pick(self,x1:int,y1:int,x2:int,y2:int) -> list[bool,str]:
        ''' Pick up item    x1:int, y1:int, x2:int, y2:int '''
        self.get_logger().info("Start tracking object")
        if not self.start_track_client.wait_for_service(timeout_sec=5.0):
            self.get_logger().error("StartTrack service not available")
            return [False,"Tracking service not available"]
        
        result:StartTrack.Response=self.start_track_client.call(StartTrack.Request(x1=x1, y1=y1, x2=x2, y2=y2))
        if not result.success:
            self.get_logger().error("Failed to initialize tracking target")
            return [False,"Tracking failed"]
        time.sleep(1.0)
        
        self.get_logger().info("Start aligning to target")
        ok, message = self._adjust_grasp_pose(align_x=self.track_align_distance[0], align_y=self.track_align_distance[1])
        if not ok:
            self.cancel_track_client.call(CancelTrack.Request())
            self.get_logger().error(f"Failed to align to target: {message}")
            return [False, f"pick failed: {message}"]
        time.sleep(2.0)

        result=self._get_grasp_point()
        if not result[0]:
            self.cancel_track_client.call(CancelTrack.Request())
            self.get_logger().error("Failed to get grasp target position")
            return [False, "Failed to get grasp target position"]
        
        
        self.get_logger().info("Start grasping object")
        self.cancel_track_client.call(CancelTrack.Request())   
        success=self._grasp(grasp_x=result[1], 
                    grasp_y=result[2],
                    grasp_z=result[3],
                    grasp_pitch=self.grasp_offset[3],
                    offset=self.grasp_offset)
        if not success:
            self.get_logger().error("Failed to grasp object")
            return [False, "Failed to grasp object"]
        
        if self.enable_auto_back:
            self.Move(direction='backward', value=self.auto_back_dist)
        return [True,""]

 


5.2 _get_grasp_point() — Obtain the grasp point coordinates (depth camera)

xxxxxxxxxx
    def _get_grasp_point(self)->list:
        if not self.box_center_client.wait_for_service(timeout_sec=8.0):
            msg = "get grasp point service not available"
            self.get_logger().error(Fore.YELLOW + msg + Fore.RESET)
            return [False, msg]
        self.SeeWhat()
        response: GetBoxCenter.Response = self.box_center_client.call(GetBoxCenter.Request())

        if not response.success:
            msg = response.message
            self.get_logger().error(Fore.RED + msg + Fore.RESET)
            return [False, response.message]
        
        image = cv2.imread(self.image_path)
        if image is None:
            self.get_logger().warn(Fore.YELLOW + f"Failed to read image: {self.image_path}" + Fore.RESET)
        else:
            ax = int(response.actual_center[0])
            ay = int(response.actual_center[1])
            ex = int(response.estimate_center[0])
            ey = int(response.estimate_center[1])

            has_actual   = (ax != 0 or ay != 0)
            has_estimate = (ex != 0 or ey != 0)

            # draw actual_center: red crosshair + circle
            if has_actual:
                cross = 14
                cv2.line(image, (ax - cross, ay), (ax + cross, ay), (0, 0, 255), 2)
                cv2.line(image, (ax, ay - cross), (ax, ay + cross), (0, 0, 255), 2)
                cv2.circle(image, (ax, ay), 8, (0, 0, 255), 2)
                cv2.putText(image, f"actual({ax},{ay})", (ax + 12, ay - 6),
                            cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 1)

            # draw estimate_center: blue diamond
            if has_estimate:
                cv2.drawMarker(image, (ex, ey), (255, 100, 0), cv2.MARKER_DIAMOND, 18, 2)
                cv2.putText(image, f"estimate({ex},{ey})", (ex + 12, ey + 6),
                            cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 100, 0), 1)

            # connect two points
            if has_actual and has_estimate:
                cv2.line(image, (ax, ay), (ex, ey), (180, 180, 180), 1, cv2.LINE_AA)

            cv2.imwrite(self.grasp_point_path, image)
            self.get_logger().info(
                f"Grasp point image saved: actual=({ax},{ay}) estimate=({ex},{ey})")

Code Explanation:

  • Here, based on engineering experience, a grasp center estimation algorithm is proposed. When most of the depth of the target object is missing due to the influence of ambient light, it can still estimate the 3D coordinates of the grasp target center. Due to space limitations, the theory is not derived here; only the program source code is explained.

  1. Dual-center mechanism: The returned result contains actual_center (the actual detected center) and estimate_center (the algorithm-estimated center). The pixel offset between the two is used to compensate for the error in the 3D spatial coordinates.

  2. Verification image: Automatically draw a red crosshair (actual) and a blue diamond (estimate) to grasp_point_image.png, making it easy to debug whether the grasp point is accurate.

  3. Priority strategy: estimate_pose takes priority over actual_pose, because it combines visual detection and the grasp center estimation algorithm for higher precision.

 

5.3 Grasping Color Blocks (USB Monocular Camera)

Code Explanation:

  • GraspColor: The main function for grasping color blocks with the USB monocular camera. It receives a color name parameter and completes the grasp in a four-step process.

  • _check_camera_action("GraspColor", "usb"): A pre-check to ensure that the USB monocular camera is currently in use. If the camera type does not match, it returns an error directly.

  • _pubSix_Arm(self.color_detect_pose): Move the robotic arm to the preset color detection pose to ensure that the camera can clearly capture the color blocks on the desktop.

  • _start_color_detect(color): Start an independent color_detect ROS2 node process, running as a subprocess, to continuously detect the specified color block.

  • -p target_color:={color}: Specify the target detection color through a command-line parameter, supporting four colors: red/green/blue/yellow.

xxxxxxxxxx
    def GraspColor(self, color):
        '''Grasp the color block with the given color, only available for usb camera'''
        if (guard := self._check_camera_action("GraspColor", "usb")) is not None:
            return guard
        color = str(color).strip().strip("'\"")
        if color not in ['red', 'green', 'blue', 'yellow']:
            error_msg = f"GraspColor: invalid color '{color}', must be red/green/blue/yellow"
            self.get_logger().error(error_msg)
            return [False, error_msg]

        self._pubSix_Arm(self.color_detect_pose)
        time.sleep(2.0)
        try:
            #step 1: launch the standalone color_detect process targeting the requested color
            self.get_logger().info(f"GraspColor: start detecting {color} blocks")
            self._start_color_detect(color=color)
            if self._wait_for_color_target(color, timeout_sec=15.0) is None:
                return [False, f"No {color} block detected in current scene"]
            time.sleep(1.0)

            #step 2: align to target
            self.get_logger().info(f"GraspColor: start aligning to {color} target")
            ok, message = self._adjust_grasp_pose(
                align_x=self.color_grasp_distance[0],
                align_y=self.color_grasp_distance[1])
            if not ok:
                self.get_logger().error(f"GraspColor failed to align to target: {message}")
                return [False, f"GraspColor failed to align: {message}"]
            time.sleep(3.0)

            #step 3: get grasp point coordinates
            grasp_point = self._get_color_grasp_point(color)
            if not grasp_point[0]:
                self.get_logger().error(f"GraspColor failed to get grasp point: {grasp_point[1]}")
                return [False, f"GraspColor failed to get grasp point: {grasp_point[1]}"]

            #step 4: grasp object
            self.get_logger().info(f"GraspColor: grasp point x={grasp_point[1]:.3f}, "
                f"y={grasp_point[2]:.3f}, z={grasp_point[3]:.3f}, angle={grasp_point[4]:.1f}deg")
            if not self._grasp(grasp_x=grasp_point[1],
                               grasp_y=grasp_point[2],
                               grasp_z=grasp_point[3],
                               grasp_pitch=self.color_grasp_offset[3],
                               grasp_roll=grasp_point[4],
                               offset=self.color_grasp_offset):
                self.get_logger().error("GraspColor: failed to grasp object")
                return [False, "GraspColor failed to grasp object"]

            return [True, f"{color} block grasped successfully"]
        finally:
            self._stop_color_detect()
            
    def _start_color_detect(self, color):
        """Launch the standalone color_detect process targeting the requested color."""
        self._stop_color_detect()
        with self._color_target_lock:
            self._color_target_cache.clear()
        cmd = ['ros2', 'run', 'common_demo', 'color_detect', '--ros-args']
        try:
            common_param_file = file_manager.GetFileAndCheckExist("config_file")
            cmd += ['--params-file', common_param_file]
        except Exception as e:
            self.get_logger().warn(f"Failed to load common param file: {e}")
        color_clean = str(color).strip().strip("'\"")
        cmd += ['-p', f'target_color:={color_clean}']
        self.get_logger().info(f"Starting color_detect process: {' '.join(cmd)}")
        self._color_process = subprocess.Popen(cmd)

 

6. Parameter Debugging

  • Parameter file path:

xxxxxxxxxx
~/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_bringup/param/common.yaml

The following is the mapping table between parameters and code:

xxxxxxxxxx
mcp_service:
  ros__parameters:
    #depth camera tracking and grasping
    track_align_distance: [0.10, 0.0]
    track_align_tolerance: [0.01, 0.013]
    place_distance: [0.14, 0.0,0.35, 0.02]
    grasp_offset: [0.035,-0.015,0.03,80.0]
    
    #monocular camera grasping color blocks
    color_detect_pose: [90, 90, 0, 0, 90, 30]    
    color_grasp_offset: [0.015,0.0,0.015,85.0]  
    color_grasp_distance: [0.08, 0.0]
    #automatic retreat
    enable_auto_back: True

Important

  • The automatic retreat after grasping function of enable_auto_back is to avoid colliding with the edge of the map when used in combination with navigation. If you need to turn off automatic retreat, you can set enable_auto_back in the parameter file to False. The automatic retreat function for garbage grasping, AprilTag grasping, and placement in subsequent courses is all controlled by this parameter, and it will not be repeated in subsequent courses.

7. Function Q&A

How to adjust when the grasp position is inaccurate and deviates from the ideal grasp point?

Check in sequence:

  • Check whether the target object is accurately boxed in the verify_image.png saved by GetBbox

  • Is the grasp point accurate?

    • If the grasp point deviates too far from the center of the object, it means that the depth camera is too strongly affected by ambient lighting and there is completely no depth on the target object. The grasp center estimation algorithm also cannot estimate the 3D position of the target grasp point. You need to change the ambient lighting or adjust the alignment distance before grasping to keep the target at least 21 cm away from the depth camera, avoiding the depth camera's blind spot.

  • If the grasp point is accurate, for example the grasp point in the figure below is at the center of the object being grasped, but there is a slight offset in the grasp, it indicates that this is caused by the error of robotic arm rigidity degradation and servo backlash. Adjust grasp_offset; the offset follows the robot's right-hand coordinate system. Appropriately increase or decrease the grasp offset.

image-20260429192005662

How to adjust the grasp_offset offset

  • Refer to the preceding tutorial 【Robotic Arm and 3D Space Gripping Course — Robotic Arm Basic Usage】

OpenClaw Target Tracking
OpenClaw Arm Fixed-point Placement

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文