Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

no matching function for call to ‘rclcpp::AnyServiceCallback<gazebo_msgs::srv::getmodellist>::set

I am porting get_world_properties to ros2 with the name get_model_list, and I am facing the following error in the updated gazebo_ros_factory.cpp.

The new update mainly contains a new GetModelList.srv (empty request, possible cause of the error?) and a GetModelList function in the gazebo_ros_factory plugin. I suspect the error is somewhere in the creation of the new service (model_list_service_ = ros_node_->create_service .......).

The whole code is available at: https://github.com/nzlz/gazebo_ros_pkgs/tree/ros2_get_model_list

Thanks in advance!

Error:

nestor@n-pc:~/gz_ws_ros2$ colcon build --merge-install --packages-select gazebo_ros
Starting >>> gazebo_ros
--- stderr: gazebo_ros                             
In file included from /opt/ros/crystal/include/rclcpp/node_impl.hpp:42:0,
                 from /opt/ros/crystal/include/rclcpp/node.hpp:492,
                 from /opt/ros/crystal/include/rclcpp/executors/single_threaded_executor.hpp:28,
                 from /opt/ros/crystal/include/rclcpp/executors.hpp:22,
                 from /opt/ros/crystal/include/rclcpp/rclcpp.hpp:144,
                 from /home/nestor/gz_ws_ros2/src/gazebo_ros_pkgs/gazebo_ros/include/gazebo_ros/node.hpp:18,
                 from /home/nestor/gz_ws_ros2/src/gazebo_ros_pkgs/gazebo_ros/src/gazebo_ros_factory.cpp:28:
/opt/ros/crystal/include/rclcpp/create_service.hpp: In instantiation of ‘typename rclcpp::Service<ServiceT>::SharedPtr rclcpp::create_service(std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeServicesInterface>, const string&, CallbackT&&, const rmw_qos_profile_t&, rclcpp::callback_group::CallbackGroup::SharedPtr) [with ServiceT = gazebo_msgs::srv::GetModelList; CallbackT = std::_Bind<void (gazebo_ros::GazeboRosFactoryPrivate::*(gazebo_ros::GazeboRosFactoryPrivate*, std::_Placeholder<2>))(std::shared_ptr<gazebo_msgs::srv::GetModelList_Response_<std::allocator<void> > >)>; typename rclcpp::Service<ServiceT>::SharedPtr = std::shared_ptr<rclcpp::Service<gazebo_msgs::srv::GetModelList> >; std::__cxx11::string = std::__cxx11::basic_string<char>; rmw_qos_profile_t = rmw_qos_profile_t; rclcpp::callback_group::CallbackGroup::SharedPtr = std::shared_ptr<rclcpp::callback_group::CallbackGroup>]’:
/opt/ros/crystal/include/rclcpp/node_impl.hpp:201:53:   required from ‘typename rclcpp::Service<ServiceT>::SharedPtr rclcpp::Node::create_service(const string&, CallbackT&&, const rmw_qos_profile_t&, rclcpp::callback_group::CallbackGroup::SharedPtr) [with ServiceT = gazebo_msgs::srv::GetModelList; CallbackT = std::_Bind<void (gazebo_ros::GazeboRosFactoryPrivate::*(gazebo_ros::GazeboRosFactoryPrivate*, std::_Placeholder<2>))(std::shared_ptr<gazebo_msgs::srv::GetModelList_Response_<std::allocator<void> > >)>; typename rclcpp::Service<ServiceT>::SharedPtr = std::shared_ptr<rclcpp::Service<gazebo_msgs::srv::GetModelList> >; std::__cxx11::string = std::__cxx11::basic_string<char>; rmw_qos_profile_t = rmw_qos_profile_t; rclcpp::callback_group::CallbackGroup::SharedPtr = std::shared_ptr<rclcpp::callback_group::CallbackGroup>]’
/home/nestor/gz_ws_ros2/src/gazebo_ros_pkgs/gazebo_ros/src/gazebo_ros_factory.cpp:141:29:   required from here
/opt/ros/crystal/include/rclcpp/create_service.hpp:43:3: error: no matching function for call to ‘rclcpp::AnyServiceCallback<gazebo_msgs::srv::GetModelList>::set(std::_Bind<void (gazebo_ros::GazeboRosFactoryPrivate::*(gazebo_ros::GazeboRosFactoryPrivate*, std::_Placeholder<2>))(std::shared_ptr<gazebo_msgs::srv::GetModelList_Response_<std::allocator<void> > >)>)’
   any_service_callback.set(std::forward<CallbackT>(callback));
   ^~~~~~~~~~~~~~~~~~~~
