getting_started:tutorials:systemros1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
getting_started:tutorials:systemros1 [2023/02/09 10:33] – ursgraf | getting_started:tutorials:systemros1 [2024/12/06 18:53] (current) – ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Control System Talking to ROS ====== | ====== Control System Talking to ROS ====== | ||
- | 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 ROS tools have changed. | + | 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 |
===== Using ROS1 ===== | ===== Using ROS1 ===== | ||
Line 20: | Line 20: | ||
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 /// |
- | * /test/vector | + | * /test/analogSignal |
- | * /test/val (of type double) | + | * /test/analogSignalVector |
- | * / | + | * / |
+ | * / | ||
+ | * / | ||
+ | * / | ||
With | With | ||
Line 33: | Line 36: | ||
$ rostopic list | $ rostopic list | ||
</ | </ | ||
- | will list the two topics which are published be our node, /// | + | will list all the 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. | ||
< | < | ||
- | $ rostopic echo /test/vector | + | $ rostopic echo /test/analogSignalVector |
</ | </ | ||
With | With | ||
< | < | ||
- | $ rostopic hz /test/val | + | $ rostopic hz /test/analogSignalVector |
</ | </ | ||
you can easily check how often data is sent from out ROS node. Try to plot the data with | you can easily check how often data is sent from out ROS node. Try to plot the data with | ||
< | < | ||
- | $ rqt_plot /test/val /test1/vector/data[0] /test/vector/data[1] / | + | $ rqt_plot /test/analogSignal |
</ | </ | ||
Line 70: | Line 73: | ||
If you work on a target make sure to setup the environment as given in [[getting_started: | If you work on a target make sure to setup the environment as given in [[getting_started: | ||
- | Open a shell and run | + | Open a shell in the build directory of your EEROS library |
< | < | ||
- | $ roscore | + | $ sudo -E ./examples/ros2/rosTest1 |
- | </ | + | |
- | Open another shell in the build directory of your EEROS library and run | + | |
- | < | + | |
- | $ sudo -E ./examples/ros/rosTest1 | + | |
</ | </ | ||
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. | ||
Line 83: | Line 82: | ||
* / | * / | ||
* / | * / | ||
- | * / | + | * / |
With | With | ||
< | < | ||
- | $ rosnode | + | $ ros2 node list |
</ | </ | ||
you will see the new node. | you will see the new node. | ||
< | < | ||
- | $ rostopic | + | $ ros2 topic 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. | ||
< | < | ||
- | $ rostopic | + | $ ros2 topic echo / |
</ | </ | ||
With | With | ||
< | < | ||
- | $ rostopic | + | $ ros2 topic hz /test/val |
- | </ | + | |
- | you can easily check how often data is sent from out ROS node. Try to plot the data with | + | |
- | < | + | |
- | $ rqt_plot /test/val / | + | |
</ | </ | ||
+ | you can easily check how often data is sent from out ROS node. | ||
==== Subscribing ==== | ==== Subscribing ==== | ||
Line 113: | Line 109: | ||
and logs its transported message values into the console. Alternatively you could publish a single message from the command line with | and logs its transported message values into the console. Alternatively you could publish a single message from the command line with | ||
< | < | ||
- | $ rostopic | + | $ ros2 topic pub / |
- | $ rostopic | + | $ ros2 topic pub / |
</ | </ | ||
Use | Use | ||
< | < | ||
- | $ rqt_graph | + | $ rqt |
</ | </ | ||
- | to show a graph with all involved nodes together with their topics. | + | to show a graph with all involved nodes together with their topics |
getting_started/tutorials/systemros1.1675935236.txt.gz · Last modified: 2023/02/09 10:33 by ursgraf