RealSense Downgrade Patch on Ubuntu 20.04 + ROS Noetic - patch failed

We are having some trouble with the RealSense downgrade on Ubuntu 20 + ROS Noetic. We recently installed Ubuntu 20 + Noetic on this Stretch (includes the ROS 2 items in .bashrc, for example). We were experiencing issues with the ArUco detector for tags that are far away from the robot. This code worked previously on another Stretch with an older install of Ubuntu 20 + Noetic.

During operation, we receive the error:

WARNING: There are too few points from the depth image for plane fitting, so only using the RGB ArUco estimate. number of points = 0

Our launch file includes:

  <!-- REALSENSE D435i -->
  <include file="$(find stretch_core)/launch/d435i_high_resolution.launch"></include>
  <node name="d435i_configure" pkg="stretch_core" type="d435i_configure" output="screen">
    <param name="initial_mode" type="string" value="High Accuracy"/>
  </node>
  <!-- -->

...

  <!-- ARUCO MARKER DETECTOR -->
  <include file="$(find stretch_core)/launch/stretch_aruco.launch"></include>
  <!-- -->

When we run ./realsense_downgrade_patch.sh as suggested in the patch announcement, the output is shown below. It seems like there’s an issue with the librealsense binaries. Additionally, running realsense-viewer in the terminal yields realsense-viewer: command not found.

