yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
ROSMASTER M3 PRO📖
0.Configuration and Operation Guide
  • 1. Quick start handle to control the car
  • 2. Log in to the car and view the code
  • 3. Robotic Arm Calibration
  • 4. Enter the Docker (Jetson-Nano and Raspberry Pi 5 users, see here)
  • 5. Assembly video
  • 6. Modify the firmware parameters of the car control board
  • 7. Frequently Asked Questions and Precautions
  • 8. Precautions for DIY Robotic Arm
1.Chassis Control Course
  • 1.ROS control
  • 2.Handle control
  • 3.Keyboard control
  • 4.Angular velocity calibration
  • 5.Line velocity calibration
  • 6.Line patrol automatic driving
  • 7.Patrol
2.Lidar Course
  • 1.Lidar introduction and use
  • 2.Dual Lidar fusion
  • 3.Lidar obstacle avoidance
  • 4.Lidar tracking
  • 5.Lidar guard
  • 6.Gmapping-SLAM mapping
  • 7.Cartographer-SLAM mapping
  • 8.slam_toolbox mapping
  • 9.Navigation2 single-point navigation avoid
  • 10.Navigation2 multi-point navigation avoid
  • 11.Repositioning navigation
  • 12.RTAB-Map mapping
  • 13.RTAB-Map navigation
  • 14.APP mapping navigation
  • 15.Machine code handling
  • 16.Color block transport
  • 17.Navigation via Pose-Constrained Visual Relocalizationnew
3.Depth Camera Course
  • 1.Dabai_DCW2 camera introduction
  • 2.Depth pseudo-color image
  • 3.Depth camera distance measurement
  • 4.Wood block volume measurement
  • 5.Mediapipe gesture recognition
  • 6.Edge detection
  • 7.YOLOv8 object detection
  • 8.Deep learning object tracking
  • 9. Transformer Model Tracking Algorithmnew
4.Robotic Arm and 3D Space Gripping Course
  • 1.Robotic arm solution
  • 2.Robotic arm chassis linkage control
  • 3.Machine code ID sorting
  • 4.Sorting height abnormality machine code
  • 5.Tracking and gripping machine code
  • 6.Color block color sorting
  • 7.Sorting height abnormality color block
  • 8.Tracking and gripping color block
  • 9.Wood block shape sorting
  • 10.KCF tracking and gripping objects
  • 11.Medipipe gesture ID sorting machine code
  • 12.Mediapipe gesture height sorting machine code
  • 13.Desktop tracking and gripping machine code
  • 14.3D tracking machine code
  • 15.Line patrol and obstacle removal
5.Road network planning and navigationnew
  • 1. Introduction To Road Network Planning
  • 2. Build A Pose Map
  • 3. Road Network Annotation
  • 4. Planning And Navigation Between Waypoints
  • 5. Road Network Navigation In Any Pose
  • 6. Path Re-planning
6.OpenClaw Basic Coursenew
  • 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 Methodnew
  • 1. OpenClaw Webchat Interaction
  • 2. OpenClaw Tui Interaction
  • 3. OpenClaw Voice Dialogue Interaction
  • 4. OpenClaw WhatsApp Interaction
8.OpenClaw Developmentnew
  • 1. OpenClaw connects to the MCP interface of the robot
  • 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 timed tasks
  • 10. OpenClaw multi-agent intelligent agent
  • 11. OpenClaw active interaction
  • 12. OpenClaw vector memory
9.OpenClaw Embodied intelligent applicationnew
  • 1. OpenClaw target tracking
  • 2. OpenClaw robotic arm tracking and grasping
  • 3. OpenClaw robotic arm fixed-point placement
  • 4. OpenClaw garbage sorting
  • 5. OpenClaw slam mapping and navigation
  • 6. OpenClaw navigation transfer
  • 7. OpenClaw machine code clip
  • 8. OpenClaw color line patrol
  • 9. OpenClaw visual distance measurement
