User Tools

Site Tools


getting_started:tutorials:hal4

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:hal4 [2019/01/17 13:35] – [Subscribing] grafgetting_started:tutorials:hal4 [2023/02/27 14:02] (current) – [Subscribing] ursgraf
Line 1: Line 1:
 ====== Using ROS through the HAL ====== ====== Using ROS through the HAL ======
-In the EEROS library you will find a directory with examples. Open a shell and run ''roscore''. Open another shell in the build directory of your EEROS library and run ''sudo -E examples/ros/rosTest2 -c RosTest2Config.json''. \\ + 
 +EEROS can communicate with ROS through the HAL, see [[getting_started:ros|]]. The HAL can work with ROS1 or ROS2. However, you have to make sure, that you compile EEROS with support for the right version of ROS and use the right version for the ROS HAL.  
 + 
 +===== Using ROS1 ===== 
 + 
 +In the EEROS library you will find a directory with examples. For this example see [[https://github.com/eeros-project/eeros-framework/blob/master/examples/ros/RosTest2.cpp|RosTest2.cpp]]. 
 + 
 +This examples with ROS will only be present in your build directory if ROS was installed before building EEROS with ''-DUSE_ROS=TRUE'' set, see [[getting_started:ros_prep|Preparations and Building]] 
 +Open shell in the build directory of your EEROS library and run  
 +<code> 
 +sudo -E ./examples/ros2/rosTest2 -c RosTest2Config.json 
 +</code>
  
 ==== 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 two topics
   * /test/val         (of type double)   * /test/val         (of type double)
   * /test/state       (of type boolean)   * /test/state       (of type boolean)
  
-Use the same tools as in [[getting_started:tutorials:controlsystemros1|]] to show nodes, topics and messages.+Use the same tools as in [[getting_started:tutorials:systemros1#using_ros1|Control System Talking to ROS]] to show nodes, topics and messages. The output on ''/test/state'' reflects what is input on ''/rosNodeTalker/state''. As long as this topic is not written to, the published state will not change, see below.
  
 ==== Subscribing ==== ==== Subscribing ====
Line 20: Line 31:
  
 ==== Another Example ==== ==== Another Example ====
-There is another example, RosExample with HalConfigRos.json. It demonstrates the use of more message types. However, the example was never stripped of unnecessary bits.+There is another example, RosExample with HalConfigRos.json. It demonstrates the use of more message types. 
 + 
 +===== Using ROS2 ===== 
 + 
 +In the EEROS library you will find a directory with examples. For this example see [[https://github.com/eeros-project/eeros-framework/blob/master/examples/ros2/RosTest2.cpp|RosTest2.cpp]]. 
 + 
 +Open a shell in the build directory of your EEROS library. This examples with ROS 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]].  
 + 
 +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  
 +<code> 
 +$ sudo -E ./examples/ros/rosTest2 -c RosTest2Config.json 
 +</code> 
 + 
 +==== Publishing ==== 
 +This example runs your EEROS application as a ROS node under the name ///eerosNode//. It publishes two topics 
 +  * /test/val         (of type double) 
 +  * /test/state       (of type boolean) 
 + 
 +Use the same tools as in [[getting_started:tutorials:systemros1#using_ros2|Control System Talking to ROS]] to show nodes, topics and messages. The output on ''/test/state'' reflects what is input on ''/rosNodeTalker/state''. As long as this topic is not written to, the published state will not change, see below. 
 + 
 +==== Subscribing ==== 
 +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/val    (of type double) 
 +  * /rosNodeTalker/state  (of type boolean) 
 +and logs its transported message values into the console. Use 
 +<code> 
 +$ rqt 
 +</code> 
 +to show a graph with all involved nodes together with their topics or to plot messages. 
 + 
getting_started/tutorials/hal4.1547728530.txt.gz · Last modified: 2019/01/17 13:35 by graf