Errors when building zed-ros2-wrapper

Hello,

I have been trying for a couple days to get the ros2-wrapper to build and I keep running into the same error.

Starting >>> zed_components
— stderr: zed_components
CMake Error at CMakeLists.txt:129 (find_package):
By not providing “Findnmea_msgs.cmake” in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
“nmea_msgs”, but CMake did not find one.

Could not find a package configuration file provided by “nmea_msgs” with
any of the following names:

nmea_msgsConfig.cmake
nmea_msgs-config.cmake

Add the installation prefix of “nmea_msgs” to CMAKE_PREFIX_PATH or set
“nmea_msgs_DIR” to a directory containing one of the above files. If
“nmea_msgs” provides a separate development package or SDK, be sure it has
been installed.


Failed <<< zed_components [2.47s, exited with code 1]

I have verified that nmea-msgs is infact installed. If I manually add the line:
set(nmea_msgs_DIR "path/to/nmea-msgs/cmake)
in the file zed_components/CMakeLists.txt

then it will get past this error and I will get the same error but with geographic_msgs instead

I then manually add the path and it will pass only to get stuck at another library.

After manually fixing the paths to nmea-msgs, geographic-msgs, diagnostic-updater, and robot-localization it finally gets past zed_components only to get stuck on the same error when building the zed_wrapper package.

What am I doing wrong? I have followed the instructions listed here exactly: Getting Started with ROS 2 and ZED - Stereolabs

I built ros2-humble from src and verified it is working. I am on ubuntu-22, zed-sdk-4

Any help is really appreciated.

Thanks,
Benjamin

Hi @benjaminjohnson
Welcome to the Stereolabs community.

Did you follow this guide step-by-step?
The most important command for you is
rosdep install --from-paths src --ignore-src -r -y
that will automatically install all the dependencies.

It is also important that you correctly set the environment variables to make the compiler find all the required packages:

echo source $(pwd)/install/local_setup.bash >> ~/.bashrc
source ~/.bashrc

Hello @Myzhar .

Thank you for the welcome.

Yes I did follow those instructions. I always came to the same error related to nmea-msgs. After much digging I found something that said to run rosdep check. I did so and the output was as follows:

System dependencies have not been satisfied:
apt ros-humble-ament-lint-auto
apt ros-humble-ament-cmake-copyright
apt ros-humble-ament-cmake-cppcheck
apt ros-humble-ament-cmake-lint-cmake
apt ros-humble-ament-cmake-pep257
apt ros-humble-ament-cmake-uncrustify
apt ros-humble-ament-cmake-xmllint
apt ros-humble-stereo-msgs
apt ros-humble-launch-ros
apt ros-humble-shape-msgs
ERROR[zed_ros2]: Cannot locate rosdep definition for [zed_wrapper]
rosdep key : zed_wrapper
OS name : ubuntu
OS version : jammy
Data:

ERROR[zed_components]: Cannot locate rosdep definition for [zed_interfaces]
rosdep key : zed_interfaces
OS name : ubuntu
OS version : jammy
Data:

ERROR[zed_wrapper]: Cannot locate rosdep definition for [zed_components]
rosdep key : zed_components
OS name : ubuntu
OS version : jammy
Data:

So it seems there were some dependencies that were not being installed. I manually installed the missing dependencies but that also did not help. In fact now I get a warning when trying to build the zed-wrapper so maybe I should remove the manually added dependencies?

The output for colcon build is here:

colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release
[1.746s] WARNING:colcon.colcon_ros.prefix_path.ament:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_ros2’ in the environment variable AMENT_PREFIX_PATH doesn’t exist
[1.746s] WARNING:colcon.colcon_ros.prefix_path.ament:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_wrapper’ in the environment variable AMENT_PREFIX_PATH doesn’t exist
[1.755s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_ros2’ in the environment variable CMAKE_PREFIX_PATH doesn’t exist
[1.755s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_wrapper’ in the environment variable CMAKE_PREFIX_PATH doesn’t exist
Starting >>> zed_interfaces
Finished <<< zed_interfaces [4.64s]
Starting >>> zed_components
— stderr: zed_components
CMake Error at CMakeLists.txt:129 (find_package):
By not providing “Findnmea_msgs.cmake” in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
“nmea_msgs”, but CMake did not find one.

Could not find a package configuration file provided by “nmea_msgs” with
any of the following names:

nmea_msgsConfig.cmake
nmea_msgs-config.cmake

Add the installation prefix of “nmea_msgs” to CMAKE_PREFIX_PATH or set
“nmea_msgs_DIR” to a directory containing one of the above files. If
“nmea_msgs” provides a separate development package or SDK, be sure it has
been installed.


Failed <<< zed_components [2.47s, exited with code 1]

Summary: 1 package finished [8.52s]
1 package failed: zed_components
1 package had stderr output: zed_components
2 packages not processed

I am really at a loss here. Any suggestions on how to get past this are welcome.

Thank you!
Benjamin

Hi @benjaminjohnson
what is your Operating System?

I am on Ubuntu 22.04.4

Doesn’t this command solve all your dependency issue?

sudo apt install ros-humble-ament-lint-auto ros-humble-ament-cmake-copyright ros-humble-ament-cmake-cppcheck ros-humble-ament-cmake-lint-cmake ros-humble-ament-cmake-pep257 ros-humble-ament-cmake-uncrustify ros-humble-ament-cmake-xmllint ros-humble-stereo-msgs ros-humble-launch-ros ros-humble-shape-msgs

@Myzhar Sorry if I was not clear.

I did manually install all of those packages. It did not help. It still fails at nmea-msgs (which is installed). However, now it fails with all those warnings I posted in the previous post.

Here is the system info:
Ubuntu 22.04.4
Zed SDK 4
Cuda 11.8
ROS2 Humble

I followed the install instructions here:

# Create your ROS 2 Workspace if you do not have one
mkdir -p ~/ros2_ws/src/
# Move to the `src` folder of the ROS 2 Workspace
cd ~/ros2_ws/src/ 
git clone --recursive https://github.com/stereolabs/zed-ros2-wrapper.git
cd ..
sudo apt update
# Install the required dependencies
rosdep install --from-paths src --ignore-src -r -y
# Build the wrapper
colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release
# Setup the environment variables
echo source $(pwd)/install/local_setup.bash >> ~/.bashrc
source ~/.bashrc

The only difference is my ros2_ws is not in the home directory but in another directory, but this should not matter right?

The output when running the build command is always the same:
[1.766s] WARNING:colcon.colcon_core.prefix_path.colcon:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install’ in the environment variable COLCON_PREFIX_PATH doesn’t exist
[1.766s] WARNING:colcon.colcon_ros.prefix_path.ament:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_ros2’ in the environment variable AMENT_PREFIX_PATH doesn’t exist
[1.766s] WARNING:colcon.colcon_ros.prefix_path.ament:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_wrapper’ in the environment variable AMENT_PREFIX_PATH doesn’t exist
[1.766s] WARNING:colcon.colcon_ros.prefix_path.ament:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_components’ in the environment variable AMENT_PREFIX_PATH doesn’t exist
[1.766s] WARNING:colcon.colcon_ros.prefix_path.ament:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_interfaces’ in the environment variable AMENT_PREFIX_PATH doesn’t exist
[1.776s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_ros2’ in the environment variable CMAKE_PREFIX_PATH doesn’t exist
[1.776s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_wrapper’ in the environment variable CMAKE_PREFIX_PATH doesn’t exist
[1.776s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_components’ in the environment variable CMAKE_PREFIX_PATH doesn’t exist
[1.776s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path ‘/home/benjamin/workspace/projects/computerVision/zedSandbox/lib/ros/install/zed_interfaces’ in the environment variable CMAKE_PREFIX_PATH doesn’t exist
Starting >>> zed_interfaces
Finished <<< zed_interfaces [22.7s]
Starting >>> zed_components
— stderr: zed_components
CMake Error at CMakeLists.txt:129 (find_package):
By not providing “Findnmea_msgs.cmake” in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
“nmea_msgs”, but CMake did not find one.

Could not find a package configuration file provided by “nmea_msgs” with
any of the following names:

nmea_msgsConfig.cmake
nmea_msgs-config.cmake

Add the installation prefix of “nmea_msgs” to CMAKE_PREFIX_PATH or set
“nmea_msgs_DIR” to a directory containing one of the above files. If
“nmea_msgs” provides a separate development package or SDK, be sure it has
been installed.


Failed <<< zed_components [5.64s, exited with code 1]

Summary: 1 package finished [29.7s]
1 package failed: zed_components
1 package had stderr output: zed_components
2 packages not processed

Note that it is failing at nmea-msgs.

I really don’t understand what I am doing wrong.

Thank you!

You can ignore the initial warnings. They are expected because the packages are not yet built and installed.

Your only problem is here:

— stderr: zed_components
CMake Error at CMakeLists.txt:129 (find_package):
By not providing “Findnmea_msgs.cmake” in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
“nmea_msgs”, but CMake did not find one.

Could not find a package configuration file provided by “nmea_msgs” with
any of the following names:

nmea_msgsConfig.cmake
nmea_msgs-config.cmake
Add the installation prefix of “nmea_msgs” to CMAKE_PREFIX_PATH or set
“nmea_msgs_DIR” to a directory containing one of the above files. If
“nmea_msgs” provides a separate development package or SDK, be sure it has
been installed.

This means that the nmea-msgs package is not installed or it’s not correctly installed.

@Myzhar I finally got this to build. I ended up completely removing anything ros related and doing apt remove/clean/ etc… I reinstalled ros-humble from debian packages and for whatever reason this time it worked. I did notice there was a lot more output after the line rosdep install … so there must have been something weird going on that thought the packages were installed, but as you mentioned they were installed incorrectly. Anyway, the demos seem to be working now. Thank you for the support!

Cheers,
Benjamin

1 Like