10.OpenClaw scenario sandboxnew
  • 1. Map description and prop placement
  • 2. Build sand table map
  • 3. Visual relocation markers
  • 4. Map mapping markers
  • 5. OpenClaw scenario sandbox comprehensive case
11.AI 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 Model Development
  • 01.Register a model service provider account
  • 02. Configuring API-KEY
  • 03. Introduction to Dify
  • 04. Basic Dify Features
  • 05. AI Large Model Development - chatbot
  • 06. Deploy the RAG knowledge base
  • 07. RAG knowledge base + chatbot
  • 08. AI agent workflow
  • 09. Custom wake-up response
  • 10. Core module testing tools
13.AI Large Model (Text Version)
  • 1.Semantic understand instruction following
  • 2.Multimodal visual understand
  • 3.Multimodal visual understand+robotic arm grab
  • 4.Multimodal visual understand+SLAM navigation
  • 5.Robotic arm grab+Multimodal visual understand+SLAM navigation
  • 6.Intention estimation
14.AI Large Model(Voice Version)
  • 1.Semantic understand instruction following
  • 2.Multimodal visual understand
  • 3.Multimodal visual understand+robotic arm grab
  • 4.Multimodal visual understand+SLAM navigation
  • 5.Robotic arm grab+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
17.Multi-vehicle Course
  • 1.Multi-vehicle chassis control
  • 2.Multi-vehicle robotic arm control
  • 3.Multi-vehicle navigation
  • 4.Multi-vehicle formation
18.Control Board Course
  • 1.Development environment setup
  • 2.Control board STM32 basic routine
  • 3.Control board micro_ros basic routine
19.Docker Course
  • 1、Docker overview and docker installation
  • 2、Common commands for docker image containers
  • 3、Docker images deeply understand and publish images
  • 4、Docker hardware interaction and data processing
  • 5、Enter the bot's docker container
  • 6、Robot development environment construction in Docker
20.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
21.Main Control Course
Jetson Nano B01
  • 1. Introduction to the Jetson Nano B01 SUB Board
  • 2. Burn the system image
  • 3. Re-read the memory card or USB drive that has been burned
  • 4. Startup system
  • 5. Jetson Nano B01 System and Desktop Introduction
  • 6. Memory card or USB flash drive expansion
  • 7. Network Configuration
  • 8. SSH remote login & file transfer
  • 9. VNC Remote Login
  • 10. Jetson Nano B01 system backup
  • 11. Jetson Nano Swap space increased
  • 12. Installation and use of Jtop
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
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
Download
  • Mapping_APP(iOS_Android)
  • Robot_Image_System_File
  • Code-Firmware
  • Instruction_Manual
  • VM_File
  • Software_Tools
  • Firmware_DriverFile
  • 3D_Model_File
  • ROS2_Basic_VM
  • Other_Annex
Download ZIP

Welcome to ROSMASTER M3 PRO repository

4. OpenClaw garbage sorting

OpenClaw Garbage Sorting

OpenClaw Garbage Sorting1. Course ContentLearning Objectives2. Preparation3. Robotic Arm Garbage Sorting Case4. yolov26-OBB Garbage Recognition Node5. Source Code Analysis5.1 GetWasteRecognitionResults — Get Waste Recognition Results5.2 GraspWaste — Grasp Target Waste5.3 PlaceWaste — Place Waste5.6 waste_classify Detection Node — YOLO Inference Thread6. Parameter Tuning6.1 Garbage Sorting Grasp Parameters6.2 YOLO Model Detection Parameters

1. Course Content

Learning Objectives

  • Understand the application and configuration of the yolov26-OBB model in garbage detection
  • Learn to use GetWasteRecognitionResults, GraspWaste, PlaceWaste tools to complete garbage sorting tasks
  • Master the adjustment of key parameters such as waste_grasp_offset and waste_grasp_distance to optimize grasping accuracy

2. Preparation

  • Start the MicroROS chassis agent (no need to restart if already started)
sh start_agent.sh

image-20260506120329772

  • Start odometry, tf, robotic arm assistance, camera nodes, etc.
xxxxxxxxxx
ros2 launch m3pro_bringup car_base.launch.py
  • Start the MCP service
xxxxxxxxxx
ros2 launch m3pro_bringup mcp_service.launch.py

image-20260506120339230

 

  • If you need voice reply, you need to start openclaw_bridge additionally, otherwise it can be omitted
xxxxxxxxxx
ros2 run multi_brains_pre openclaw_bridge

3. Robotic Arm Garbage Sorting Case

[!TIP]

  • You can write commands according to your own needs. The following is a case demonstration. Choose any interaction method. Here we take the web-based WebChat as an example.
ToolParametersFunction
GetWasteRecognitionResultsNoneGet YOLO model garbage recognition results
GraspWaste--waste-nameGrasp waste object
PlaceWasteNonePlace waste object
  • Grasp the recyclable waste in front of you (you can also directly specify a specific waste)

image-20260506141013556

 

  • Garbage recognition here is performed using the yolov26-OBB model. The first startup has a cold start delay, requiring the yolo model to be loaded first.

    • After loading, the model automatically unloads after 240 seconds to save memory and CPU resources (configurable duration)

image-20260506120955551

  • After the model is loaded, the garbage detection window automatically starts, displaying the recognition results

image-20260506140734586

 

  • OpenClaw first obtains the yolo garbage recognition results through GetWasteRecognitionResults. When obtaining the results, the recognition frame image is automatically saved to the path:
xxxxxxxxxx
$HOME/M3Pro_ws/multi_brains_file/yolo_detect.png

image-20260506144333432

  • We can also directly view the garbage detection results through the robot-control CLI (suitable for debugging)
xxxxxxxxxx
robot_control call-tool GetWasteRecognitionResults

image-20260506144528087

 

  • Then OpenClaw calls the GraspWaste tool to grasp the target waste block
xxxxxxxxxx
                                                        ┌─────────────┐
                                                        │ Get Waste   │
                                                        │ Recognition │
                                                        │ Results     │
                                                        └──────┬──────┘
                                                               │
                                                               ▼
                                                        ┌─────────────┐
                                                        │ Get Target  │
                                                        │ Coordinates │
                                                        └──────┬──────┘
                                                               │
                                                               ▼
                                                        ┌─────────────┐
                                                        │ Grasp Target│
                                                        │ Waste       │
                                                        └──────-──────┘

 

  • Target grasping skills

    • OpenClaw controls the robot to grasp the target object by first reading the robotic arm grasping and garbage sorting skills, following the SOP workflow
    • Skill reference: [08-openclaw skills development]

 

  • Waste placement: to adapt to different trash bins, the placement tool uses action groups to complete the placement action (can be customized through configuration parameters)

image-20260506142615638

 

4. yolov26-OBB Garbage Recognition Node

  • Garbage detection is an independent program node. When starting the MCP service, the garbage detection node starts automatically. To reduce CPU and memory usage, detection is disabled by default at startup
xxxxxxxxxx
    waste_classify=Node(
        package="waste_classify",
        executable="waste_detect",
        name="waste_detect",
        parameters=[commom_param_file,
                    {'image_save_path': os.path.join(os.path.expanduser('~'),'M3Pro_ws','multi_brains_file','yolo_detect.png')},
                    {'model_path': yolov26_model_path},
                    {'show_image': True},
                    {'detect_enable': False},
                    {'device': device}
                    ],
        emulate_tty=True,
        additional_env={'PYTHONPATH': venv_pythonpath + os.pathsep + original_pythonpath 
        },
        output='screen')

 

  • After the MCP service node starts, we can manually control the start/stop of the detection function through ROS services (suitable for debugging). The waste_classify node provides the following three services
  • Query current status (operation=0)
xxxxxxxxxx
ros2 service call /waste_enable_srv waste_classify_msg/srv/WasteEnable "{operation: 0}" 

image-20260506145500838

  • Enable garbage detection (operation=1)
xxxxxxxxxx
ros2 service call /waste_enable_srv waste_classify_msg/srv/WasteEnable "{operation: 1}" 

image-20260506145556153

 

  • The waste_classify node publishes detection results to the /waste_detecttions topic during detection. You can view topic data with the following command
xxxxxxxxxx
ros2 topic echo /waste_detecttions --once
  • Reference topic data
xxxxxxxxxx
header:
  stamp:
    sec: 1778052123
    nanosec: 473421724
  frame_id: ''
waste_detections:
- class_name: peach-pit
  classification: OtherWaste
  confidence: 0.8850700259208679
  center_x: 390.0876770019531
  center_y: 314.08135986328125
  width: 32.05992126464844
  height: 25.9763240814209
  angle: -0.02274312824010849
  points:
  - x: 406.40887451171875
    y: 326.7016296386719
  - x: 405.818115234375
    y: 300.7320251464844
  - x: 373.7664794921875
    y: 301.4610900878906
  - x: 374.35723876953125
    y: 327.4306945800781

Topic Data Field Descriptions:

FieldTypeDescription
header.stamptimeTimestamp of detection result (sec: seconds, nanosec: nanoseconds)
waste_detectionsWasteItem[]List of detected waste objects (may contain multiple targets)
class_namestringSpecific category name of the waste (e.g., peach-pit, banana-peel, etc.)
classificationstringWaste classification type (Recyclable, KitchenWaste, OtherWaste, HazardousWaste)
confidencefloatDetection confidence (0.0~1.0), higher values indicate the model is more certain
center_xfloatX coordinate of detection box center (pixel units, relative to image top-left)
center_yfloatY coordinate of detection box center (pixel units, relative to image top-left)
widthfloatWidth of detection box (pixel units)
heightfloatHeight of detection box (pixel units)
anglefloatRotation angle of detection box (radians), OBB model specific parameter indicating object orientation
pointsPoint2D[]4 vertex coordinates of the rotated box (clockwise or counter-clockwise), used for precise object boundary description

Key Concept Descriptions:

  1. OBB (Oriented Bounding Box): Unlike traditional rectangular boxes, OBB can rotate to better fit the actual shape of objects, especially suitable for irregular objects
  2. Angle: Indicates the rotation angle of the object relative to the horizontal direction. The robotic arm adjusts the gripper direction based on this angle during grasping to ensure optimal grasping
  3. Points (Vertex Coordinates): The 4 vertices precisely describe the boundary of the rotated box, which can be used to calculate the actual size and position of the object

 

  • Disable detection (operation=2)
xxxxxxxxxx
ros2 service call /waste_enable_srv waste_classify_msg/srv/WasteEnable "{operation: 2}"

image-20260506145632824

 

5. Source Code Analysis

  • Source path
xxxxxxxxxx
$HOME/M3Pro_ws/src/multi_brains_pre/multi_brains_pre/action_controller.py

5.1 GetWasteRecognitionResults — Get Waste Recognition Results

Function Description: Calls the YOLO model for garbage detection, obtaining recognition results for all waste in the current view, including category, confidence, position, and other information.

​x
def GetWasteRecognitionResults(self) -> list:
    '''Get YOLO waste recognition results'''
    from multi_brains_pre.message.mcp_message import waste_recognition_result
    if not self.waste_enable_client.wait_for_service(timeout_sec=8.0) or not self.get_waste_client.wait_for_service(timeout_sec=8.0):
        msg = "GetWaste service not available"
        self.get_logger().error(Fore.YELLOW + msg + Fore.RESET)
        return [False, msg]
​
    self._pubSix_Arm([90,90,50,-30,90,0])
    time.sleep(3.0)
    
    #TODO: waste detection causes high CPU usage; enable detection only when needed, and disable after getting results
    response:WasteEnable.Response = self.waste_enable_client.call(WasteEnable.Request(operation=0))
    if not response.detect_enable:
        response:WasteEnable.Response = self.waste_enable_client.call(WasteEnable.Request(operation=1)) #enable waste detection
        if not response.success:
            msg = "Failed to enable waste detection"
            self.get_logger().error(Fore.RED + msg + Fore.RESET)
            return [False, msg]
        time.sleep(10.0)#wait for first waste detect 
    
    response:GetWaste.Response=self.get_waste_client.call(GetWaste.Request())
    if not response.success:
        msg = response.message
        self.get_logger().error(Fore.RED + msg + Fore.RESET)
        return [False, msg]
​
    if len(response.waste_detections) == 0:
        msg = "No waste detected"
        self.get_logger().warn(Fore.YELLOW + msg + Fore.RESET)
        return [False, msg]
    
    result_lines = []
    for i, item in enumerate(response.waste_detections, 1):
        result_lines.append(
            f"{i}. {item.class_name} ({item.classification}), "
            f"confidence: {item.confidence:.2f}")
    
    result = waste_recognition_result(
        detections=result_lines,
        total_count=len(response.waste_detections),
        yolo_detect_image=response.image_path)
    return [True, result]

Process Description:

  1. Service Check: Wait for waste_enable_srv and get_waste_srv services to be available (8 second timeout)

  2. Adjust Detection Pose: Call _pubSix_Arm([90,90,50,-30,90,0]) to move the robotic arm to the predefined detection pose, wait 3 seconds for stabilization

  3. Start/Stop Detection:

    • Query current detection status (operation=0)
    • If not started, enable detection (operation=1), wait 10 seconds for first detection to complete
  4. Get Results: Call get_waste_srv service to obtain detection results

  5. Result Processing: Iterate through all detected waste, format output (category, classification, confidence)

  6. Return Results: Return structured results containing detection list, total count, and recognition image path

Notes:

⚠️ Garbage detection causes high CPU usage, so an "on-demand start/stop" strategy is adopted. YOLO detection automatically shuts down after a period of time after being enabled ⚠️ After enabling detection, wait sufficient time (10 seconds) to ensure the model completes its first inference ⚠️ The robotic arm must move to the detection pose first to obtain accurate recognition results


5.2 GraspWaste — Grasp Target Waste

xxxxxxxxxx
def GraspWaste(self, waste_name: str) -> list[bool, str]:
    '''Grasp waste object by name'''
    self._pubSix_Arm(self.waste_detect_pose)
    time.sleep(3.0)
    result = self._get_target_pose(waste_name, max_attempts=5)
    if not result[0]:
        return [False, result[1]]
​
    target_pose: Pose = result[1]
    target_item: WasteItem = result[2]
​
    # Adjust robot position if needed
    adjusted_flag = False
    if target_pose.position.x > self.waste_grasp_distance[0]:
        adjusted_flag = True
        delta_x = target_pose.position.x - self.waste_grasp_distance[0]
        self.move_by_odom(distance=abs(delta_x), direction='forward')
        self.get_logger().info("adjust x position finish")
        time.sleep(4.0) #wait for camera to stabilize after movement
​
    if abs(target_pose.position.y) > self.waste_grasp_distance[1]:
        adjusted_flag = True
        delta_y = target_pose.position.y
        direction = 'left' if delta_y > 0 else 'right'
        self.move_by_odom(distance=abs(delta_y), direction=direction)
        self.get_logger().info("adjust y position finish")
        time.sleep(4.0) #wait for camera to stabilize after movement
​
    #  Re-acquire target pose after adjustment
    if adjusted_flag:
        result = self._get_target_pose(waste_name, max_attempts=5)
        if not result[0]:
            return [False, result[1]]
​
        target_pose = result[1]
        target_item: WasteItem = result[2]
​
    item_rotation_angle=math.degrees(target_item.angle)
    self.get_logger().debug(f"target_item_angle: {item_rotation_angle}")
    if abs(item_rotation_angle) > 5:
        #TODO: 90 degrees is the neutral position of the end effector.
        arm_joint5_angle = 90+math.degrees(target_item.angle)
    else:
        arm_joint5_angle=90
​
    self._waste_grasp(grasp_x=target_pose.position.x,
                      grasp_y=target_pose.position.y,
                      grasp_z=target_pose.position.z,
                      joint_5_angle=arm_joint5_angle,
                      grasp_pitch=self.waste_grasp_offset[3])
​
    self.move_by_odom(direction='backward', distance=self.auto_back_dist)
    return [True, "Grasp waste successfully"]
​

Process Description:

  1. Move to Detection Pose: Call _pubSix_Arm(self.waste_detect_pose) to move the robotic arm to the predefined detection pose, wait 3 seconds

  2. Get Target 3D Pose: Call _get_target_pose() to get the target waste's 3D coordinates, retry up to 5 times

  3. Chassis Position Adjustment:

    • If the target X coordinate exceeds waste_grasp_distance[0], move the chassis forward/backward
    • If the target Y coordinate exceeds waste_grasp_distance[1], move the chassis left/right
    • Wait 4 seconds after each movement to ensure camera stability
  4. Re-acquire Pose: If the chassis moved, re-call _get_target_pose() to get updated 3D coordinates

  5. Calculate Gripper Rotation Angle:

    • Calculate joint5 (wrist yaw) adjustment angle based on the detection box angle
    • If absolute angle > 5°, then arm_joint5_angle = 90 + angle (90° is neutral position)
    • Otherwise, maintain neutral position (90°)
  6. Execute Grasp: Call _waste_grasp() to execute the actual grasping action, passing 3D coordinates and joint angles

  7. Auto Backward: After grasping, move backward by auto_back_dist distance

Key Technical Points:

  • Angle Compensation: Adjust gripper direction based on the OBB detection box rotation angle to ensure optimal grasping of irregular objects
  • Chassis Coordination: Automatically adjust chassis position when the target is out of working range, ensuring the robotic arm can reach it
  • Multiple Retries: Retry up to 5 times when acquiring pose to improve success rate

5.3 PlaceWaste — Place Waste

xxxxxxxxxx
def PlaceWaste(self):
    '''Place the grasped waste into the bin'''
    self.SingleJoint_pub.publish(ArmJoint(id=2, joint=135 , time=1200))
    self.SingleJoint_pub.publish(ArmJoint(id=4, joint=50 , time=1200))
    time.sleep(2.0)
    self._pubSix_Arm(self.waste_place_pose)
    time.sleep(3.0)
    self.SingleJoint_pub.publish(ArmJoint(id=6, joint=0 , time=1500))
    time.sleep(2.0)
    self._pubSix_Arm(self.init_arm_pose)
​
    self.move_by_odom(direction='backward', distance=self.auto_back_dist)
    return True

Process Description:

  1. Adjust Shoulder Joint: joint2 moves to 135°, raise the robotic arm, wait 1.2 seconds
  2. Adjust Elbow Joint: joint4 moves to 50°, prepare placing pose, wait 1.2 seconds
  3. Move to Placing Pose: Call _pubSix_Arm(self.waste_place_pose) to move to the full placing pose, wait 3 seconds
  4. Release Object: joint6 (gripper) opens to 0°, release the waste, wait 1.5 seconds
  5. Return to Initial Pose: Call _pubSix_Arm(self.init_arm_pose) to return the robotic arm to a safe position
  6. Auto Backward: After placing, move backward by auto_back_dist distance

Action Group Design:

  • The placing process uses step-by-step action groups to avoid objects falling or collision due to rapid robotic arm movement
  • Waiting time is set after each joint movement to ensure smooth completion

5.6 waste_classify Detection Node — YOLO Inference Thread

Source path:

xxxxxxxxxx
$HOME/M3Pro_ws/src/waste_classify/waste_classify/waste_classify.py
  • Waste recognition detection thread inference_worker
xxxxxxxxxx
def inference_worker(model_config:Model_Configure,
                     frame_shm_name,
                     control_queue,
                     result_queue,
                     frame_shape,
                     ready_event,
                     show_image=False):
    """Inference subprocess"""
    from ultralytics import YOLO
    from ultralytics.engine.results import Results
    try:
        yolo_model = YOLO(model_config.model_path,task="obb")
    except Exception as e:
        print(Fore.RED+f"YOLO Model initialization error :{e} "+Fore.RESET)
        return False
​
    frame_shm = shared_memory.SharedMemory(name=frame_shm_name)
    frame_array = np.ndarray(frame_shape, dtype=np.uint8, buffer=frame_shm.buf)
    print(Fore.GREEN+'Subprocess: model loaded, waiting for inference commands...'+Fore.RESET)
    ready_event.set()
​
    while True:
        try:
            cmd = control_queue.get(timeout=0.1)
            if cmd == 'exit':
                print(Fore.YELLOW+'Subprocess: exit command received'+Fore.RESET)
                break
            elif cmd == 'infer':
                frame = frame_array.copy()
                results:list[Results] = yolo_model(frame,
                                     conf=model_config.conf,
                                     rect=model_config.rect,
                                     vid_stride=model_config.vid_stride,
                                     max_det=model_config.max_det,
                                     half=model_config.half,
                                     augment=model_config.augment,
                                     verbose=model_config.verbose,
                                     classes=model_config.classes,
                                     device=model_config.device
                                     )
                waste_items = []
                annotated_frame = frame
                for result in results:
                    if result.obb is None or len(result.obb) == 0:
                        continue
                    annotated_frame = result.plot()
​
                    xywhr = result.obb.xywhr
                    xyxyxyxy = result.obb.xyxyxyxy
                    names = [result.names[cls.item()] for cls in result.obb.cls.int()]
                    confs = result.obb.conf
​
                    for i in range(len(names)):
                        item = {
                            'class_name': names[i],
                            'confidence': float(confs[i]),
                            'center_x': float(xywhr[i][0]),
                            'center_y': float(xywhr[i][1]),
                            'width': float(xywhr[i][2]),
                            'height': float(xywhr[i][3]),
                            'angle': float(xywhr[i][4]),
                            'points': xyxyxyxy[i].tolist()
                        }
                        waste_items.append(item)
​
                if show_image:
                    cv2.imshow('Inference Result', annotated_frame)
                    cv2.waitKey(1)
​
                # Always put result to queue, even if empty
                result_queue.put((waste_items, annotated_frame))
        except:
            pass
    cv2.destroyAllWindows()
    frame_shm.close()

Code Description:

  1. Model Loading: Load the YOLO OBB model using the ultralytics library (task="obb")

  2. Shared Memory: Share camera images with the main process via shared_memory, avoiding data copying

  3. Inference Loop:

    • Receive control commands from control_queue ('exit' to quit, 'infer' for inference)
    • Upon receiving 'infer' command, perform inference on the current frame
  4. Result Parsing:

    • Extract OBB detection box xywhr (center point, width, height, angle)
    • Extract 4 vertex coordinates xyxyxyxy
    • Extract category names and confidence
  5. Result Return: Put detection results and annotated frame into result_queue

YOLO Inference Parameters:

ParameterDescriptionDefault
confConfidence threshold, results below this value are filtered0.1
rectWhether to use rectangular input (improves speed)True
vid_strideVideo frame skip stride (1 means detect every frame)1
max_detMaximum number of detection targets20
halfWhether to use half-precision FP16 inference (improves speed)True
augmentWhether to use test-time augmentation (improves accuracy)True
classesDetection category list (0-15 corresponds to 16 garbage types)[0,1,2,...,15]
deviceInference device (cuda:0 for GPU)"cuda:0"

 

6. Parameter Tuning

  • Parameter file path:
xxxxxxxxxx
$HOME/M3Pro_ws/src/m3pro_bringup/config/common.yaml

6.1 Garbage Sorting Grasp Parameters

