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

Topics & Services #4610

Open
PeymanAmirii opened this issue Aug 10, 2024 · 6 comments
Open

Topics & Services #4610

PeymanAmirii opened this issue Aug 10, 2024 · 6 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@PeymanAmirii
Copy link

PeymanAmirii commented Aug 10, 2024

Hi.
I have read and used the commands mentioned in the tutorial of ROS2 Iron for topics and services. The following suggestions came to my mind which make the commands for topics and services more rememberable and consistent.

For topics:

  1. It is beneficial to create the command of ros2 topic find <topic_type> like what we have for services as ros2 service find <setvice_type> which finds all the services of a specific type.

  2. The command ros2 topic info <topic_name> just shows the number of publishers and subscribers. It is beneficial to mention on the tutorial that by using the option --verbose, the command lists the names of publisher and subscriber nodes of a topic, as well. Like the command ros2 node info <node_name> which lists the names of all the topics, services, and actions connected to a node.

For services:
3. It is beneficial to create the command of ros2 service info <service_name> like what we have for topics as ros2 topic info <topic_name> which shows the number of publishers and subscribers of a topic. Additionally, it is useful if the proposed command lists the name of service and client nodes connected to the service.

For nodes:
4. It is useful to add an option to the command ros2 node info <node_name> to show the namespace of the node.

Best wishes,
Peyman

@fujitatomoya
Copy link
Collaborator

It is beneficial to create the command of ros2 topic find <topic_type> like what we have for services as ros2 service find <setvice_type> which finds all the services of a specific type.

ros2 topic fine already does this as following.

# Terminal-1
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 run demo_nodes_cpp talker
...
# Terminal-2
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 topic pub -r 1 /greetings std_msgs/msg/String "{data: 'Hello from terminal'}"
...
# Terminal-3
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 topic find std_msgs/msg/String
/chatter
/greetings

The command ros2 topic info <topic_name> just shows the number of publishers and subscribers. It is beneficial to mention on the tutorial that by using the option --verbose

probably we do not want to mention all options, so we could add something like see more options with --help for the tutorial.

It is beneficial to create the command of ros2 service info <service_name> like what we have for topics as ros2 topic info <topic_name> which shows the number of publishers and subscribers of a topic.

we already have this in rolling and jazzy with ros2/ros2cli#771, not available on iron or humble.

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 service info /add_two_ints
Type: example_interfaces/srv/AddTwoInts
Clients count: 0
Services count: 1

verbose option: ros2/ros2cli#916 is W.I.P.

It is useful to add an option to the command ros2 node info <node_name> to show the namespace of the node.

i do not really understand the requirement here, can you elaborate a bit?
user should already know the namespace when calling this command since <node_name> requires namespace.
otherwise, Unable to find node '<node_name>' will return.

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 node info talker
Unable to find node 'talker'
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 node info /talker
/talker
  Subscribers:
    /parameter_events: rcl_interfaces/msg/ParameterEvent
...

@PeymanAmirii
Copy link
Author

PeymanAmirii commented Aug 21, 2024

Hi Fujitatomoya,
Thanks for your reply.

ros2 topic fine already does this as following.

I checked ros2 topic find <topic_type> and yes, it exists. But nothing about it has been mentioned on the topic tutorial of ROS2 Iron at:
https://docs.ros.org/en/iron/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.html
Please add it.

probably we do not want to mention all options, so we could add something like see more options with --help for the tutorial.

Yes, please add this explanation for all distributions.

we already have this in rolling and jazzy with ros2/ros2cli#771, not available on iron or humble.

Good to hear that it has been added for the newer version.

i do not really understand the requirement here, can you elaborate a bit?
user should already know the namespace when calling this command since <node_name> requires namespace.

node name and node namespace are two different things. For example, when we want to run a create a node, we can use the following command to run a node with a specific node name and namespace. For example, the command ros2 run turtlesim turtlesim_node --ros-args -r __node:=AA -r __ns:=/bb creates a node with the name AA and namespace /bb.
However, the command ros2 node info <node_name>, does not show the node namespace.

Best wishes,
Peyman

@fujitatomoya
Copy link
Collaborator

we can use the following command to run a node with a specific node name and namespace.

can you share the following command?

the command ros2 node info <node_name>

do you mean it should print <fully qualified node name> instead?

@PeymanAmirii
Copy link
Author

PeymanAmirii commented Aug 21, 2024

Yes, you are right. When a user uses the command ros2 node info <node namepace/node_name> already knows the namespace.

As a summary of the suggestions, the command ros2 topic find <topic_type>, the option --help for the command ros2 topic info <topic_name> and the input <node namepace/node_name> for the command ros2 node info <node namepace/node_name> can be added to the tutorials.

@fujitatomoya
Copy link
Collaborator

the command ros2 topic find <topic_type>

https://docs.ros.org/en/rolling/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.html does not introduce the all ros2 topic sub-commands. I think that is okay to add more, i would love to review the PR. (bw, delay and find can be added.)

option --help for the command ros2 topic info <topic_name>

https://docs.ros.org/en/rolling/Concepts/Basic/About-Command-Line-Tools.html introduces ros2 --help and that clearly tells:

...
Call `ros2 <command> -h` for more detailed usage.

I do not think we need to add this explanation of --help option in the tutorial.

the input <node namepace/node_name> for the command ros2 node info <node namepace/node_name> can be added to the tutorials.

i would argue that this should be explained in ros2node cli but documentation. so that user can realize that we need to specify the fully qualified node name including namespace here.

see ros2/ros2cli#923

@fujitatomoya fujitatomoya added help wanted Extra attention is needed good first issue Good for newcomers labels Aug 21, 2024
@mnhaqq
Copy link

mnhaqq commented Oct 2, 2024

https://docs.ros.org/en/rolling/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.html does not introduce the all ros2 topic sub-commands. I think that is okay to add more, i would love to review the PR. (bw, delay and find can be added.)

I would like to contribute to this issue and introduce more ros2 topic sub-commands. I will start working on it and submit a PR soon. Please let me know if there's anything specific I should keep in mind

mnhaqq added a commit to mnhaqq/ros2_documentation that referenced this issue Oct 4, 2024
Rephrase description of bw command for clarity

Fixes ros2#4610

Signed-off-by: mnhaqq <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants