Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No member named get_service_names_and_types_by_node #269

Closed
iKrishneel opened this issue May 28, 2020 · 1 comment
Closed

No member named get_service_names_and_types_by_node #269

iKrishneel opened this issue May 28, 2020 · 1 comment
Labels
invalid This doesn't seem right

Comments

@iKrishneel
Copy link

Bug report

When building the ros1_bridge on the ROS_DISTRO foxy there is a build error
I am using the docker image osrf/ros2:nightly

/home/ros2/foxy/src/ros1_bridge/src/dynamic_bridge.cpp: In lambda function:
/home/ros2/foxy/src/ros1_bridge/src/dynamic_bridge.cpp:708:22: error: ‘using element_type = class rclcpp::Node’ {aka ‘class rclcpp::Node’} has no member named ‘get_service_names_and_types_by_node’; did you mean ‘get_service_names_and_types’?
  708 |           ros2_node->get_service_names_and_types_by_node(pair.first, pair.second);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                      get_service_names_and_types

Even on eloquent banch it seems rclcpp::Node no longer have this function get_service_names_and_types_by_node(x, y)

I am able to fix this issue with the following changes by replacing with

get_service_names_and_types()
/*Return a map of existing service names to list of service types.*/
diff --git a/src/dynamic_bridge.cpp b/src/dynamic_bridge.cpp
index 27da971..74890a9 100644
--- a/src/dynamic_bridge.cpp
+++ b/src/dynamic_bridge.cpp
@@ -698,18 +698,26 @@ int main(int argc, char * argv[])
 
       // collect available services (not clients)
       std::set<std::string> service_names;
+      /*
       std::vector<std::pair<std::string, std::string>> node_names_and_namespaces =
         ros2_node->get_node_graph_interface()->get_node_names_and_namespaces();
       for (auto & pair : node_names_and_namespaces) {
         if (pair.first == ros2_node->get_name() && pair.second == ros2_node->get_namespace()) {
           continue;
         }
+
         std::map<std::string, std::vector<std::string>> services_and_types =
           ros2_node->get_service_names_and_types_by_node(pair.first, pair.second);
         for (auto & it : services_and_types) {
           service_names.insert(it.first);
         }
       }
+    */
+      std::map<std::string, std::vector<std::string>> services_and_types =
+	ros2_node->get_service_names_and_types();
+        for (auto & it : services_and_types) {
+          service_names.insert(it.first);
+        }
 
       auto ros2_services_and_types = ros2_node->get_service_names_and_types();
       std::map<std::string, std::map<std::string, std::string>> active_ros2_services;
@dirk-thomas dirk-thomas added the invalid This doesn't seem right label May 28, 2020
@dirk-thomas
Copy link
Member

dirk-thomas commented May 28, 2020

When building the ros1_bridge on the ROS_DISTRO foxy there is a build error
I am using the docker image osrf/ros2:nightly

In order to build the latest state of the master branch (which includes #267) you need the referenced changes from ros2/rclcpp#1131. Please make sure you have the latest versions, e.g. rclcpp 1.1.0.

Even on eloquent banch it seems rclcpp::Node no longer have this function get_service_names_and_types_by_node(x, y)

The master branch of ros1_bridge is not compatible with ROS Eloquent. You need to use the eloquent branch for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants