Skip to content

meng14774/RGB-D-camera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camera Subscriber Package

This package contains nodes for subscribing to and processing RGB and depth images from an Orbbec camera. It includes functionality for image viewing, alignment, and obstacle detection based on depth information.

Nodes

1. image_viewer

Subscribes to raw RGB and depth images and displays them in separate windows.

Features:

  • Subscribes to /camera/color/image_raw for RGB images
  • Subscribes to /camera/depth/image_raw for depth images
  • Displays images at 30 FPS
  • Press ESC to exit

To run:

ros2 run camera_subscriber image_viewer

2. aligned_image_publisher

Subscribes to raw RGB and depth images, processes them, and publishes aligned images.

Processing steps:

  • Crops the RGB image to 640x400 (rows 35-435) to focus on the central region
  • Flips the depth image horizontally to align with the RGB image
  • Publishes processed images at 30 FPS

Published topics:

  • /aligned/rgb/image_raw - Aligned RGB image (640x400)
  • /aligned/depth/image_raw - Aligned depth image (640x400)

To run:

ros2 run camera_subscriber aligned_image_publisher

3. aligned_image_viewer

Subscribes to the aligned RGB and depth images and displays them in separate windows.

Features:

  • Subscribes to /aligned/rgb/image_raw for aligned RGB images
  • Subscribes to /aligned/depth/image_raw for aligned depth images
  • Displays images at 30 FPS
  • Press ESC to exit

To run:

ros2 run camera_subscriber aligned_image_viewer

4. depth_obstacle_detector

Analyzes depth images to detect obstacles and potential drop-offs in front of the robot.

Detection logic:

  • Focuses on the bottom 20% of the depth image
  • Divides the area into left, center, and right regions
  • Evaluates average depth in each region:
    • < 0.3m: Obstacle detected (danger zone)
    • 0.3m-0.8m: Safe zone
    • 0.8m: Potential drop-off risk (stairs/cliff)

Parameters:

  • depth_image_topic: Topic for depth images (default: /camera/depth/image_raw)
  • bottom_roi_height_ratio: Ratio of image height to analyze (default: 0.2)
  • safe_distance_min: Minimum safe distance in meters (default: 0.3)
  • safe_distance_max: Maximum safe distance in meters (default: 0.8)
  • roi_side_width_ratio: Width ratio for side regions (default: 0.3)

To run with default parameters:

ros2 run camera_subscriber detector

To run with custom parameters:

ros2 run camera_subscriber detector --ros-args -p safe_distance_min:=0.5 -p safe_distance_max:=1.0

Topics

Subscribed Topics

  • /camera/color/image_raw (sensor_msgs/msg/Image) - Raw RGB image
  • /camera/depth/image_raw (sensor_msgs/msg/Image) - Raw depth image

Published Topics

  • /aligned/rgb/image_raw (sensor_msgs/msg/Image) - Aligned RGB image (640x400)
  • /aligned/depth/image_raw (sensor_msgs/msg/Image) - Aligned depth image (640x400)

Usage

  1. First, make sure your Orbbec camera is properly connected and the drivers are running.

  2. To view raw images:

    ros2 run camera_subscriber image_viewer
  3. To process and publish aligned images:

    ros2 run camera_subscriber aligned_image_publisher
  4. To view the aligned images:

    ros2 run camera_subscriber aligned_image_viewer
  5. To detect obstacles based on depth information:

    ros2 run camera_subscriber detector

Notes

  • All nodes operate at approximately 30 FPS (33ms intervals)
  • Press ESC to exit any of the viewer nodes
  • Depth images are normalized for display purposes (scaled by 0.03)
  • The obstacle detector logs warnings and alerts based on detected conditions

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages