Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rclcpp_minimal_action_client not building #294

Open
TimCraig opened this issue Oct 31, 2020 · 9 comments
Open

rclcpp_minimal_action_client not building #294

TimCraig opened this issue Oct 31, 2020 · 9 comments
Labels
help wanted Extra attention is needed

Comments

@TimCraig
Copy link

TimCraig commented Oct 31, 2020

Bug report`

Required Info:

  • Operating System:
    Ubuntu-MATE 20.04
  • Installation type:
    binaries

Steps to reproduce issue

I've had a problem getting the examples to build for a while. I first thought something had gotten out of sync so I got around to creating a new virtualbox with Windows10 host and Ubuntu-MATE 20.04 client and pristine install of the Foxy binaries. rclcpp_minimal_action_client fails to build. Below is the output from the compiler.

Starting >>> examples_rclcpp_minimal_action_client
--- stderr: examples_rclcpp_minimal_action_client                             
/home/brutus/ros2/examples_ws/src/examples/rclcpp/actions/minimal_action_client/member_functions.cpp: In member function ‘void MinimalActionClient::send_goal()’:
/home/brutus/ros2/examples_ws/src/examples/rclcpp/actions/minimal_action_client/member_functions.cpp:78:71: error: no match for ‘operator=’ (operand types are ‘rclcpp_action::Client<example_interfaces::action::Fibonacci>::GoalResponseCallback’ {aka ‘std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>’} and ‘std::_Bind_helper<false, void (MinimalActionClient::*)(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >), MinimalActionClient*, const std::_Placeholder<1>&>::type’ {aka ‘std::_Bind<void (MinimalActionClient::*(MinimalActionClient*, std::_Placeholder<1>))(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>’})
   78 |       std::bind(&MinimalActionClient::goal_response_callback, this, _1);
      | 
                                                                            ^
In file included from /usr/include/c++/9/functional:59,
                 from /home/brutus/ros2/examples_ws/src/examples/rclcpp/actions/minimal_action_client/member_functions.cpp:17:
/usr/include/c++/9/bits/std_function.h:462:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>& std::function<_Res(_ArgTypes ...)>::operator=(const std::function<_Res(_ArgTypes ...)>&) [with _Res = void; _ArgTypes = {std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >}]’
  462 |       operator=(const function& __x)
      |       ^~~~~~~~
      
/usr/include/c++/9/bits/std_function.h:462:33: note:   no known conversion for argument 1 from ‘std::_Bind_helper<false, void (MinimalActionClient::*)(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >), MinimalActionClient*, const std::_Placeholder<1>&>::type’ {aka ‘std::_Bind<void (MinimalActionClient::*(MinimalActionClient*, std::_Placeholder<1>))(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>’} to ‘const std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>&’
  462 |       operator=(const function& __x)
      |                 ~~~~~~~~~~~~~~~~^~~
      
/usr/include/c++/9/bits/std_function.h:480:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>& std::function<_Res(_ArgTypes ...)>::operator=(std::function<_Res(_ArgTypes ...)>&&) [with _Res = void; _ArgTypes = {std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >}]’
  480 |       operator=(function&& __x) noexcept
      |       ^~~~~~~~
      
/usr/include/c++/9/bits/std_function.h:480:28: note:   no known conversion for argument 1 from ‘std::_Bind_helper<false, void (MinimalActionClient::*)(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >), MinimalActionClient*, const std::_Placeholder<1>&>::type’ {aka ‘std::_Bind<void (MinimalActionClient::*(MinimalActionClient*, std::_Placeholder<1>))(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>’} to ‘std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >)>&&’
  480 |       operator=(function&& __x) noexcept
      |                 ~~~~~~~~~~~^~~
      
/usr/include/c++/9/bits/std_function.h:494:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>& std::function<_Res(_ArgTypes ...)>::operator=(std::nullptr_t) [with _Res = void; _ArgTypes = {std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >}; std::nullptr_t = std::nullptr_t]’
  494 |       operator=(nullptr_t) noexcept
      |       ^~~~~~~~
      
/usr/include/c++/9/bits/std_function.h:494:17: note:   no known conversion for argument 1 from ‘std::_Bind_helper<false, void (MinimalActionClient::*)(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >), MinimalActionClient*, const std::_Placeholder<1>&>::type’ {aka ‘std::_Bind<void (MinimalActionClient::*(MinimalActionClient*, std::_Placeholder<1>))(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>’} to ‘std::nullptr_t’
  494 |       operator=(nullptr_t) noexcept
      |                 ^~~~~~~~~
      
/usr/include/c++/9/bits/std_function.h:523:2: note: candidate: ‘template<class _Functor> std::function<_Res(_ArgTypes ...)>::_Requires<std::function<_Res(_ArgTypes ...)>::_Callable<typename std::decay<_Functor>::type>, std::function<_Res(_ArgTypes ...)>&> std::function<_Res(_ArgTypes ...)>::operator=(_Functor&&) [with _Functor = _Functor; _Res = void; _ArgTypes = {std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> > >}]’
  523 |  operator=(_Functor&& __f)
      |  ^~~~~~~~
      
/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<std::_Bind<void (MinimalActionClient::*(MinimalActionClient*, std::_Placeholder<1>))(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>, std::__invoke_result<std::_Bind<void (MinimalActionClient::*(MinimalActionClient*, std::_Placeholder<1>))(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 = std::_Bind<void (MinimalActionClient::*(MinimalActionClient*, std::_Placeholder<1>))(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>]’
/home/brutus/ros2/examples_ws/src/examples/rclcpp/actions/minimal_action_client/member_functions.cpp:78:71:   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:
/home/brutus/ros2/examples_ws/src/examples/rclcpp/actions/minimal_action_client/member_functions.cpp:78:71: note:   ‘std::_Bind<void (MinimalActionClient::*(MinimalActionClient*, std::_Placeholder<1>))(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)>’ is not derived from ‘std::reference_wrapper<_Tp>’
   78 |       std::bind(&MinimalActionClient::goal_response_callback, this, _1);
      |                                                                       ^
      
make[2]: *** [CMakeFiles/action_client_member_functions.dir/build.make:63: CMakeFiles/action_client_member_functions.dir/member_functions.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:165: CMakeFiles/action_client_member_functions.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< examples_rclcpp_minimal_action_client [3.33s, exited with code 2]
@clalancette
Copy link
Contributor

Which branch of the examples repository are you attempting to build? You have to use the foxy branch to build against Foxy.

@TimCraig
Copy link
Author

TimCraig commented Nov 1, 2020

I'm using what comes with "Download the Zip", I assumed that would be the latest.

@TimCraig
Copy link
Author

TimCraig commented Nov 2, 2020

Ok, figuring out where to get the Foxy version and using it solved the problem. Considering the people interested most in the examples are new to ROS2, a note in in the ReadMe might be useful indicating how to get the right version and that it's important.

@clalancette
Copy link
Contributor

While I wouldn't be opposed to adding a note in the README, this isn't our usual entry point for new users. We usually recommend people start with the tutorials at https://index.ros.org/doc/ros2/Tutorials/#tutorials , which have instructions on how to install the examples from binaries (and generate your own examples).

Just out of curiosity, how did you end up directly at this repository?

@TimCraig
Copy link
Author

TimCraig commented Nov 3, 2020

I don't remember exactly but probably one of my forays looking for real ROS2 example code on github. Just search for ROS2 and filter with recently updated. Installing examples and running them from binaries seems a waste of time for a developer. Taking these examples and learning how to modify them to suit my cases seems to me more productive since documentation is pretty sparse. I think I first grabbed the examples under Dashing and have checked for updates periodically.

@clalancette
Copy link
Contributor

Installing examples and running them from binaries seems a waste of time for a developer.

Yes, that's why the tutorials start with installing from binaries, and then go on to explain how to write your own code (see https://index.ros.org/doc/ros2/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber/, for example).

That all being said, since the examples here are one possible entry point, a change to the README.md to explain that you must build the branch corresponding to your distribution would not be a bad idea. If you'd like to contribute that, I'd be happy to review.

@clalancette clalancette added the help wanted Extra attention is needed label Nov 3, 2020
@TimCraig
Copy link
Author

TimCraig commented Nov 3, 2020

I've written my own pub/sub pair for a real device, service server and client, and action. What I'm looking for lately are the bells and whistles, QoS, error handling, and advance launch details. Right now I'm cooling my heels in Standford's Cancer Clinic waiting for a chemo treatment that is going to put me on my ass for about a week so modifying the README.md won't be in the cards so some time. Any coding probably for that matter. One of the reasons things are going slowly for me.

sloretz added a commit that referenced this issue Dec 22, 2020
sloretz added a commit that referenced this issue Dec 22, 2020
@kilocharlievictor

This comment has been minimized.

@sloretz
Copy link
Contributor

sloretz commented Dec 28, 2020

@kilocharlievictor This doesn't seem related to this issue. Please ask a question on https://answers.ros.org, and when you do please copy/paste the text from the terminal instead of taking a screenshot so others can find it by searching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants