Build error: no matching function for call to ‘get_node_parameters_interface_from_pointer‘

asked 2020-11-17 04:46:12 -0600

runtao gravatar image

updated 2020-11-19 12:04:21 -0600

Hi, I'm trying to modify the code of rclcpp/reate_subscription.hpp to make the topic statistics configurable via Parameters. After the modification I rebuilt the nodes successfully in Topic Statistics Tutorial which includes create_subscription.hpp and run as expected. Here is what I added in the rclcpp/reate_subscription.hpp.

#include "rclcpp/node_interfaces/get_node_topics_interface.hpp" //original
#include "rclcpp/node_interfaces/get_node_parameters_interface.hpp" //added in line 29
...
using rclcpp::node_interfaces::get_node_topics_interface; //original
auto node_topics = get_node_topics_interface(std::forward<NodeT>(node)); //original

using rclcpp::node_interfaces::get_node_parameters_interface; //added in line 101
auto node_parameters = get_node_parameters_interface(std::forward<NodeT>(node)); //added in line 102

But when I tried with colcon build to test rclcpp for a pull request, it shows the following error. What I don't understand is,

  1. I just included and used get_node_parameters_interface in the same way as the get_node_topics_interface used in the original create_subscription.hpp file, how could it fail?
  2. Why building other packages which includes rclcpp/create_subscription.hpp works properly, but building rclcpp alone fails?

Thanks!

runtao@runtao-ubuntu:~/ros2_foxy/src/ros2/rclcpp/rclcpp$ colcon build
Starting >>> rclcpp  
--- stderr: rclcpp                               
In file included from /home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/include/rclcpp/create_subscription.hpp:29,
                 from /home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/include/rclcpp/node_impl.hpp:42,
                 from /home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/include/rclcpp/node.hpp:1221,
                 from /home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/src/rclcpp/time_source.cpp:27:
/home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/build/rclcpp/include/rclcpp/node_interfaces/get_node_parameters_interface.hpp: In instantiation of ‘std::shared_ptr<rclcpp::node_interfaces::NodeParametersInterface> rclcpp::node_interfaces::get_node_parameters_interface(NodeType&&) [with NodeType = std::shared_ptr<rclcpp::node_interfaces::NodeTopicsInterface>&; typename std::enable_if<rcpputils::is_pointer<T>::value, int>::type <anonymous> = 0]’:
/home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/include/rclcpp/create_subscription.hpp:102:55:   required from ‘std::shared_ptr<SubscriptionT> rclcpp::create_subscription(NodeT&&, const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = rosgraph_msgs::msg::Clock_<std::allocator<void> >; CallbackT = std::_Bind<void (rclcpp::TimeSource::*(rclcpp::TimeSource*, std::_Placeholder<1>))(std::shared_ptr<rosgraph_msgs::msg::Clock_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; CallbackMessageT = rosgraph_msgs::msg::Clock_<std::allocator<void> >; SubscriptionT = rclcpp::Subscription<rosgraph_msgs::msg::Clock_<std::allocator<void> >, std::allocator<void> >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<rosgraph_msgs::msg::Clock_<std::allocator<void> >, std::allocator<void> >; NodeT = std::shared_ptr<rclcpp::node_interfaces::NodeTopicsInterface>&; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<rosgraph_msgs::msg::Clock_<std::allocator<void> >, std::allocator<void> > >]’
/home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/src/rclcpp/time_source.cpp:232:3:   required from here
/home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/build/rclcpp/include/rclcpp/node_interfaces/get_node_parameters_interface.hpp:75:60: error: no matching function for call to ‘get_node_parameters_interface_from_pointer(std::shared_ptr<rclcpp::node_interfaces::NodeTopicsInterface>&)’
   75 |   return detail::get_node_parameters_interface_from_pointer(node);
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/build/rclcpp/include/rclcpp/node_interfaces/get_node_parameters_interface.hpp:53:1: note: candidate: ‘template<class NodeType, typename std::enable_if<rclcpp::node_interfaces::has_node_parameters_interface<typename rcpputils::remove_pointer<T>::type>::value, int>::type <anonymous> > std::shared_ptr<rclcpp::node_interfaces::NodeParametersInterface> rclcpp::node_interfaces::detail::get_node_parameters_interface_from_pointer(NodeType)’
   53 | get_node_parameters_interface_from_pointer(NodeType node_pointer)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runtao/ros2_foxy/src/ros2/rclcpp/rclcpp/build/rclcpp/include/rclcpp/node_interfaces/get_node_parameters_interface.hpp:53:1: note:   template argument deduction/substitution failed:
/home/runtao ...
(more)
edit retag flag offensive close merge delete