Update latest apt indices
Hit:1 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease                               
Hit:3 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease                                                                    
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease                                                                       
Hit:5 http://packages.ros.org/ros/ubuntu focal InRelease                                                                               
Hit:6 http://packages.ros.org/ros2/ubuntu focal InRelease                                             
Hit:7 https://librealsense.intel.com/Debian/apt-repo focal InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
315 packages can be upgraded. Run 'apt list --upgradable' to see them.
Remove newest librealsense2 binaries
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'librealsense2-dkms' is not installed, so not removed
Package 'librealsense2-gl' is not installed, so not removed
Package 'librealsense2-gl-dev' is not installed, so not removed
Package 'librealsense2' is not installed, so not removed
Package 'librealsense2-dbg' is not installed, so not removed
Package 'librealsense2-udev-rules' is not installed, so not removed
Package 'librealsense2-gl-dbg' is not installed, so not removed
Package 'librealsense2-net-dbg' is not installed, so not removed
Package 'librealsense2-utils' is not installed, so not removed
Package 'librealsense2-net' is not installed, so not removed
Package 'librealsense2-net-dev' is not installed, so not removed
Package 'librealsense2-dev' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  at dctrl-tools dkms libatk-bridge2.0-dev libatspi2.0-dev libepoxy-dev libfl2 libglfw3 libgtk-3-dev libxtst-dev
  linux-headers-5.11.0-27-generic linux-hwe-5.11-headers-5.11.0-27 linux-image-5.11.0-27-generic linux-modules-5.11.0-27-generic
  linux-modules-extra-5.11.0-27-generic wayland-protocols x11proto-record-dev
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 315 not upgraded.
Install 2.45 librealsense2 binaries
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '2.45.0-0~realsense0.4551' for 'librealsense2' was not found
E: Version '2.45.0-0~realsense0.4551' for 'librealsense2-utils' was not found
E: Version '2.45.0-0~realsense0.4551' for 'librealsense2-dev' was not found
E: Version '2.45.0-0~realsense0.4551' for 'librealsense2-dbg' was not found
E: Version '2.45.0-0~realsense0.4551' for 'librealsense2-gl' was not found
E: Version '2.45.0-0~realsense0.4551' for 'librealsense2-net' was not found
E: Version '2.45.0-0~realsense0.4551' for 'librealsense2-udev-rules' was not found
Remove realsense-ros binaries
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ros-melodic-realsense2-camera
E: Unable to locate package ros-melodic-realsense2-description
E: Unable to locate package ros-melodic-librealsense2
Building realsense-ros 2.3.0 from source
fatal: destination path 'realsense-ros' already exists and is not an empty directory.
Base path: /home/hello-robot/catkin_ws
Source space: /home/hello-robot/catkin_ws/src
Build space: /home/hello-robot/catkin_ws/build
Devel space: /home/hello-robot/catkin_ws/devel
Install space: /home/hello-robot/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/hello-robot/catkin_ws/build"
####
####
#### Running command: "make -j8 -l8" in "/home/hello-robot/catkin_ws/build"
####
[  0%] Built target rosgraph_msgs_generate_messages_cpp
[  0%] Built target roscpp_generate_messages_lisp
[  0%] Built target sensor_msgs_generate_messages_eus
[  0%] Built target roscpp_generate_messages_nodejs
[  0%] Built target roscpp_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_eus
[  0%] Built target roscpp_generate_messages_eus
[  0%] Built target std_msgs_generate_messages_cpp
[  0%] Built target rosgraph_msgs_generate_messages_eus
[  0%] Built target geometry_msgs_generate_messages_lisp
[  0%] Built target geometry_msgs_generate_messages_nodejs
[  0%] Built target geometry_msgs_generate_messages_cpp
[  0%] Built target rosgraph_msgs_generate_messages_lisp
[  0%] Built target geometry_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_lisp
[  0%] Built target std_msgs_generate_messages_nodejs
[  0%] Built target roscpp_generate_messages_py
[  0%] Built target rosgraph_msgs_generate_messages_py
[  0%] Built target nodelet_generate_messages_nodejs
[  0%] Built target geometry_msgs_generate_messages_eus
[  0%] Built target nodelet_generate_messages_cpp
[  0%] Built target rosgraph_msgs_generate_messages_nodejs
[  0%] Built target bond_generate_messages_py
[  0%] Built target bond_generate_messages_nodejs
[  0%] Built target sensor_msgs_generate_messages_py
[  0%] Built target bond_generate_messages_eus
[  0%] Built target sensor_msgs_generate_messages_nodejs
[  0%] Built target sensor_msgs_generate_messages_lisp
[  0%] Built target bond_generate_messages_cpp
[  0%] Built target nodelet_generate_messages_eus
[  0%] Built target nodelet_generate_messages_lisp
[  0%] Built target nodelet_generate_messages_py
[  0%] Built target bond_generate_messages_lisp
[  0%] Built target actionlib_msgs_generate_messages_cpp
[  0%] Built target tf2_msgs_generate_messages_eus
[  0%] Built target sensor_msgs_generate_messages_cpp
[  3%] Built target rplidarNodeClient
[ 21%] Built target rplidarNode
[ 21%] Built target actionlib_msgs_generate_messages_eus
[ 21%] Built target actionlib_msgs_generate_messages_nodejs
[ 21%] Built target actionlib_msgs_generate_messages_py
[ 21%] Built target actionlib_msgs_generate_messages_lisp
[ 21%] Built target tf2_msgs_generate_messages_py
[ 21%] Built target tf2_msgs_generate_messages_nodejs
[ 21%] Built target tf_generate_messages_cpp
[ 21%] Built target tf_generate_messages_nodejs
[ 21%] Built target actionlib_generate_messages_lisp
[ 21%] Built target tf_generate_messages_lisp
[ 21%] Built target tf2_msgs_generate_messages_lisp
[ 21%] Built target actionlib_generate_messages_eus
[ 21%] Built target actionlib_generate_messages_nodejs
[ 21%] Built target tf_generate_messages_py
[ 21%] Built target tf_generate_messages_eus
[ 21%] Built target actionlib_generate_messages_py
[ 21%] Built target tf2_msgs_generate_messages_cpp
[ 21%] Built target actionlib_generate_messages_cpp
[ 21%] Built target topic_tools_generate_messages_cpp
[ 21%] Built target dynamic_reconfigure_generate_messages_nodejs
[ 21%] Built target dynamic_reconfigure_generate_messages_lisp
[ 21%] Built target dynamic_reconfigure_generate_messages_py
[ 21%] Built target dynamic_reconfigure_gencfg
[ 21%] Built target dynamic_reconfigure_generate_messages_cpp
[ 21%] Built target dynamic_reconfigure_generate_messages_eus
[ 21%] Built target topic_tools_generate_messages_py
[ 21%] Built target pcl_ros_gencfg
[ 21%] Built target topic_tools_generate_messages_lisp
[ 21%] Built target topic_tools_generate_messages_nodejs
[ 21%] Built target pcl_msgs_generate_messages_lisp
[ 21%] Built target pcl_msgs_generate_messages_py
[ 21%] Built target nodelet_topic_tools_gencfg
[ 21%] Built target topic_tools_generate_messages_eus
[ 21%] Built target std_srvs_generate_messages_py
[ 21%] Built target pcl_msgs_generate_messages_cpp
[ 21%] Built target std_srvs_generate_messages_eus
[ 21%] Built target std_srvs_generate_messages_cpp
[ 21%] Built target pcl_msgs_generate_messages_eus
[ 21%] Built target std_srvs_generate_messages_lisp
[ 21%] Built target std_srvs_generate_messages_nodejs
[ 21%] Built target pcl_msgs_generate_messages_nodejs
[ 21%] Built target nav_msgs_generate_messages_py
[ 21%] Built target nav_msgs_generate_messages_cpp
[ 21%] Built target nav_msgs_generate_messages_nodejs
[ 21%] Built target nav_msgs_generate_messages_eus
[ 21%] Built target nav_msgs_generate_messages_lisp
[ 24%] Built target polar_scan_matcher
[ 24%] Built target diagnostic_msgs_generate_messages_cpp
[ 24%] Built target _catkin_empty_exported_target
[ 24%] Built target diagnostic_msgs_generate_messages_eus
[ 24%] Built target diagnostic_msgs_generate_messages_nodejs
[ 24%] Built target diagnostic_msgs_generate_messages_lisp
[ 24%] Built target diagnostic_msgs_generate_messages_py
[ 24%] Built target trajectory_msgs_generate_messages_nodejs
[ 24%] Built target gazebo_ros_gencfg
[ 24%] Built target gazebo_msgs_generate_messages_cpp
[ 24%] Built target trajectory_msgs_generate_messages_py
[ 24%] Built target gazebo_msgs_generate_messages_py
[ 24%] Built target trajectory_msgs_generate_messages_eus
[ 24%] Built target _realsense2_camera_generate_messages_check_deps_IMUInfo
[ 24%] Built target _realsense2_camera_generate_messages_check_deps_Extrinsics
[ 24%] Built target gazebo_msgs_generate_messages_eus
[ 24%] Built target gazebo_msgs_generate_messages_nodejs
[ 24%] Built target trajectory_msgs_generate_messages_lisp
[ 24%] Built target trajectory_msgs_generate_messages_cpp
[ 24%] Built target gazebo_msgs_generate_messages_lisp
[ 27%] Built target laser_scan_splitter
[ 30%] Built target laser_scan_sparsifier
[ 33%] Built target ncd_parser
[ 37%] Built target scan_to_cloud_converter_node
[ 40%] Built target realsense2_camera_generate_messages_cpp
[ 43%] Built target laser_ortho_projector
[ 46%] Built target psm_node
[ 50%] Built target realsense2_camera_generate_messages_lisp
[ 54%] Built target realsense2_camera_generate_messages_eus
[ 57%] Built target realsense2_camera_generate_messages_nodejs
[ 60%] Built target laser_scan_matcher
[ 65%] Built target realsense2_camera_generate_messages_py
[ 68%] Built target laser_scan_sparsifier_node
[ 71%] Built target laser_scan_sparsifier_nodelet
[ 74%] Built target laser_scan_splitter_node
[ 77%] Built target laser_scan_splitter_nodelet
[ 81%] Built target realsense_gazebo_plugin
[ 84%] Built target laser_ortho_projector_node
[ 87%] Built target laser_ortho_projector_nodelet
[ 90%] Built target laser_scan_matcher_nodelet
[ 92%] Building CXX object realsense-ros/realsense2_camera/CMakeFiles/realsense2_camera.dir/src/base_realsense_node.cpp.o
[ 92%] Built target realsense2_camera_generate_messages
[ 95%] Built target laser_scan_matcher_node
In file included from /opt/ros/noetic/include/librealsense2/hpp/rs_sensor.hpp:8,
                 from /opt/ros/noetic/include/librealsense2/hpp/rs_device.hpp:8,
                 from /opt/ros/noetic/include/librealsense2/hpp/rs_record_playback.hpp:8,
                 from /opt/ros/noetic/include/librealsense2/hpp/rs_context.hpp:8,
                 from /opt/ros/noetic/include/librealsense2/rs.hpp:9,
                 from /home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/../include/../include/realsense_node_factory.h:12,
                 from /home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/../include/base_realsense_node.h:6,
                 from /home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp:1:
/opt/ros/noetic/include/librealsense2/hpp/rs_frame.hpp: In lambda function:
/opt/ros/noetic/include/librealsense2/hpp/rs_frame.hpp:1047:58: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
 1047 |                         frm.get_profile().stream_index() == index) f = frm;
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/opt/ros/noetic/include/librealsense2/hpp/rs_frame.hpp: In lambda function:
/opt/ros/noetic/include/librealsense2/hpp/rs_frame.hpp:1069:58: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
 1069 |                         frm.get_profile().stream_index() == index) f = frm;
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/opt/ros/noetic/include/librealsense2/hpp/rs_frame.hpp: In lambda function:
/opt/ros/noetic/include/librealsense2/hpp/rs_frame.hpp:1091:58: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
 1091 |                         frm.get_profile().stream_index() == index) f = frm;
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp: In member function ‘void realsense2_camera::BaseRealSenseNode::publishPointCloud(rs2::points, const ros::Time&, const rs2::frameset&)’:
/home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp:2165:29: error: ‘find_if’ was not declared in this scope
 2165 |         texture_frame_itr = find_if(frameset.begin(), frameset.end(), [&texture_source_id, &available_formats] (rs2::frame f)
      |                             ^~~~~~~
/home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp:2165:29: note: suggested alternatives:
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:39,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /opt/ros/noetic/include/class_loader/class_loader.hpp:36,
                 from /opt/ros/noetic/include/pluginlib/./class_list_macros.hpp:40,
                 from /opt/ros/noetic/include/pluginlib/class_list_macros.h:35,
                 from /home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/../include/../include/realsense_node_factory.h:6,
                 from /home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/../include/base_realsense_node.h:6,
                 from /home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3954:5: note:   ‘std::find_if’
 3954 |     find_if(_InputIterator __first, _InputIterator __last,
      |     ^~~~~~~
In file included from /usr/include/boost/mpl/find.hpp:17,
                 from /usr/include/boost/mpl/aux_/contains_impl.hpp:20,
                 from /usr/include/boost/mpl/contains.hpp:20,
                 from /usr/include/boost/math/policies/policy.hpp:10,
                 from /usr/include/boost/math/policies/error_handling.hpp:21,
                 from /usr/include/boost/math/special_functions/round.hpp:14,
                 from /opt/ros/noetic/include/ros/time.h:58,
                 from /opt/ros/noetic/include/ros/console.h:39,
                 from /opt/ros/noetic/include/nodelet/nodelet.h:40,
                 from /home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/../include/../include/realsense_node_factory.h:7,
                 from /home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/../include/base_realsense_node.h:6,
                 from /home/hello-robot/catkin_ws/src/realsense-ros/realsense2_camera/src/base_realsense_node.cpp:1:
/usr/include/boost/mpl/find_if.hpp:32:8: note:   ‘boost::mpl::find_if’
   32 | struct find_if
      |        ^~~~~~~
make[2]: *** [realsense-ros/realsense2_camera/CMakeFiles/realsense2_camera.dir/build.make:76: realsense-ros/realsense2_camera/CMakeFiles/realsense2_camera.dir/src/base_realsense_node.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4771: realsense-ros/realsense2_camera/CMakeFiles/realsense2_camera.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Invoking "make -j8 -l8" failed
Full tree crawl took 0.021477 seconds.
Directories marked with (*) contain no manifest.  You may
want to delete these directories.
To get just of list of directories without manifests,
re-run the profile with --zombie-only
-------------------------------------------------------------
0.018527   /opt/ros/noetic/share
0.002142   /home/hello-robot/catkin_ws/src
0.001015   /home/hello-robot/catkin_ws/src/stretch_ros
0.000478   /home/hello-robot/catkin_ws/src/scan_tools
0.000159   /home/hello-robot/catkin_ws/src/realsense-ros
0.000095 * /opt/ros/noetic/share/ament_index
0.000060 * /opt/ros/noetic/share/ament_index/resource_index
0.000054 * /opt/ros/noetic/share/apriltag
0.000046 * /opt/ros/noetic/share/man
0.000026 * /home/hello-robot/catkin_ws/src/stretch_ros/images
0.000015 * /opt/ros/noetic/share/apriltag/cmake
0.000014 * /opt/ros/noetic/share/ament_index/resource_index/packages
0.000011 * /opt/ros/noetic/share/man/man1
Copying apt pinning file into standard location
NOTE: Please restart the robot. Then use 'realsense-viewer' to upgrade the camera's firmware to the latest versions.

Any help would be appreciated!

Edit - the tag ID error persists on the Ubuntu 18 + Melodic partition on this machine, but the realsense-viewer is available on the Ubuntu 18 partition. I didn’t run the patch on this partition yet, just in case it breaks here, too.

Hi @lamsey, the patch fails because I had originally written the patch for Ubuntu 18.04. The patch attempts to install an older version of librealsense2, however, this old version number varies slightly between 18.04 and 20.04. Since those packages don’t end up installed in 20.04, the building of realsense-ros fails and the realsense-viewer isn’t available. I’ve just updated the script to be able to downgrade on Ubuntu 20.04 as well, so you should be able to git pull and run it again to apply the patch.

Looking forward, we’re in the early stages of figuring out the root cause behind the degraded Realsense performance. I have a noetic feature branch that addresses most of the errors mentioned in the Realsense Downgrade post on my robot. We are testing this on many robots before releasing it and decommissioning the downgrade patch. If you’re willing to help us with another data point, I can walk you through testing the branch with your software and seeing whether it fixes the degraded performance.

1 Like

Thank you for the reply and patch! The new downgrade script worked out of the box on our system, and everything appears to work normally now. I’m interested in testing the new branch if you’d still like another data point!

Awesome! Here’s how you can test out the new branch:

  1. Remove the patch by running the remove_realsense_downgrade_patch.sh script.
  2. Check out the feature/separated_launch_files branch of Stretch ROS using:
    $ roscd stretch_core
    $ # Save changes if any (e.g. using `git stash`)
    $ git checkout feature/separated_launch_files
    $ cd ~/catkin_ws
    $ catkin_make
    
  3. This experimental branch makes two new launch files available within Stretch Core. The first, stretch_realsense.launch, brings up the ROS Realsense drivers using a new set of parameters that should address the errors mentioned in the Realsense Downgrade post. In your own launch files, you can include this launch file to make the Realsense topics available. The second launch file, stretch_all_drivers.launch, is a convienence launch file for bringing up the realsense, planar lidar, and robot drivers all at once. You might find it more useful to include this launch file instead.

Let me know how using this new launch files goes! I’d be especially interested to hear about any Realsense errors you encounter while using this new branch. Thanks for trying them out!