Home | Tutorials | Wiki | Issues
Ask Your Question
0

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

asked 2019-01-14 06:29:26 -0500

nzlz gravatar image

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_pk...

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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-01-14 12:22:10 -0500

chapulina gravatar image

empty request, possible cause of the error?

I think so, have you tried changing the function so that it has both a request and a response, and then you ignore the request? i.e.

  void GetModelList(
    gazebo_msgs::srv::GetModelList::Request::SharedPtr,
    gazebo_msgs::srv::GetModelList::Response::SharedPtr res);
edit flag offensive delete link more

Comments

That worked, thanks!

nzlz gravatar imagenzlz ( 2019-01-15 05:21:54 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-01-14 06:29:26 -0500

Seen: 70 times

Last updated: Jan 14