You can follow the instructions from here, but we will include the instructions locally:
During librealsense-dkms package installation, some kernel versions don't need all patches applied. Read it here: https://github.com/IntelRealSense/librealsense/issues/11745#issuecomment-1695116725
If librealsense-dkms fails you can still try to run realsense-viewer. If it shows the camera and point cloud correctly chances are, you will be able to use it from ros without this driver.
sudo mkdir -p /etc/apt/keyrings
curl -sSf https://librealsense.intel.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null
sudo apt-get install apt-transport-https
echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.intel.com/Debian/apt-repo `lsb_release -cs` main" | \
sudo tee /etc/apt/sources.list.d/librealsense.list
sudo apt-get update
sudo apt-get install librealsense2-dkms librealsense2-utils
Reconnect your realsense. Be sure to use a USB3 port (blue ones)
Test the driver and utils and realsense
realsense-viewer
You should be able to activate the RGB camera and the Stereo Module (pointcloud)
If this works you can proceed to install and test the ROS2 module:
sudo apt-get install ros-humble-realsense-camera
ros2 launch realsense2_camera rs_launch.py depth_module.profile:=1280x720x30 pointcloud.enable:=true
If you have multiple realsenses and you know the serial number of the one your are interested to use:
ros2 launch realsense2_camera rs_launch.py depth_module.profile:=1280x720x30 pointcloud.enable:=true serial_no:="'829212070988'"
ros2 run rviz2 rviz2
In rviz add a "PointCloud2" plugin and configure its topic to "/camera/depth/color/points"
Configure rviz: Global Options -> Fixed Frame : "camera_link"
You should see the realsense point cloud working