Intermittent realsense crash on the Stretch

It starts but seems to die every couple hours. Any ideas what I can do to improve reliability?

Hi @cpaxton, there’s a configuration of Realsense drivers and Realsense backends that can cause issues, both at startup of the camera and during usage. Can you capture the following debugging information:

  • The error emitted when the Realsense crashes
  • Version of Ubuntu using lsb_release -d -s
  • List versions of librealsense2 using: sudo apt list | grep realsense
  • List versions of realsense-ros using: cd ~/catkin_ws/src/ && ll

I’m using Noetic, do you think the multiple versions are the issue? It should only be sourcing the ros noetic workspace.

hello-robot@hello-robot:~$ sudo apt list | grep realsense
[sudo] password for hello-robot: 

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

librealsense2-dbg/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2-dev/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2-dkms/focal,now 1.3.18-0ubuntu1 all [installed]
librealsense2-gl-dbg/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2-gl-dev/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2-gl/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2-net-dbg/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2-net-dev/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2-net/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2-udev-rules/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2-utils/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
librealsense2/focal 2.51.1-0~realsense0.7526 amd64 [upgradable from: 2.50.0-0~realsense0.6128]
ros-foxy-librealsense2-dbgsym/focal 2.50.0-2focal.20220223.160142 amd64
ros-foxy-librealsense2/focal 2.50.0-2focal.20220223.160142 amd64
ros-foxy-realsense-msgs-dbgsym/focal 2.0.8-2focal.20220209.142543 amd64
ros-foxy-realsense-msgs/focal 2.0.8-2focal.20220209.142543 amd64
ros-foxy-realsense2-camera-dbgsym/focal 4.0.4-1focal.20220323.000248 amd64
ros-foxy-realsense2-camera-msgs-dbgsym/focal 4.0.4-1focal.20220322.234811 amd64
ros-foxy-realsense2-camera-msgs/focal 4.0.4-1focal.20220322.234811 amd64
ros-foxy-realsense2-camera/focal 4.0.4-1focal.20220323.000248 amd64
ros-foxy-realsense2-description/focal 4.0.4-1focal.20220323.000251 amd64
ros-galactic-librealsense2-dbgsym/focal 2.50.0-2focal.20220222.210235 amd64
ros-galactic-librealsense2/focal,now 2.50.0-2focal.20220222.210235 amd64 [installed,automatic]
ros-galactic-realsense2-camera-dbgsym/focal 4.0.4-1focal.20220730.025956 amd64
ros-galactic-realsense2-camera-msgs-dbgsym/focal 4.0.4-1focal.20220729.134203 amd64
ros-galactic-realsense2-camera-msgs/focal 4.0.4-1focal.20220729.134203 amd64 [upgradable from: 4.0.4-1focal.20220321.203259]
ros-galactic-realsense2-camera/focal 4.0.4-1focal.20220730.025956 amd64 [upgradable from: 4.0.4-1focal.20220321.203444]
ros-galactic-realsense2-description/focal 4.0.4-1focal.20220730.030210 amd64 [upgradable from: 4.0.4-1focal.20220321.203543]
ros-noetic-librealsense2-dbgsym/focal 2.50.0-1focal.20211115.134455 amd64
ros-noetic-librealsense2/focal,now 2.50.0-1focal.20211115.134455 amd64 [installed,automatic]
ros-noetic-realsense2-camera-dbgsym/focal 2.3.2-1focal.20220906.153355 amd64 [upgradable from: 2.3.2-1focal.20220221.110718]
ros-noetic-realsense2-camera/focal 2.3.2-1focal.20220906.153355 amd64 [upgradable from: 2.3.2-1focal.20220221.110718]
ros-noetic-realsense2-description/focal,now 2.3.2-1focal.20220212.161322 amd64 [installed]
hello-robot@hello-robot:~$ cd ~/catkin_ws/src/ && ll
total 28
drwxrwxr-x  7 hello-robot hello-robot 4096 Sep 21 16:00 ./
drwxrwxr-x  6 hello-robot hello-robot 4096 Sep 21 15:58 ../
lrwxrwxrwx  1 hello-robot hello-robot   49 Apr 20 14:40 CMakeLists.txt -> /opt/ros/noetic/share/catkin/cmake/toplevel.cmake
lrwxrwxrwx  1 hello-robot hello-robot   33 Jul 19 18:04 home_robot -> /home/hello-robot/src/home_robot//
drwxrwxr-x  5 hello-robot hello-robot 4096 Apr 20 14:43 realsense_gazebo_plugin/
drwxrwxr-x  6 hello-robot hello-robot 4096 Sep  9 19:23 realsense-ros/
drwxrwxr-x  8 hello-robot hello-robot 4096 Jun 24 16:40 rplidar_ros/
drwxrwxr-x 11 hello-robot hello-robot 4096 Jun 24 16:39 scan_tools/
drwxrwxr-x 17 hello-robot hello-robot 4096 Sep 22 17:20 stretch_ros/

The ros-*-librealsense2 packages use a userspace backend called RSUSB to communicate with the Realsense camera, whereas the librealsense2 packages use Video4Linux2 backend. The former is better portable (e.g. Raspberry pi), but the latter is more stable for the NUC computer used inside Stretch. I recommend using the following commands to switch to using the librealsense2 packages:

sudo apt remove ros-galactic-librealsense2 ros-galactic-realsense2-camera-msgs ros-galactic-realsense2-camera ros-galactic-realsense2-description ros-noetic-librealsense2 ros-noetic-realsense2-camera ros-noetic-realsense2-description

Update the librealsense2 packages using:

sudo apt upgrade

Now, when you run sudo apt list | grep realsense, none of the ROS realsense packages should be installed.

In your ROS workspace, clone the realsense-ros repo and checkout v2.3.2, the latest for ROS1:

cd ~/catkin_ws/src
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros
git checkout 2.3.2

Additionally, I’ve recently brought a bugfix related to the Realsense into the noetic branch. Update using:

cd ~/catkin_ws/src/stretch_ros
git status # ensure on the 'dev/noetic' branch
git pull

Finally, build the workspace and source it:

cd ~/catkin_ws
catkin_make
source ~/catkin_ws/devel/setup.bash # Should already be in your bashrc

For users who have upgraded to Ubuntu 20.04 recently, the new Stretch Install scripts already configure the Realsense software this way. Let me know if you have any questions or run into any issues.

Great, I was able to follow these steps and am going to see if the realsense crash persists. I had two robots set up the same way and was only seeing crashes on one, which is somewhat strange…

1 Like