Skip to content
Snippets Groups Projects
Commit f4cedfeb authored by beuchatp's avatar beuchatp
Browse files

Added echo to rostopic FAQ

parent f8f93a52
No related branches found
No related tags found
No related merge requests found
...@@ -282,4 +282,10 @@ if (true) ...@@ -282,4 +282,10 @@ if (true)
my_subscriber = nodeHandle.subscribe("/fortytwo",1,fortytwoCallback); my_subscriber = nodeHandle.subscribe("/fortytwo",1,fortytwoCallback);
} }
``` ```
This would work if it is in the ``main()`` function of a node, but if it is in another function then you may need to declare the subscriber as a class variable. This would work if it is in the ``main()`` function of a node, but if it is in another function then you may need to declare the subscriber as a class variable.
\ No newline at end of file
To observe any message published on a particular topic, after launching your node, open a separate command window and type the command:
```
rostopic echo /namespace/topicname
```
where ``/namespace/topicname`` needs to be replace with the topic that you wish to echo. Any messages received by this topic will be directly printed out in the command window.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment