User Tools

Site Tools


getting_started:tutorials:systemros1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
getting_started:tutorials:systemros1 [2023/02/27 14:00] – [Subscribing] ursgrafgetting_started:tutorials:systemros1 [2026/04/12 16:01] (current) – [Using ROS2] ursgraf
Line 16: 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 
 <code> <code>
-$ sudo -E ./examples/ros/rosTest1+$ sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH ./examples/ros/rosTest1
 </code> </code>
 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 ///eerosNode//. It publishes three topics +This example runs your EEROS application as a ROS node under the name ///eerosNode//. It publishes six topics 
-  * /test/vector          (of type Matrix<7,1,double>+  * /test/analogSignal          (of type eeros_msgs/msg/AnalogSignal with a single double value
-  * /test/val             (of type double) +  * /test/analogSignalVector    (of type eeros_msgs/msg/AnalogSignal with a vector of 7 entries of type double
-  * /test/safetyLevel     (of type unit32_t)+  * /test/digitalSignal          (of type eeros_msgs/msg/DigitalSignal with a single bool value) 
 +  * /test/digitalSignalVector    (of type eeros_msgs/msg/DigitalSignal with a vector of 7 entries of type bool
 +  * /test/safetyLevel     (currently active safety level of type std_msgs/msg/String) 
 +  * /test/odom     (odometry data of type nav_msgs/msg/Odometry)
  
 With  With 
Line 33: Line 36:
 $ rostopic list $ rostopic list
 </code> </code>
-will list the three topics which are published be our node, ///test/val//, ///test/vector//, and ///test/safetyLevel//.+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.
 <code> <code>
-$ rostopic echo /test/vector+$ rostopic echo /test/analogSignalVector
 </code> </code>
 With  With 
 <code> <code>
-$ rostopic hz /test/val+$ rostopic hz /test/analogSignalVector
 </code> </code>
 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
 <code> <code>
-$ rqt_plot /test/val /test1/vector/data[0] /test/vector/data[1] /test/safetyLevel+$ rqt_plot /test/analogSignal /test/analogSignalVector/val[0] /test/analogSignalVector/val[1] /test/safetyLevel
 </code> </code>
  
Line 68: Line 71:
 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 ''-DUSE_ROS2=TRUE'' set, see [[getting_started:ros_prep|Preparations and Building]].  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 ''-DUSE_ROS2=TRUE'' set, see [[getting_started:ros_prep|Preparations and Building]]. 
  
 +Next, you have to run your ROS setup script together with the setup script for your EEROS messages.
 +<code>
 +$ source /opt/ros/<distro-name>/setup.bash
 +$ source <eeros-install-dir>/share/eeros_msgs/local_setup.bash
 +</code>
 If you work on a target make sure to setup the environment as given in [[getting_started:ros_run|]]. If you work on a target make sure to setup the environment as given in [[getting_started:ros_run|]].
  
 Open a shell in the build directory of your EEROS library and run  Open a shell in the build directory of your EEROS library and run 
 <code> <code>
-sudo -E ./examples/ros2/rosTest1+$ ./examples/ros2/rosTest1
 </code> </code>
-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 ///eerosNode//. It publishes three topics This example runs your EEROS application as a ROS node under the name ///eerosNode//. It publishes three topics
-  * /test/vector          (of type Matrix<7,1,double>+  * /test/analogSignal          (of type eeros_msgs/msg/AnalogSignal
-  * /test/val             (of type double+  * /test/analogSignalVector    (of type eeros_msgs/msg/AnalogSignal) 
-  * /test/safetyLevel     (of type unit32_t)+  * /test/digitalSignal         (of type eeros_msgs/msg/DigitalSignal) 
 +  * /test/digitalSignalVector   (of type eeros_msgs/msg/DigitalSignal
 +  * /test/safetyLevel           (of type std_msgs/msg/String) 
 +  * /test/odom                  (of type nav_msgs/msg/Odometry) 
 +  * /test/twistStamped          (of type geometry_msgs/msg/TwistStamped)
  
 With  With 
Line 89: Line 101:
 $ ros2 topic list $ ros2 topic list
 </code> </code>
-will list the three topics which are published be our node, ///test/val//, ///test/vector//, and ///test/safetyLevel//.+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.
 <code> <code>
-$ ros2 topic echo /test/vector+$ ros2 topic echo /test/analogSignalVector
 </code> </code>
 With  With 
 <code> <code>
-$ ros2 topic hz /test/val+$ ros2 topic hz /test/analogSignal
 </code> </code>
 you can easily check how often data is sent from out ROS node.  you can easily check how often data is sent from out ROS node. 
  
 ==== Subscribing ==== ==== Subscribing ====
 +The topic ''/test/twistStamped'' is published by our node and received at the same time. You should be able to observe the values in the log.
 +
 Open another shell in the build directory of your EEROS library and run ''rosNodeTalker''. This is not a EEROS program but simply starts a ROS node which publishes a couple of test topics. As soon as ''rosNodeTalker'' runs, your example application will receive the two topics Open another shell in the build directory of your EEROS library and run ''rosNodeTalker''. This is not a EEROS program but simply starts a ROS node which publishes a couple of test topics. As soon as ''rosNodeTalker'' runs, your example application will receive the two topics
-  * /rosNodeTalker/vector  (of type Matrix<2,1,double>+  * /rosNodeTalker/analogSignal        (of type eeros_msgs/msg/AnalogSignal) 
-  * /rosNodeTalker/val     (of type double+  * /rosNodeTalker/analogSignalVector  (of type eeros_msgs/msg/AnalogSignal
-and logs its transported message values into the console. Alternatively you could publish a single message from the command line with +  * /rosNodeTalker/digitalSignal       (of type eeros_msgs/msg/DigitalSignal) 
 +  * /rosNodeTalker/digitalSignalVector (of type eeros_msgs/msg/DigitalSignal) 
 +  * /rosNodeTalker/twist               (of type geometry_msgs/msg/Twist) 
 + 
 +and logs its transported message values into the console. Alternatively you could publish messages from the command line with 
 <code> <code>
-$ ros2 topic pub /rosNodeTalker/val std_msgs/msg/Float64 "data-2.3+$ ros2 topic pub /rosNodeTalker/analogSignal    eeros_msgs/msg/AnalogSignal "{timestamp{sec: 1, nanosec: 1000}, val: [10.5]}
-$ ros2 topic pub /rosNodeTalker/vector std_msgs/msg/Float64MultiArray "{layout: {dim[]data_offset0}, data: [2.5, 1.76]}"+$ ros2 topic pub /rosNodeTalker/analogSignalVector  eeros_msgs/msg/AnalogSignal "{timestamp: {sec2nanosec2000}, val: [-1, 0.5]}"
 </code> </code>
  
getting_started/tutorials/systemros1.1677502831.txt.gz · Last modified: by ursgraf