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.
- Ubuntu: 22.04 LTS
- ROS 2: Jazzy Jalisco
- Gazebo: Harmonic
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- Create Workspace and Clone Repository
mkdir -p my_ws/src && cd my_ws/src
git clone https://github.com/yashikasharma0301/depth_to_pcl.git- Build the Workspace
cd ..
colcon build- Source the Workspace
source install/setup.bash- Launch Robot with Depth Camera in Gazebo
ros2 launch depth_to_pcl gazebo_spawn.launch.py
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
- 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
- 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)
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)