yahboom
HomeTutorialsProduct
Solution
Blog
Online Store
About Us
EN/中文
Store
ROSMASTER A1 PRO📖
00.Configuration and Operation Guide
  • 0. Unboxing and Review
  • 1.Assembly Videos
  • 2.User Manual
  • 3.Enter Docker (For Raspberry Pi)
  • 4.A1Pro Front Wheel Servo Calibration
  • 5.USB Camera Calibration
  • 6.Depth Camera Calibration
  • 7.FAQ
  • 8.Desktop Configuration Center and Remote Control Guide
01.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
02.Lidar Course
  • 1.Lidar Introduction and Use
  • 2.Lidar Obstacle Avoidance
  • 3.Lidar Following
  • 4.Lidar Patrol
  • 5.GMapping-SLAM Mapping
  • 6.Cartographer-SLAM Mapping
  • 7.Slam-Toolbox Mapping
  • 8.Lifelong Mode Mapping
  • 9.Navigation2 Single Point Navigation
  • 10.Navigation2 Multi Point Navigation
  • 11.Cartographer Relocalization Navigation
  • 12.Slam-Toolbox Localization Navigation
  • 13.Synchronous Mapping And Navigation
  • 14.Aruco Visual Relocalization Navigation
  • 15.Mobile App Mapping And Navigation
  • 16.AprilTag Transport
  • 17.Color Block Transport
03.USB Camera-Depth Camera Course
  • 1.USB Camera Introduction
  • 2.USB Camera Intrinsic Calibration
  • 3.Nuwa-HP60C Camera Introduction (Depth Camera Only)
  • 4.Depth Camera Distance Measurement (Depth Camera Only)
  • 5.Depth Pseudo Color Image (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)
04.Robotic Arm and 3D Space Gripping Course
  • 0.Robotic Arm Basic Usage
  • 1.Robotic Arm Kinematics
  • 2.Robotic Arm Chassis Coordination Control
  • 3.AprilTag ID Sorting
  • 4.AprilTag Height Anomaly Sorting
  • 5.AprilTag Tracking and Grasping
  • 6.Color Block Sorting
  • 7.Color Block Height Anomaly Sorting
  • 8.Color Block Tracking and Grasping
  • 9.Wood Block Shape Sorting
  • 10.KCF Tracking and Grasping Objects
  • 11.Mediapipe Gesture ID Sorting AprilTag
  • 12.Mediapipe Gesture Height Sorting AprilTag
  • 13.Desktop Tracking and Grasping AprilTag
  • 14.3D Spatial Tracking AprilTag
  • 15.Line Following Obstacle Clearing
  • 16.Transformer Model Tracking Algorithm
05.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
06.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
07.OpenClaw Interaction Method
  • 1.OpenClaw Webchat Interaction
  • 2.OpenClaw Tui Interaction
  • 3.OpenClaw Voice Dialogue Interaction
  • 4.OpenClaw WhatsApp Interaction
08.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
09.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 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
  • 1.Register a Model Service Provider Aaccount
  • 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 - Text Version
  • 1.Semantic Understand and Command Follow
  • 2.Multimodal Visual Understand
  • 3.Multimodal Visual Understand + Robotic Arm Gripping
  • 4.Multimodal Visual Understand+SLAM Navigation
  • 5.Robotic Arm Gripping+Multimodal Visual Understand+SLAM Navigation
  • 6.Intention Estimation
14.AI Model - Voice Version
  • 1.Semantic Understand and Command Follow
  • 2.Multimodal Visual Understand
  • 3. Multimodal Large Model+Robotic Arm Gripping
  • 4.Multimodal Visual Understand+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 Cobotic Arm
  • 13.Gesture Grabbing and Releasing Objects
  • 14.Finger Control Robotic Arm
  • 15.Medipipe Gesture Control Robotic arm Cction 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.Scene Design
  • 8.Trajectory Planning
  • 9.Collision Detection
  • 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
  • SystemFile
  • Code
  • 3D_Model_File
  • Software_Tools
  • Hardware_Info
  • Introduction_Manual
  • Script_File
  • Dify AI Agent
Download ZIP

Welcome to ROSMASTER A1 PRO repository

8.Monocular Depth Estimation

Monocular Depth Estimation

Monocular Depth Estimation1、Enable Optimal Board Performance1.1、Enable Jetson Clocks2、Program Launch2.1、Start the Camera and Manipulator Drivers2.2、Start the Monocular Depth Estimation NodePreview3、Core Source Code Analysis3.1、Model Initialization and GPU CUDA Acceleration Backend3.2、Image Size Preprocessing and Tensor Conversion3.3、Depth Map Extraction and Pseudo-Color Rendering Display3.4、Automatic Safe Reset of the Manipulator Pose4、Core Tunable Parameter Summary Table

This section demonstrates the application of Monocular Depth Estimation on robots based on neural networks. From a 2D image captured by a single ordinary RGB camera, a deep learning model is used to estimate in real time the physical depth distance of each region and object in the scene relative to the camera, and the relative depth is mapped to an intuitive pseudo-color heatmap as the output.


1、Enable Optimal Board Performance

1.1、Enable Jetson Clocks

Enabling Jetson Clocks ensures that all CPU and GPU cores run at maximum frequency, improving the model inference throughput of ONNX Runtime and the real-time frame rate: (Not required on RDK and Raspberry Pi boards)

sudo jetson_clocks

2、Program Launch

2.1、Start the Camera and Manipulator Drivers

Open the first terminal and enter the following command to start the base drivers of the camera and the manipulator:

xxxxxxxxxx
ros2 launch dofbot_pro_driver A1pro_camera_arm.launch.py

Note: The program automatically adapts the input image Topic according to the system environment variable CAMERA_TYPE:

  • If using the Nuwa depth camera (default): automatically subscribes to /ascamera_hp60c/camera_publisher/rgb0/image;
  • If using a USB camera: automatically subscribes to /usb_cam/image_raw.

2.2、Start the Monocular Depth Estimation Node

Open the second terminal and enter the following command to start the main depth estimation program:

xxxxxxxxxx
ros2 run yahboomcar_depth depth_estimate

image-20260904173928458

After the program starts, it automatically performs the following operations:

  1. Automatic reset of the safe manipulator pose: publishes the initial pose (90, 180, 0, 0, 90, 0) to arm6_joints to return the manipulator to its home position, preventing the manipulator structure from blocking the camera view;
  2. Loads the ONNX model and detects hardware acceleration: loads the ~/MODELS/yolo/yolo26n-depth.onnx model by default and preferentially enables the GPU CUDA execution provider (CUDAExecutionProvider) for acceleration;
  3. Pops up a dual-frame real-time window: a window titled Depth Estimate Panel is shown, with the original RGB color frame on the left and the monocular depth estimation result on the right.

Preview

image-20260904174013151

xxxxxxxxxx
Frame Display Description:
- Left frame 【RGB】:real-time color camera frame, showing the current frame rate (FPS) and the per-frame inference time (Infer ms) in the upper-left corner;
- Right frame 【Depth】:the dense relative depth pseudo-color map generated by monocular estimation (default JET mode; red/warm colors indicate distant objects, while cold/blue colors indicate nearby background).

3、Core Source Code Analysis

The source file is located at:

xxxxxxxxxx
~/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_depth/yahboomcar_depth/Yolov26/depth_estimate.py

3.1、Model Initialization and GPU CUDA Acceleration Backend

The program uses ONNX Runtime as the inference backend and automatically detects the runtime environment of the current system during initialization; if CUDA is supported, GPU hardware acceleration is preferentially enabled:

​x
def init_depth_model(self):
    '''Load the monocular depth estimation ONNX model and cache the input/output metadata'''
    if not os.path.isfile(self.model_path):
        raise FileNotFoundError(f'Depth ONNX model not found: {self.model_path}.')
​
    available_providers = ort.get_available_providers()
    providers = ['CPUExecutionProvider']
    # Preferentially detect and mount the CUDA GPU inference acceleration engine
    if self.use_cuda and 'CUDAExecutionProvider' in available_providers:
        providers.insert(0, 'CUDAExecutionProvider')
    elif self.use_cuda:
        self.get_logger().warning('CUDAExecutionProvider is unavailable; using CPUExecutionProvider.')
​
    self.ort_session = ort.InferenceSession(self.model_path, providers=providers)
    input_meta = self.ort_session.get_inputs()[0]
    self.input_name = input_meta.name
    self.input_height = self.static_dimension(input_meta.shape[2], 640)
    self.input_width = self.static_dimension(input_meta.shape[3], 640)
    self.input_dtype = np.float16 if input_meta.type == 'tensor(float16)' else np.float32

3.2、Image Size Preprocessing and Tensor Conversion

To meet the input requirements of the neural network model, the original BGR color image is first converted to RGB format, resized to the model's fixed resolution (e.g., 640×640), normalized to [0, 1], and converted into a batch tensor of shape (1, 3, H, W):

xxxxxxxxxx
def prepare_input(self, rgb_image):
    input_image = cv2.cvtColor(rgb_image, cv2.COLOR_BGR2RGB)
    input_image = cv2.resize(input_image, (self.input_width, self.input_height))
    input_tensor = input_image.astype(self.input_dtype) / self.input_dtype(255.0)
    input_tensor = np.transpose(input_tensor, (2, 0, 1))[None, ...]
    return np.ascontiguousarray(input_tensor)

3.3、Depth Map Extraction and Pseudo-Color Rendering Display

The single-channel depth map output by the model is mapped to a 0~255 grayscale space via cv2.normalize and then rendered into an intuitive pseudo-color image through an OpenCV color palette. The depth map can also be published as a ROS topic for downstream nodes:

xxxxxxxxxx
def get_RGBImageCallBack(self, rgb_msg):
    rgb_image = self.rgb_bridge.imgmsg_to_cv2(rgb_msg, desired_encoding='bgr8')
    infer_start = time.time()
    try:
        input_tensor = self.prepare_input(rgb_image)
        output = self.ort_session.run([self.depth_output_name], {self.input_name: input_tensor})[0]
        depth_map = self.extract_depth_map(output)
    except Exception as error:
        ...
        return
​
    # 1. Normalize to 0~255 and convert to an 8-bit integer
    depth_vis = cv2.normalize(depth_map, None, 0, 255, cv2.NORM_MINMAX).astype(np.uint8)
    # 2. Pseudo-color rendering (default COLORMAP_JET)
    depth_vis = cv2.applyColorMap(depth_vis, self.colormap)
    if depth_vis.shape[:2] != rgb_image.shape[:2]:
        depth_vis = cv2.resize(depth_vis, (rgb_image.shape[1], rgb_image.shape[0]))
​
    # 3. Optional: publish the depth map to a ROS topic
    if self.depth_pub is not None:
        depth_msg = self.rgb_bridge.cv2_to_imgmsg(
            cv2.normalize(depth_map, None, 0, 255, cv2.NORM_MINMAX).astype(np.uint8),
            encoding='mono8',
        )
        depth_msg.header = rgb_msg.header
        self.depth_pub.publish(depth_msg)
​
    # 4. Horizontally concatenate the original frame and the depth frame and display them in real time
    combined_frame = cv2.hconcat([rgb_image, depth_vis])
    cv2.imshow("Depth Estimate Panel", combined_frame)
    cv2.waitKey(1)

3.4、Automatic Safe Reset of the Manipulator Pose

After the node starts, it sends servo control commands to arm6_joints through a timer to move the 6-DOF manipulator to the preset safe reset pose, ensuring that the manipulator does not block the camera:

xxxxxxxxxx
def reset_arm_pose(self):
    '''Move the 6 servos of the manipulator back to the reset initial pose to avoid blocking the forward view'''
    msg = ArmJoints()
    msg.joint1, msg.joint2, msg.joint3 = self.init_pose[:3]
    msg.joint4, msg.joint5, msg.joint6 = self.init_pose[3:]
    msg.time = ARM_MOVE_TIME_MS
    self.arm_pose_pub.publish(msg)
    self.arm_init_timer.cancel()
    self.get_logger().info(f"Arm returned to initial pose: {list(self.init_pose)}")

4、Core Tunable Parameter Summary Table

ParameterDefault ValueDescription
model_path~/MODELS/yolo/yolo26n-depth.onnxAbsolute path of the depth estimation ONNX model file
image_topicAuto-detected (USB or Nuwa)ROS 2 topic name of the input color image
use_cudaTrueWhether to preferentially enable GPU CUDA for model inference acceleration
publish_depthFalseWhether to publish the generated single-channel depth map to the /depth_image topic
depth_colormapJETPseudo-color mapping table of the depth map; options: JET, TURBO, INFERNO, MAGMA
init_pose[90, 180, 0, 0, 90, 0]The 6 joint angles (in degrees) for automatic reset of the manipulator at startup
YOLOv26 + DeepSORT Tracking
Notes (Must Read)

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/中文