getting_started:tutorials:systemros1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
getting_started:tutorials:systemros1 [2020/12/03 10:21] – [Control System Talking to ROS] ursgraf | getting_started:tutorials:systemros1 [2023/02/25 07:40] – [Control System Talking to ROS] ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Control System Talking to ROS ====== | ====== Control System Talking to ROS ====== | ||
- | In the EEROS library you will find a directory with examples. This examples with ROS will only be present in your build directory if ROS was installed before building EEROS with '' | + | |
+ | EEROS can work with ROS1 or ROS2. However, you have to make sure, that you compile EEROS with support for the right version of ROS. Further, the naming and use of the tools in ROS1 and ROS2 have slightly changed. | ||
+ | |||
+ | ===== Using ROS1 ===== | ||
+ | In the EEROS library you will find a directory with examples. For this example see [[https:// | ||
+ | |||
+ | Open a shell in the build directory of your EEROS library. This examples with ROS will only be present in your build directory if ROS was installed before building EEROS with '' | ||
+ | |||
+ | If you work on a target make sure to setup the environment as given in [[getting_started: | ||
+ | |||
+ | Open a shell and run | ||
< | < | ||
$ roscore | $ roscore | ||
Line 6: | Line 16: | ||
Open another shell in the build directory of your EEROS library and run | Open another shell in the build directory of your EEROS library and run | ||
< | < | ||
- | $ sudo -E ./ | + | $ sudo -E ./ |
</ | </ | ||
- | IMPORTANT You have to run a program using real time threads with root privileges | + | IMPORTANT You have to run a program using real time threads with root privileges. |
==== Publishing ==== | ==== Publishing ==== | ||
This example runs your EEROS application as a ROS node under the name /// | This example runs your EEROS application as a ROS node under the name /// | ||
Line 19: | Line 29: | ||
$ rosnode list | $ rosnode list | ||
</ | </ | ||
- | you will see the new node. With | + | you will see the new node. |
< | < | ||
$ rostopic list | $ rostopic list | ||
</ | </ | ||
- | will list the two topics which are published be our node, /// | + | will list the three topics which are published be our node, /// |
Open another shell to show the messages sent by EEROS, e.g. | Open another shell to show the messages sent by EEROS, e.g. | ||
< | < | ||
Line 41: | Line 51: | ||
* / | * / | ||
* / | * / | ||
- | and logs its transported message values into the console. Use | + | and logs its transported message values into the console. |
+ | < | ||
+ | $ rostopic pub / | ||
+ | $ rostopic pub / | ||
+ | </ | ||
+ | |||
+ | Use | ||
+ | < | ||
+ | $ rqt_graph | ||
+ | </ | ||
+ | to show a graph with all involved nodes together with their topics. | ||
+ | |||
+ | ===== Using ROS2 ===== | ||
+ | In the EEROS library you will find a directory with examples. For this example see [[https:// | ||
+ | |||
+ | Open a shell in the build directory of your EEROS library. This examples with ROS2 will only be present in your build directory if ROS2 was installed before building EEROS with '' | ||
+ | |||
+ | If you work on a target make sure to setup the environment as given in [[getting_started: | ||
+ | |||
+ | Open a shell in the build directory of your EEROS library and run | ||
+ | < | ||
+ | $ sudo -E ./ | ||
+ | </ | ||
+ | IMPORTANT You have to run a program using real time threads with root privileges. | ||
+ | ==== Publishing ==== | ||
+ | This example runs your EEROS application as a ROS node under the name /// | ||
+ | * / | ||
+ | * / | ||
+ | * / | ||
+ | |||
+ | With | ||
+ | < | ||
+ | $ ros2 node list | ||
+ | </ | ||
+ | you will see the new node. | ||
+ | < | ||
+ | $ ros2 topic list | ||
+ | </ | ||
+ | will list the three topics which are published be our node, /// | ||
+ | Open another shell to show the messages sent by EEROS, e.g. | ||
+ | < | ||
+ | $ ros2 topic echo / | ||
+ | </ | ||
+ | With | ||
+ | < | ||
+ | $ ros2 topic hz /test/val | ||
+ | </ | ||
+ | you can easily check how often data is sent from out ROS node. | ||
+ | |||
+ | ==== Subscribing ==== | ||
+ | Open another shell in the build directory of your EEROS library and run '' | ||
+ | * / | ||
+ | * / | ||
+ | and logs its transported message values into the console. Alternatively you could publish a single message from the command line with | ||
+ | < | ||
+ | $ ros2 topic pub / | ||
+ | $ ros2 topic pub / | ||
+ | </ | ||
+ | |||
+ | Use | ||
< | < | ||
$ rqt_graph | $ rqt_graph |
getting_started/tutorials/systemros1.txt · Last modified: 2023/02/27 14:00 by ursgraf