Skip to content

yashikasharma0301/depth_to_pcl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROS2 Depth to Point Cloud Converter

This project demonstrates depth image to point cloud conversion in a differential drive robot simulation using ros_gz_bridge. The package processes depth camera data and converts it to point cloud format using ros_gz_bridge for real-time 3D visualization and perception applications. View the project visualization here.

System Requirements

  • Ubuntu: 22.04 LTS
  • ROS 2: Jazzy Jalisco
  • Gazebo: Harmonic

Usage

Prerequisites

Install required ROS 2 packages:

sudo apt install ros-jazzy-robot-state-publisher \
                 ros-jazzy-joint-state-publisher \
                 ros-jazzy-xacro \
                 ros-jazzy-teleop-twist-keyboard \
                 ros-jazzy-ros-gz-sim \
                 ros-jazzy-ros-gz-bridge \
                 ros-jazzy-sensor-msgs \
                 ros-jazzy-rviz2

Installation & Setup

  1. Create Workspace and Clone Repository
mkdir -p my_ws/src && cd my_ws/src
git clone https://github.com/yashikasharma0301/depth_to_pcl.git
  1. Build the Workspace
cd ..
colcon build
  1. Source the Workspace
source install/setup.bash

Running the Simulation

  1. Launch Robot with Depth Camera in Gazebo
ros2 launch depth_to_pcl gazebo_spawn.launch.py
image

To enable robot control within Gazebo:

  • Click on the three dots on the upper right corner of your Gazebo window
  • Search for Teleop from the menu and click on it
  • This will open the teleop plugin allowing you to control the robot directly from Gazebo
  1. Start RViz2 for Point Cloud Visualization

In another terminal run:

rviz2 -d /home/yashika-arz-i007/my_ws/src/depth_to_pcl/rviz/pcl.rviz
  • Ensure the Fixed Frame is set to camera_optical_frame
  • You will be able to see the point cloud visualization in RViz2
  • Move the robot around in Gazebo using Teleop and you will be able to see the corresponding point cloud
image
  1. Alternative: Depth Image Visualization

If you want to see the depth image instead of the point cloud:

  • Turn off the point cloud display in RViz2
  • Set the Fixed Frame to base_footprint
  • Select the corresponding RViz plugins for camera and image visualization
  • You will be able to see some rough visualization in the set format (Use rqt image viewer for better visualization)
image image

Credits & References

Robot Model: This project uses a URDF model adapted from the TortoiseBot example in the OSRF ROS Book. The original model has been modified for ROS 2 Jazzy and Gazebo Harmonic integration with depth camera sensor capabilities.

Original Authors: Open Source Robotics Foundation (OSRF)

About

ROS2 package to convert depth image to pointcloud in ROS2 Jazzy and Gazebo Harmonic using ros_gz_bridge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors