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::SharedPtr rclcpp::create_service(std::shared_ptr, std::shared_ptr, const string&, CallbackT&&, const rmw_qos_profile_t&, rclcpp::callback_group::CallbackGroup::SharedPtr) [with ServiceT = gazebo_msgs::srv::GetModelList; CallbackT = std::_Bind))(std::shared_ptr>>)>; typename rclcpp::Service::SharedPtr = std::shared_ptr>; std::__cxx11::string = std::__cxx11::basic_string; rmw_qos_profile_t = rmw_qos_profile_t; rclcpp::callback_group::CallbackGroup::SharedPtr = std::shared_ptr]’:
/opt/ros/crystal/include/rclcpp/node_impl.hpp:201:53: required from ‘typename rclcpp::Service::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))(std::shared_ptr>>)>; typename rclcpp::Service::SharedPtr = std::shared_ptr>; std::__cxx11::string = std::__cxx11::basic_string; rmw_qos_profile_t = rmw_qos_profile_t; rclcpp::callback_group::CallbackGroup::SharedPtr = std::shared_ptr]’
/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::set(std::_Bind))(std::shared_ptr>>)>)’
any_service_callback.set(std::forward(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>>, std::shared_ptr>>)>>::value, void>::type* > void rclcpp::AnyServiceCallback::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if, std::shared_ptr)>>::value>::type* = ; 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’
>::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, std::shared_ptr>>, std::shared_ptr>>)>>::value, void>::type* > void rclcpp::AnyServiceCallback::set(CallbackT) [with CallbackT = CallbackT; typename std::enable_if, std::shared_ptr, std::shared_ptr)>>::value>::type* = ; 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’
>::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
↧