ROS4SPACE / ros2can_bridge

Bridging the CAN Bus to ROS topics based on the socketcan libraries.
Apache License 2.0
89 stars 15 forks source link

Errors when building the package #5

Open mc13756 opened 2 years ago

mc13756 commented 2 years ago

Hello.

I tried to build the package with: colcon build and I get this error:

CMake Error at /opt/ros/foxy/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:229 (message): Packages installing interfaces must include 'rosidl_interface_packages' in their package.xml Call Stack (most recent call first): CMakeLists.txt:15 (rosidl_generate_interfaces)

When I add the <member_of_group>rosidl_interface_packages</member_of_group> in the package.xml of the ros2socketcan_bridge package OR in the package.xml of the can_msgs package I get this errors, that says that the line should not be added:

Error(s):

Then I tried to build only the ros2socketcan_bridge package with colcon: colcon build --packages-select ros2socketcan_bridge, and I get this error:

CMake Error at CMakeLists.txt:22 (find_package): By not providing "Findcan_msgs.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "can_msgs", but CMake did not find one.

Could not find a package configuration file provided by "can_msgs" with any of the following names:

can_msgsConfig.cmake
can_msgs-config.cmake

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

And when I try with the: ament build --only packages ros2socketcan_bridge I get: ament: command not fould. But it should work since colcon is based on the ament library, right?

ghanim-mukhtar commented 2 years ago

So what I did is I added the line <member_of_group>rosidl_interface_packages</member_of_group> in both package.xml files in can_msgs and ros2socketcan_bridge but also updated the lines

<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">

To version 3 as follows:

<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">

Then I built first can_msgs : colcon build --packages-up-to can_msgs And then ros2socketcan_bridge : colcon build --packages-up-to ros2socketcan_bridge

Which overcomes all the issues you have above, but now I am struggling with the absent "service" header :(

KozAAAAA commented 1 year ago

Have you managed to get this to work with colcon? Im stuck with absent service header aswell.

ghanim-mukhtar commented 1 year ago

Yes if your problem is with the can_msg/srv/can_request.hpp included in ros2can_bridge/ros2socketcan_bridge/src/ros2socketcan.h then just remove it and remove the server_ros2can_ which is not used anywhere else.

Isopod00 commented 1 year ago

@ghanim-mukhtar This suggestion of simply deleting the srv include does not work for me, there is more than just the serverros2can that needs can_msg::srv. When I follow your suggestion, I still get errors when building about needed can_msg::srv

pradaap007 commented 2 months ago

CMake Error at /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:229 (message): Packages installing interfaces must include 'rosidl_interface_packages' in their package.xml Call Stack (most recent call first): CMakeLists.txt:17 (rosidl_generate_interfaces) please help me to over this problem Screenshot from 2024-07-07 00-50-08 (2)

Isopod00 commented 2 months ago

CMake Error at /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:229 (message): Packages installing interfaces must include 'rosidl_interface_packages' in their package.xml Call Stack (most recent call first): CMakeLists.txt:17 (rosidl_generate_interfaces) please help me to over this problem Screenshot from 2024-07-07 00-50-08 (2)

We ended up making our own fork of this repo because I couldn't get it to build, in case you are interested in checking it out: https://github.com/GOFIRST-Robotics/ros2socketcan_bridge