xxxxxxxxxx
mcp_service:
  ros__parameters:
    waste_grasp_offset: [0.0, 0.015, -0.02, 1.57]  # Garbage sorting grasp offset
    waste_grasp_distance: [0.24, 0.09]              # Garbage sorting grasp distance threshold
    waste_place_pose: [90, 50, 90, 50, 90, 140]    # Garbage sorting placing pose
    waste_detect_pose: [90, 90, 50, -30, 90, 0]    # Garbage sorting detection pose

Detailed Parameter Description:

ParameterTypeDescriptionDefaultAdjustment Suggestion
waste_grasp_offset[x, y, z, angle]Grasp position offset, used for fine-tuning grasp coordinates and gripper angle[0.0, 0.015, -0.02, 1.57]Adjust based on actual grasp偏差, ±0.005m each time
waste_grasp_distance[0]floatX-direction grasp distance threshold (meters), triggers chassis forward/backward adjustment0.24Increase to reduce chassis movement frequency
waste_grasp_distance[1]floatY-direction grasp distance threshold (meters), triggers chassis left/right adjustment0.09Increase to reduce chassis movement frequency
waste_place_pose[j1, j2, j3, j4, j5, j6]6-joint target angles for waste placement (degrees)[90, 50, 90, 50, 90, 140]Adjust according to trash bin height and position
waste_detect_pose[j1, j2, j3, j4, j5, j6]6-joint target angles for waste detection (degrees)[90, 90, 50, -30, 90, 0]Ensure the camera can fully capture the desktop

waste_grasp_offset Adjustment Principles:

Unlike normal grasping logic, garbage sorting grasping needs to consider the object's rotation angle:

  1. X-axis Offset (forward/backward): Usually 0.0, distance is ensured by chassis adjustment
  2. Y-axis Offset (left/right): Default 0.015m, compensates for lateral offset between camera and gripper
  3. Z-axis Offset (up/down): Default -0.02m, slightly lowers grasp height to ensure gripping the object
  4. Grasp Angle (4th parameter): Default 1.57 radians (90°), indicates the gripper is perpendicular to the desktop

6.2 YOLO Model Detection Parameters

xxxxxxxxxx
waste_detect:
  ros__parameters:
    detect_enable: False              # Detection disabled by default at startup
    model_path: ''                    # YOLO model path
    conf: 0.1                         # Confidence threshold
    vid_stride: 1                     # Frame skip stride
    max_det: 20                       # Maximum detection count
    rect: True                        # Rectangular input
    half: True                        # Half-precision inference
    augment: True                     # Test-time augmentation
    verbose: False                    # Detailed logging
    classes: [0,1,2,...,15]          # Detection categories (16 garbage types)
    device: "cuda:0"                  # Inference device
    show_image: True                  # Show detection window
    image_save_path: ''               # Recognition image save path
    auto_shutdown_time: 240.0         # Auto shutdown time (seconds)
    always_on: False                  # Whether to keep always on

Detailed Parameter Description:

ParameterTypeDescriptionDefaultAdjustment Suggestion
detect_enableboolEnable detection at startupFalseSuggested False, enable on demand to save resources
conffloatConfidence threshold (0.0~1.0)0.1Increase to reduce false positives, but may miss detections
max_detintMaximum targets per detection20Adjust based on actual scenario
halfboolUse FP16 half-precisionTrueRecommended for GPU inference to improve speed
augmentboolTest-time data augmentationTrueImproves accuracy but reduces speed, can disable for faster performance
classeslistDetection category ID list[0-15]Can narrow scope to improve speed
devicestringInference device"cuda:0"Change to "cpu" when no GPU is available
auto_shutdown_timefloatAuto shutdown time after no operation (seconds)240.0Adjust based on usage frequency
show_imageboolShow detection windowTrueCan disable for remote debugging

Performance Optimization Suggestions:

  • If detection speed is slow, try: disable augment, reduce max_det, use half=True
  • If false positives are too many, increase conf to 0.2~0.3
  • If missed detections are too many, decrease conf to 0.05~0.08, or enable augment
OpenClaw robotic arm fixed-point placement
OpenClaw slam mapping and navigation

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
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文