0
$\begingroup$

I am trying to run ros2-canopen from VirtualBox in Ubuntu 22.04.03., the host is Windows11. I have installed ros2 following instructions from: https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html,
and downloaded ros2-canopen from: https://ros-industrial.github.io/ros2_canopen/manual/humble/quickstart/installation.html in the workspace's source folder folder ros2_ws/src.

However, when i do colcon build i get the following error message:

/home/a/ros2_ws/src/ros2_canopen/canopen_core/src/node_interfaces/node_canopen_driver.cpp: In member function ‘void ros2_canopen::node_interfaces::NodeCanopenDriver<NODETYPE>::demand_set_master() [with NODETYPE = rclcpp::Node]’:

/home/a/ros2_ws/src/ros2_canopen/canopen_core/src/node_interfaces/node_canopen_driver.cpp:30:32: error: cannot convert ‘rclcpp::QoS’ to ‘const rmw_qos_profile_t&’ {aka ‘const rmw_qos_profile_s&’}

   30 |     init_service_name, rclcpp::QoS(10), client_cbg_);

      |                                ^~~~~~~

      |                                |

      |                                rclcpp::QoS

In file included from /opt/ros/humble/include/rclcpp/rclcpp/node.hpp:1321,

                 from /opt/ros/humble/include/rclcpp/rclcpp/executors/single_threaded_executor.hpp:28,

                 from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:22,

                 from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155,

                 from /home/a/ros2_ws/src/ros2_canopen/canopen_core/include/canopen_core/node_interfaces/node_canopen_driver.hpp:33,

                 from /home/a/ros2_ws/src/ros2_canopen/canopen_core/src/node_interfaces/node_canopen_driver.cpp:14:

/opt/ros/humble/include/rclcpp/rclcpp/node_impl.hpp:127:29: note:   initializing argument 2 of ‘typename rclcpp::Client<ServiceT>::SharedPtr rclcpp::Node::create_client(const string&, const rmw_qos_profile_t&, rclcpp::CallbackGroup::SharedPtr) [with ServiceT = canopen_interfaces::srv::CONode; typename rclcpp::Client<ServiceT>::SharedPtr = std::shared_ptr<rclcpp::Client<canopen_interfaces::srv::CONode> >; std::string = std::__cxx11::basic_string<char>; rmw_qos_profile_t = rmw_qos_profile_s; rclcpp::CallbackGroup::SharedPtr = std::shared_ptr<rclcpp::CallbackGroup>]’

  127 |   const rmw_qos_profile_t & qos_profile,

      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

/home/a/ros2_ws/src/ros2_canopen/canopen_core/src/node_interfaces/node_canopen_driver.cpp: In member function ‘void ros2_canopen::node_interfaces::NodeCanopenDriver<NODETYPE>::demand_set_master() [with NODETYPE = rclcpp_lifecycle::LifecycleNode]’:

/home/a/ros2_ws/src/ros2_canopen/canopen_core/src/node_interfaces/node_canopen_driver.cpp:73:32: error: cannot convert ‘rclcpp::QoS’ to ‘const rmw_qos_profile_t&’ {aka ‘const rmw_qos_profile_s&’}

   73 |     init_service_name, rclcpp::QoS(10), client_cbg_);

      |                                ^~~~~~~

      |                                |

      |                                rclcpp::QoS

In file included from /opt/ros/humble/include/rclcpp_lifecycle/rclcpp_lifecycle/lifecycle_node.hpp:996,

                 from /home/a/ros2_ws/src/ros2_canopen/canopen_core/include/canopen_core/node_interfaces/node_canopen_driver.hpp:34,

                 from /home/a/ros2_ws/src/ros2_canopen/canopen_core/src/node_interfaces/node_canopen_driver.cpp:14:

/opt/ros/humble/include/rclcpp_lifecycle/rclcpp_lifecycle/lifecycle_node_impl.hpp:103:29: note:   initializing argument 2 of ‘typename rclcpp::Client<ServiceT>::SharedPtr rclcpp_lifecycle::LifecycleNode::create_client(const string&, const rmw_qos_profile_t&, rclcpp::CallbackGroup::SharedPtr) [with ServiceT = canopen_interfaces::srv::CONode; typename rclcpp::Client<ServiceT>::SharedPtr = std::shared_ptr<rclcpp::Client<canopen_interfaces::srv::CONode> >; std::string = std::__cxx11::basic_string<char>; rmw_qos_profile_t = rmw_qos_profile_s; rclcpp::CallbackGroup::SharedPtr = std::shared_ptr<rclcpp::CallbackGroup>]’

  103 |   const rmw_qos_profile_t & qos_profile,

      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

gmake[2]: *** [CMakeFiles/node_canopen_driver.dir/build.make:76: CMakeFiles/node_canopen_driver.dir/src/node_interfaces/node_canopen_driver.cpp.o] Error 1

gmake[2]: *** Waiting for unfinished jobs....

gmake[1]: *** [CMakeFiles/Makefile2:211: CMakeFiles/node_canopen_driver.dir/all] Error 2

gmake[1]: *** Waiting for unfinished jobs....

gmake: *** [Makefile:146: all] Error 2

---

Failed   <<< canopen_core [8.31s, exited with code 2]



Summary: 5 packages finished [26.2s]

  1 package failed: canopen_core

  2 packages had stderr output: canopen_core lely_core_libraries

  8 packages not processed
$\endgroup$

2 Answers 2

0
$\begingroup$

I believe user37925 is indicating that you're working with the incorrect branch and suggests switching from the 'master' branch to the 'humble' branch.

Alternatively, you can create a new, clean workspace and when cloning the ros2_canopen use the following commands in src directory:

  1. git clone -b humble https://github.com/ros-industrial/ros2_canopen.git
  2. cd ..
  3. rosdep install --from-paths src/ros2_canopen --ignore-src -r -y
  4. colcon build
$\endgroup$
1
  • $\begingroup$ This fixed it, thank you $\endgroup$
    – user37739
    Commented Jan 9 at 10:58
-1
$\begingroup$

/home/a/ros2_ws/src/ros2_canopen/ git checkout humble cd /home/a/ros2_ws colcon build

$\endgroup$
1
  • $\begingroup$ Please edit and add an explanation $\endgroup$ Commented Jan 2 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.