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/callback_group.hpp:23, from /opt/ros/dashing/include/rclcpp/any_executable.hpp:20, from /opt/ros/dashing/include/rclcpp/memory_strategy.hpp:24, from /opt/ros/dashing/include/rclcpp/memory_strategies.hpp:18, from /opt/ros/dashing/include/rclcpp/executor.hpp:32, from /opt/ros/dashing/include/rclcpp/executors/multi_threaded_executor.hpp:24, from /opt/ros/dashing/include/rclcpp/executors.hpp:21, from /opt/ros/dashing/include/rclcpp/rclcpp.hpp:144, from /home/andrzej/ros_workspaces/ros2_tutorial/src/test/src/member_function_sub.cpp:3: /opt/ros/dashing/include/rclcpp/function_traits.hpp: In instantiation of ‘struct rclcpp::function_traits::function_traits<std::_bind<void (minimalsubscriber::*(minimalsubscriber*,="" std::_placeholder<1="">))(std::shared_ptr<std_msgs::msg::string_<std::allocator<void> > >) const> >’: /opt/ros/dashing/include/rclcpp/subscription_traits.hpp:90:8: required from ‘struct rclcpp::subscription_traits::has_message_type<std::_bind<void (minimalsubscriber::*(minimalsubscriber*,="" std::_placeholder<1="">))(std::shared_ptr<std_msgs::msg::string_<std::allocator<void> > >) const>, void, void, void>’ /opt/ros/dashing/include/rclcpp/node.hpp:239:5: required by substitution of ‘template<class messaget,="" class="" callbackt,="" class="" allocatort,="" class="" subscriptiont=""> std::shared_ptr<subscriptiont> rclcpp::Node::create_subscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<allocatort>&, typename rclcpp::message_memory_strategy::MessageMemoryStrategy<typename rclcpp::subscription_traits::has_message_type<callbackt="">::type, AllocatorT>::SharedPtr) [with MessageT = std_msgs::msg::String_<std::allocator<void> >; CallbackT = std::_Bind<void (minimalsubscriber::*(minimalsubscriber*,="" std::_placeholder<1="">))(std::shared_ptr<std_msgs::msg::string_<std::allocator<void> > >) const>; AllocatorT = std::allocator<void>; SubscriptionT = <missing>]’ /home/andrzej/ros_workspaces/ros2_tutorial/src/test/src/member_function_sub.cpp:14:75: required from here /opt/ros/dashing/include/rclcpp/function_traits.hpp:52:82: error: decltype cannot resolve address of overloaded function typename function_traits<decltype( &functiont::operator())>::arguments="">::type; ^ /opt/ros/dashing/include/rclcpp/function_traits.hpp:57:72: error: decltype cannot resolve address of overloaded function using argument_type = typename std::tuple_element<n, arguments="">::type; ^ /opt/ros/dashing/include/rclcpp/function_traits.hpp:59:95: error: decltype cannot resolve address of overloaded function using return_type = typename function_traits<decltype( &functiont::operator())>::return_type;="" ^="" home="" andrzej="" ros_workspaces="" ros2_tutorial="" src="" test="" src="" member_function_sub.cpp:="" in="" constructor="" ‘minimalsubscriber::minimalsubscriber()’:="" home="" andrzej="" ros_workspaces="" ros2_tutorial="" src="" test="" src="" member_function_sub.cpp:14:75:="" error:="" no="" matching="" function="" for="" call="" to="" ‘minimalsubscriber::create_subscription<std_msgs::msg::string="">(const char [6], int, std::_Bind_helper<false, void="" (minimalsubscriber::*)(std::shared_ptr<std_msgs::msg::string_<std::allocator<void=""> > >) const, MinimalSubscriber, const std::_Placeholder<1>&>::type)’ "topic", 10, std::bind(&MinimalSubscriber::topic_callback, this, _1)); ^ In file included from /opt/ros/dashing/include/rclcpp/executors/single_threaded_executor.hpp:28:0, from /opt/ros/dashing/include/rclcpp/executors.hpp:22, from /opt/ros/dashing/include/rclcpp/rclcpp.hpp:144, from /home/andrzej/ros_workspaces/ros2_tutorial/src/test/src/member_function_sub.cpp:3: /opt/ros/dashing/include/rclcpp/node.hpp:242:3: note: candidate: template<class messaget,="" class="" callbackt,="" class="" allocatort,="" class="" subscriptiont=""> std::shared_ptr<subscriptiont> rclcpp::Node::create_subscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<allocatort>&, typename rclcpp::message_memory_strategy ...
How did you go about the installation?
https://index.ros.org//doc/ros2/Insta...
I followed this tutorial and install ros 2 packages via apt-get install ...
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 usingcolcon
? Did you source the new build withsource install/setup.bash
from base workspace directory?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.