Skip to content

RealSense Setup

Bhargav Chandaka edited this page Sep 27, 2022 · 1 revision

Installing ROS2 RealSense Wrapper

ROS2 RealSense Wrapper in Ubuntu VM MUST build from source, NOT the ROS distribution, using https://github.com/IntelRealSense/realsense-ros/tree/ros2.

If you did not do this, and you are experiencing errors, run:

#for foxy
sudo apt purge ros-foxy-realsense2-camera
sudo apt purge ros-foxy-realsense2-camera-msgs
sudo apt purge ros-foxy-librealsense2

#for galactic
sudo apt purge ros-galactic-realsense2-camera
sudo apt purge ros-galactic-realsense2-camera-msgs
sudo apt purge ros-galactic-librealsense2

Use commands for appropriate version. Then rebuild the ROS2 wrapper from source. When step 5 (colcon build) fails, use sudo apt install librealsense2-dev and rerun colcon build. Refer to this forum post for more details.

For convenience until you add the source path to the bash: . install/local_setup.bash

Visualizing in RVIZ2

  • Run ros2 launch realsense2_camera rs_launch.py to start the camera node.
  • In a new terminal, launch RVIZ2: ros2 run rviz2 rviz2
  • Under 'Global Options', set 'Fixed Frame' to camera_link.
  • Select the Add button and switch to the tab 'By topic'.
  • Select the module you want to add under your desired topic name.
  • If the data is not coming through, ensure that the Reliability Policy is the same as the camera node using a new terminal (ros2 topic info -v topic_name).

List of Published Topics: The published topics differ according to the device and parameters. After running the above command with D435i attached, the following list of topics will be available (This is a partial list. For full one type rostopic list):

  • /camera/color/camera_info
  • /camera/color/image_raw
  • /camera/depth/camera_info
  • /camera/depth/image_rect_raw
  • /camera/extrinsics/depth_to_color
  • /camera/extrinsics/depth_to_infra1
  • /camera/extrinsics/depth_to_infra2
  • /camera/infra1/camera_info
  • /camera/infra1/image_rect_raw
  • /camera/infra2/camera_info
  • /camera/infra2/image_rect_raw
  • /camera/gyro/imu_info
  • /camera/gyro/sample
  • /camera/accel/imu_info
  • /camera/accel/sample
  • /diagnostics

Useful Links:
Data Display with RVIZ2
Adding Video Capture in RVIZ2