autowarefoundation / ros2_socketcan

A ROS2 wrapper around Linux SocketCAN
Apache License 2.0
119 stars 57 forks source link

Add can_msgs dependency #16

Closed tonynajjar closed 2 years ago

tonynajjar commented 2 years ago

Without this, building the package fails with error:

/code/ros2_ws/src/ros2_socketcan/include/ros2_socketcan/socket_can_sender_node.hpp:30:10: fatal error: can_msgs/msg/frame.hpp: No such file or directory
   30 | #include <can_msgs/msg/frame.hpp>

I'm on Galactic, Ubuntu 20

kenji-miyake commented 2 years ago

Have you tried rosdep install?

I think the dependency should be automatically found by ament_auto_find_build_dependencies().

tonynajjar commented 2 years ago

Good you mention it, you are right, it works with rosdep install. But I have another setup where I need to build both packages (can_msgs and ros2_socketcan) from source and this fails, feel free to give it a try

kenji-miyake commented 2 years ago

@tonynajjar Do you mean like this? I had no error. :thinking:

$ mkdir /tmp/ws
$ cd /tmp/ws
$ git clone git@github.com:ros-industrial/ros_canopen.git -b dashing-devel
$ git clone git@github.com:autowarefoundation/ros2_socketcan.git
$ docker run --rm -it -v /tmp/ws:/ws ros:galactic
$ cd /ws
$ rosdep install -y --from-paths . --ignore-src --rosdistro $ROS_DISTRO
#All required rosdeps installed successfully
$ colcon build
Starting >>> can_msgs
Finished <<< can_msgs [2.89s]
Starting >>> ros2_socketcan
Finished <<< ros2_socketcan [9.67s]

Summary: 2 packages finished [12.7s]
tonynajjar commented 2 years ago

Can you make sure that ros-ROS_DISTRO-can-msgs is not installed? (e.g sudo apt remove ros-galactic-can-msgs)

tonynajjar commented 2 years ago

Ah I just noticed that you ran rosdep, so can_msgs is certainly installed. I am on a setup where I can not run rosdep and install dependencies with apt. I need to build everything from source -> This should still work theoretically

kenji-miyake commented 2 years ago

I've tested with Docker, and no package was installed by rosdep install, so I believe ros-galactic-can-msgs isn't installed.

Could you create an issue and show me the steps to reproduce your problem?

kenji-miyake commented 2 years ago

(I'm not a maintainer, but) Otherwise, I believe this PR won't be accepted.

tonynajjar commented 2 years ago

I can't seem to reproduce anymore :facepalm: I'll close this for now, I'll work on it later and if I can reproduce I will provide steps. Thanks for your support @kenji-miyake