sudo apt-get install ros-$ROS_DISTRO-realsense2-camera
sudo apt-get install ros-$ROS_DISTRO-realsense2-description
We use noetic ROS Distribution
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
cd ..
catkin_init_workspace
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
Launch the rs_camera.launch launch file located in realsense2_camera package
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
Launch rviz to Visualize the Camera Feed and Depth
rviz
In Fixed Frame, select camera_color_optical_frame
Then Click add, goto By topic, expand /camera, /color and /image_raw, select camera with raw option and then click Ok.
It would show the Camera Feed in the Bottom Left
Then Click add, goto By topic, expand /camera, /depth, /color and /points, select PointCloud2 and then click Ok.
It would show the Depth with color.
Select Points in the Style Parameter to get a better Visualization