autowarefoundation / ros2_socketcan

A ROS2 wrapper around Linux SocketCAN
Apache License 2.0
117 stars 60 forks source link

Missing header file #47

Open TheLisiak opened 5 months ago

TheLisiak commented 5 months ago

Screenshot from 2024-05-14 16-40-54 I can not build a package because of this error. I tried to update the dependencies via rosdep, but did not help.

ROS2 Humble Ubuntu 22.04

TheLisiak commented 5 months ago

I solve it. I found the solution in this post: https://answers.ros.org/question/375690/fatal-error-can_msgsmsgframehpp-no-such-file-or-directory/

At the time of creating the issue ticket, ros answers were unavailable for some technical problem. For the future, I am adding a transcript of the answers.

You need to install the can_msgs package to your ros workspace.

sudo apt install ros-$ROS_DISTRO-can-msgs

source /opt/ros/$ROS_DISTRO/setup.bash

Make sure to clean up your local ros workspace (i.e. remove build/ install/ log/) before colcon build.

To see all the packages you have installed to your machine:

ls /opt/ros/$ROS_DISTRO/include/ and ls /opt/ros/$ROS_DISTRO/share.

Another comment suggesting this:

I encountered the same issue when trying to build the ros2_socketcan. Manually adding find_package(can_msgs REQUIRED)to the CMake list of the package solved the issue for me (Ubuntu 22.04, ROS Humble Desktop Docker).