In file included from /opt/ros/crystal/include/rclcpp/service.hpp:27:0,
                 from /opt/ros/crystal/include/rclcpp/callback_group.hpp:24,
                 from /opt/ros/crystal/include/rclcpp/any_executable.hpp:20,
                 from /opt/ros/crystal/include/rclcpp/memory_strategy.hpp:24,
                 from /opt/ros/crystal/include/rclcpp/memory_strategies.hpp:18,
                 from /opt/ros/crystal/include/rclcpp/executor.hpp:32,
                 from /opt/ros/crystal/include/rclcpp/executors/multi_threaded_executor.hpp:24,
                 from /opt/ros/crystal/include/rclcpp/executors.hpp:21,
                 from /opt/ros/crystal/include/rclcpp/rclcpp.hpp:144,
                 from /home/nestor/gz_ws_ros2/src/gazebo_ros_pkgs/gazebo_ros/include/gazebo_ros/node.hpp:18,
                 from /home/nestor/gz_ws_ros2/src/gazebo_ros_pkgs/gazebo_ros/src/gazebo_ros_factory.cpp:28:
/opt/ros/crystal/include/rclcpp/any_service_callback.hpp:65:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<gazebo_msgs::srv::GetModelList_Request_<std::allocator<void> > >, std::shared_ptr<gazebo_msgs::srv::GetModelList_Response_<std::allocator<void> > >)> >::value, void>::type* <anonymous> > void rclcpp::AnyServiceCallback<ServiceT>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<typename ServiceT::Request>, std::shared_ptr<typename ServiceT::Response>)> >::value>::type* <anonymous> = <enumerator>; ServiceT = gazebo_msgs::srv::GetModelList]
   void set(CallbackT callback)
        ^~~
/opt/ros/crystal/include/rclcpp/any_service_callback.hpp:65:8: note:   template argument deduction/substitution failed:
/opt/ros/crystal/include/rclcpp/any_service_callback.hpp:63:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
     >::type * = nullptr
                 ^~~~~~~
/opt/ros/crystal/include/rclcpp/any_service_callback.hpp:63:17: note: invalid template non-type parameter
/opt/ros/crystal/include/rclcpp/any_service_callback.hpp:79:8: note: candidate: template<class CallbackT, typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<rmw_request_id_t>, std::shared_ptr<gazebo_msgs::srv::GetModelList_Request_<std::allocator<void> > >, std::shared_ptr<gazebo_msgs::srv::GetModelList_Response_<std::allocator<void> > >)> >::value, void>::type* <anonymous> > void rclcpp::AnyServiceCallback<ServiceT>::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if<rclcpp::function_traits::same_arguments<CallbackT, std::function<void(std::shared_ptr<rmw_request_id_t>, std::shared_ptr<typename ServiceT::Request>, std::shared_ptr<typename ServiceT::Response>)> >::value>::type* <anonymous> = <enumerator>; ServiceT = gazebo_msgs::srv::GetModelList]
   void set(CallbackT callback)
        ^~~
/opt/ros/crystal/include/rclcpp/any_service_callback.hpp:79:8: note:   template argument deduction/substitution failed:
/opt/ros/crystal/include/rclcpp/any_service_callback.hpp:77:17: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
     >::type * = nullptr
                 ^~~~~~~
/opt/ros/crystal/include/rclcpp/any_service_callback.hpp:77:17: note: invalid template non-type parameter
make[2]: *** [CMakeFiles/gazebo_ros_factory.dir/src/gazebo_ros_factory.cpp.o] Error 1
make[1]: *** [CMakeFiles/gazebo_ros_factory.dir/all] Error 2
make: *** [all] Error 2
---
Failed   <<< gazebo_ros [ Exited with code 2 ]

Summary: 0 packages finished [9.66s]
  1 package failed: gazebo_ros
  1 package had stderr output: gazebo_ros