Pb to get ROS2 for Ubuntu 20.04

Report crashes, strange behaviour, or apparent bugs
Post Reply
juhel
Posts: 14
Joined: 22 Nov 2020, 23:10

Pb to get ROS2 for Ubuntu 20.04

Post by juhel »

Hi,

I want to use ROS2 with Coppelia V4_6_0_rev18 on Ubuntu 20.04.
First, with the last (yesterday) CoppeliaSim_Edu_V4_6_0_rev18_Ubuntu20_04.tar.xz file, when I uncompress it, I can't find the libsimROS2.so file, there's only the libsimROS.so file.
On the documentation (https://manual.coppeliarobotics.com/en/ros2Tutorial.htm), we can read this :
The general ROS2 functionality in CoppeliaSim is supported via the ROS2 Interface (libsimROS2.so). The Linux distribution should include that file already compiled in CoppeliaSim/compiledROSPlugins,
I can't find the compiledROSPlugins. Normal?

So, I decided to compile it by myself but when I do this :

Code: Select all

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
I've this compilation error :

Code: Select all

/usr/include/c++/9/bits/std_function.h:523:2: note:   template argument deduction/substitution failed:
/usr/include/c++/9/bits/std_function.h: In substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Cond, class _Tp> using _Requires = typename std::enable_if<_Cond::value, _Tp>::type [with _Cond = std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>::_Callable<Plugin::sendGoal(sendGoal_in*, sendGoal_out*)::<lambda(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>, std::__invoke_result<Plugin::sendGoal(sendGoal_in*, sendGoal_out*)::<lambda(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>&, std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > > > >; _Tp = std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>&; _Res = void; _ArgTypes = {std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >}]’:
/usr/include/c++/9/bits/std_function.h:523:2:   required by substitution of ‘template<class _Functor> std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>::_Requires<std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>::_Callable<typename std::decay<_Tp>::type, std::__invoke_result<typename std::decay<_Tp>::type&, std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > > > >, std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>&> std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>::operator=<_Functor>(_Functor&&) [with _Functor = Plugin::sendGoal(sendGoal_in*, sendGoal_out*)::<lambda(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>]’
/home/phil/ros2_ws/build/sim_ros2_interface/generated/actcli_sendGoal.cpp:17:9:   required from here
/usr/include/c++/9/bits/std_function.h:385:8: error: no type named ‘type’ in ‘struct std::enable_if<false, std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>&>’
  385 |  using _Requires = typename enable_if<_Cond::value, _Tp>::type;
      |        ^~~~~~~~~
/usr/include/c++/9/bits/std_function.h:532:2: note: candidate: ‘template<class _Functor> std::function<_Res(_ArgTypes ...)>& std::function<_Res(_ArgTypes ...)>::operator=(std::reference_wrapper<_Functor>) [with _Functor = _Functor; _Res = void; _ArgTypes = {std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >}]’
  532 |  operator=(reference_wrapper<_Functor> __f) noexcept
      |  ^~~~~~~~
/usr/include/c++/9/bits/std_function.h:532:2: note:   template argument deduction/substitution failed:
In file included from /home/phil/ros2_ws/src/simROS2/src/sim_ros2_interface.cpp:507:
/home/phil/ros2_ws/build/sim_ros2_interface/generated/actcli_sendGoal.cpp:17:9: note:   ‘Plugin::sendGoal(sendGoal_in*, sendGoal_out*)::<lambda(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>’ is not derived from ‘std::reference_wrapper<_Tp>’
   17 |         };
      |         ^
make[2]: *** [CMakeFiles/simROS2.dir/build.make:166: CMakeFiles/simROS2.dir/src/sim_ros2_interface.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:79: CMakeFiles/simROS2.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< sim_ros2_interface [30.9s, exited with code 2]

Summary: 1 package finished [32.1s]
  1 package failed: sim_ros2_interface
  1 package had stderr output: sim_ros2_interface
  1 package not processed
How can I correct this error?

The best solution should be to have libsimROS.so and libsimROS2.so, both in the same Coppelia distribution. Is it possible?

Bug on documentation : the 3 first links for https://manual.coppeliarobotics.com/en/ros2Tutorial.htm are broken.

Regards,

Philippe

fferri
Posts: 1297
Joined: 09 Sep 2013, 19:28

Re: Pb to get ROS2 for Ubuntu 20.04

Post by fferri »

Hi,

the reason of the missing plugin is related to the compatibility of ROS / ROS2 releases and the various Ubuntu releases: ROS 2 Foxy (which supported Ubuntu 20.04) is EOL. The next currently supported ROS 2 LTS release is ROS 2 Humble, and that one requires Ubuntu 22.04.

Indeed, CoppeliaSim for Ubuntu 22.04 has the ROS 2 plugin binary.

juhel
Posts: 14
Joined: 22 Nov 2020, 23:10

Re: Pb to get ROS2 for Ubuntu 20.04

Post by juhel »

I copy the libsimROS2.so form the Ubuntu 22.04 Coppelia tar file into the Ubuntu 20.04 Coppelia folder and it works.

Thank you,

Philippe

Post Reply