Robotics StackExchange | Archived questions

ros2 minimal_subscriber - member function

Hey, so I'm using ros2 dashing and I am trying to run the example from ros2/examples link text and I am getting this error:

Blockquote In file included from /opt/ros/dashing/include/rclcpp/client.hpp:31:0, from /opt/ros/dashing/include/rclcpp/callbackgroup.hpp:23, from /opt/ros/dashing/include/rclcpp/anyexecutable.hpp:20, from /opt/ros/dashing/include/rclcpp/memorystrategy.hpp:24, from /opt/ros/dashing/include/rclcpp/memorystrategies.hpp:18, from /opt/ros/dashing/include/rclcpp/executor.hpp:32, from /opt/ros/dashing/include/rclcpp/executors/multithreadedexecutor.hpp:24, from /opt/ros/dashing/include/rclcpp/executors.hpp:21, from /opt/ros/dashing/include/rclcpp/rclcpp.hpp:144, from /home/andrzej/rosworkspaces/ros2tutorial/src/test/src/memberfunctionsub.cpp:3: /opt/ros/dashing/include/rclcpp/functiontraits.hpp: In instantiation of ‘struct rclcpp::functiontraits::functiontraits<std::Bind))(std::sharedptr<stdmsgs::msg::Stringstd::allocator<void > >) const> >’: /opt/ros/dashing/include/rclcpp/subscriptiontraits.hpp:90:8: required from ‘struct rclcpp::subscriptiontraits::hasmessagetype<std::Bind))(std::sharedptr<stdmsgs::msg::Stringstd::allocator<void > >) const>, void, void, void>’ /opt/ros/dashing/include/rclcpp/node.hpp:239:5: required by substitution of ‘template std::sharedptr rclcpp::Node::createsubscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator&, typename rclcpp::messagememorystrategy::MessageMemoryStrategy<typename rclcpp::subscriptiontraits::hasmessagetype::type, AllocatorT>::SharedPtr) [with MessageT = stdmsgs::msg::Stringstd::allocator<void >; CallbackT = std::Bind<void (MinimalSubscriber::(MinimalSubscriber, std::Placeholder<1>))(std::sharedptr<stdmsgs::msg::Stringstd::allocator<void > >) const>; AllocatorT = std::allocator; SubscriptionT = ]’ /home/andrzej/rosworkspaces/ros2tutorial/src/test/src/memberfunctionsub.cpp:14:75: required from here /opt/ros/dashing/include/rclcpp/functiontraits.hpp:52:82: error: decltype cannot resolve address of overloaded function typename functiontraits::arguments>::type; ^ /opt/ros/dashing/include/rclcpp/functiontraits.hpp:57:72: error: decltype cannot resolve address of overloaded function using argumenttype = typename std::tupleelement::type; ^ /opt/ros/dashing/include/rclcpp/functiontraits.hpp:59:95: error: decltype cannot resolve address of overloaded function using returntype = typename functiontraits::returntype; ^ /home/andrzej/rosworkspaces/ros2tutorial/src/test/src/memberfunctionsub.cpp: In constructor ‘MinimalSubscriber::MinimalSubscriber()’: /home/andrzej/rosworkspaces/ros2tutorial/src/test/src/memberfunctionsub.cpp:14:75: error: no matching function for call to ‘MinimalSubscriber::createsubscription<stdmsgs::msg::String>(const char [6], int, std::Bindhelper > >) const, MinimalSubscriber, const std::Placeholder<1>&>::type)’ "topic", 10, std::bind(&MinimalSubscriber::topiccallback, this, 1)); ^ In file included from /opt/ros/dashing/include/rclcpp/executors/singlethreadedexecutor.hpp:28:0, from /opt/ros/dashing/include/rclcpp/executors.hpp:22, from /opt/ros/dashing/include/rclcpp/rclcpp.hpp:144, from /home/andrzej/rosworkspaces/ros2tutorial/src/test/src/memberfunctionsub.cpp:3: /opt/ros/dashing/include/rclcpp/node.hpp:242:3: note: candidate: template std::sharedptr rclcpp::Node::createsubscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator&, typename rclcpp::messagememorystrategy::MessageMemoryStrategy<typename rclcpp::subscriptiontraits::hasmessagetype::type, AllocatorT>::SharedPtr) createsubscription( ^~~~~~~~~~~~~~~~~~~ /opt/ros/dashing/include/rclcpp/node.hpp:242:3: note: substitution of deduced template arguments resulted in errors seen above /opt/ros/dashing/include/rclcpp/node.hpp:279:3: note: candidate: template std::sharedptr rclcpp::Node::createsubscription(const string&, CallbackT&&, const rmwqosprofilet&, rclcpp::callbackgroup::CallbackGroup::SharedPtr, bool, typename rclcpp::messagememorystrategy::MessageMemoryStrategy<typename rclcpp::subscriptiontraits::hasmessagetype::type, AllocatorT>::SharedPtr, std::sharedptr) createsubscription( ^~~~~~~~~~~~~~~~~~~ /opt/ros/dashing/include/rclcpp/node.hpp:279:3: note: template argument deduction/substitution failed: /home/andrzej/rosworkspaces/ros2tutorial/src/test/src/memberfunctionsub.cpp:14:29: note: cannot convert ‘std::bind(Func&&, _BoundArgs&& ...) [with Func = void (MinimalSubscriber::*)(std::sharedptr > >) const; BoundArgs = {MinimalSubscriber*, const std::Placeholder<1>&}; typename std::Bindhelperstd::__is_socketlike<_Func::value, Func, _BoundArgs ...>::type = std::Bind))(std::sharedptr<stdmsgs::msg::String_std::allocator<void > >) const>](((MinimalSubscriber*)this), std::placeholders::1)’ (type ‘std::Bindhelper<false, void (MinimalSubscriber::)(std::sharedptr<stdmsgs::msg::Stringstd::allocator<void > >) const, MinimalSubscriber*, const std::Placeholder<1>&>::type {aka std::Bind<void (MinimalSubscriber::(MinimalSubscriber, std::Placeholder<1>))(std::sharedptr<stdmsgs::msg::Stringstd::allocator<void > >) const>}’) to type ‘const rmwqosprofilet&’ "topic", 10, std::bind(&MinimalSubscriber::topiccallback, this, _1)); ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /opt/ros/dashing/include/rclcpp/executors/singlethreadedexecutor.hpp:28:0, from /opt/ros/dashing/include/rclcpp/executors.hpp:22, from /opt/ros/dashing/include/rclcpp/rclcpp.hpp:144, from /home/andrzej/rosworkspaces/ros2tutorial/src/test/src/memberfunctionsub.cpp:3: /opt/ros/dashing/include/rclcpp/node.hpp:316:3: note: candidate: template std::sharedptr rclcpp::Node::createsubscription(const string&, CallbackT&&, sizet, rclcpp::callbackgroup::CallbackGroup::SharedPtr, bool, typename rclcpp::messagememorystrategy::MessageMemoryStrategy<typename rclcpp::subscriptiontraits::hasmessagetype::type, AllocatorT>::SharedPtr, std::sharedptr) createsubscription( ^~~~~~~~~~~~~~~~~~~ /opt/ros/dashing/include/rclcpp/node.hpp:316:3: note: template argument deduction/substitution failed: /home/andrzej/rosworkspaces/ros2tutorial/src/test/src/memberfunctionsub.cpp:14:29: note: cannot convert ‘std::bind(Func&&, _BoundArgs&& ...) [with Func = void (MinimalSubscriber::*)(std::sharedptr > >) const; BoundArgs = {MinimalSubscriber*, const std::Placeholder<1>&}; typename std::Bindhelperstd::__is_socketlike<_Func::value, Func, _BoundArgs ...>::type = std::Bind))(std::sharedptr<stdmsgs::msg::String_std::allocator<void > >) const>](((MinimalSubscriber*)this), std::placeholders::1)’ (type ‘std::Bindhelper > >) const, MinimalSubscriber, const std::Placeholder<1>&>::type {aka std::Bind<void (MinimalSubscriber::(MinimalSubscriber, std::Placeholder<1>))(std::sharedptr > >) const>}’) to type ‘sizet {aka long unsigned int}’ "topic", 10, std::bind(&MinimalSubscriber::topiccallback, this, _1)); ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: ** [CMakeFiles/memberfunctionsub.dir/src/memberfunctionsub.cpp.o] Error 1 make[1]: *** [CMakeFiles/memberfunctionsub.dir/all] Error 2

make: *** [all] Error 2

Some thoughts? I read that there was a problem with bind parameters, does it still exist?

Asked by femust on 2019-08-09 13:08:53 UTC

Comments

How did you go about the installation?

Asked by zmk5 on 2019-08-09 14:02:27 UTC

https://index.ros.org//doc/ros2/Installation/Dashing/Linux-Install-Debians/

I followed this tutorial and install ros 2 packages via apt-get install ...

Asked by femust on 2019-08-10 06:09:19 UTC

So you have a binary installation installed and how did you attempt to install this package?

When you downloaded the example how did you go about putting them in a ros2 workspace? It says the C++ file is: /home/andrzej/ros_workspaces/ros2_tutorial/src/test/src/member_function_sub.cpp. Did you build using colcon? Did you source the new build with source install/setup.bash from base workspace directory?

Asked by zmk5 on 2019-08-10 11:45:21 UTC

nah I didn't follow any your advice and it starts magically working, but I did have a similar problem the other day when I was playing with other repo, I will be looking at it, for the time being, the problem is solved. Thank you for your effort.

Asked by femust on 2019-08-11 02:25:31 UTC

Answers

I met the same error. After setting up the local as below, the error disappeared.

sudo locale-gen en_US en_US.UTF-8

sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

export LANG=en_US.UTF-8

But I'm not sure how the local can influence in this error.

Asked by RoboticsYY on 2019-08-15 01:24:49 UTC

Comments