[Discourse.ros.org] [Next Generation ROS] How to use namespaces?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Discourse.ros.org] [Next Generation ROS] How to use namespaces?

Dirk Thomas via ros-users


Operating System: Linux Mint = Ubuntu 16.04
Installation type: from source
Version or commit hash: release-beta2
DDS implementation: Fast-RTPS
Client library (if applicable): boost, restcpp

I've read this article http://design.ros2.org/articles/topic_and_service_names.html#fully-qualified-names and generally I realized how namespaces works.

However some practical questions are unclear. Do I need to add namespace manually when I crate a client for the lifecycle service OR system does that for me?

e.g. previously I had
<pre>
communicationNode.createClient<lifecycle_msgs::srv::GetState>(nodeName + "__get_state");
</pre>
in ROS2 beta2 it doesn't work any more  (rclcpp::client::ClientBase::wait_for_service() always ended by timeout).

I tried those options
<pre>
communicationNode.createClient<lifecycle_msgs::srv::GetState>('/' + namespace + '/' + nodeName + "__get_state");
communicationNode.createClient<lifecycle_msgs::srv::GetState>("/rq/" + namespace + '/' + nodeName + "__get_state");
</pre>
none of them doesn't seem to work as well.

Could you hint me what is the right way to call lifecycle "__get_state" service now?





---
[Visit Topic](https://discourse.ros.org/t/how-to-use-namespaces/2236/1) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Discourse.ros.org] [Next Generation ROS] How to use namespaces?

Dirk Thomas via ros-users


Namespaces are expanded for you automatically. You can see some examples here:

https://github.com/ros2/rcl/blob/release-beta2/rcl/test/rcl/test_expand_topic_name.cpp#L131-L158

In your particular case, you might need to know the target node's name and do something like this:

```
communicationNode.createClient("/" + nodeName + "/get_state");
```

But I'm not 100% sure without seeing what you're doing exactly.





---
[Visit Topic](https://discourse.ros.org/t/how-to-use-namespaces/2236/2) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Discourse.ros.org] [Next Generation ROS] How to use namespaces?

Dirk Thomas via ros-users
In reply to this post by Dirk Thomas via ros-users


Yeap. It works this way.
<pre>
communicationNode.createClient("/" + nodeName + "/get_state");
</pre>

I guess it was all about '/' instead of '__' used formerly.

Thank you for prompt response and useful samples.





---
[Visit Topic](https://discourse.ros.org/t/how-to-use-namespaces/2236/3) or reply to this email to respond.


If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
[hidden email]
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <http://lists.ros.org/mailman//options/ros-users>
Loading...