User Tools

Site Tools


eeros_architecture:hal:config_ros

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
eeros_architecture:hal:config_ros [2017/12/14 18:29] – [Implemented Message Types] grafeeros_architecture:hal:config_ros [2023/02/27 14:44] (current) – [Configuration File for ROS] ursgraf
Line 3: Line 3:
 As described in [[getting_started:ros#Using ROS through EEROS HAL|]] you can directly map EEROS signal onto ROS messages through the EEROS HAL. The wrapper library [[eeros_architecture:hal:hardware_libraries#ros|EEROS-ROS]] is used to connect the EEROS HAL with ROS topics. \\ As described in [[getting_started:ros#Using ROS through EEROS HAL|]] you can directly map EEROS signal onto ROS messages through the EEROS HAL. The wrapper library [[eeros_architecture:hal:hardware_libraries#ros|EEROS-ROS]] is used to connect the EEROS HAL with ROS topics. \\
 The EEROS HAL digital and analog inputs and outputs can be defined as usual in a JSON file. In this file you specify into which message type these signals get packed. There are hundreds of different message types in ROS and it is possible to create custom types. For this reason, we currently support only a few by default. If one wishes to use other message types, the wrapper library can easily be extended. The EEROS HAL digital and analog inputs and outputs can be defined as usual in a JSON file. In this file you specify into which message type these signals get packed. There are hundreds of different message types in ROS and it is possible to create custom types. For this reason, we currently support only a few by default. If one wishes to use other message types, the wrapper library can easily be extended.
 +
 +WARNING 
 +The naming of messages changes from ROS1 to ROS2, e.g.
 +  * ROS1: std_msgs::Float64
 +  * ROS2: std_msgs::msg::Float64
 +The information below is for ROS1. Change accordingly for ROS2.
  
 The keywords for the EEROS-ROS wrapper library must be set as follows: The keywords for the EEROS-ROS wrapper library must be set as follows:
Line 18: Line 24:
 | msgType | string | message type | | msgType | string | message type |
 | dataField | string | data member of message | | dataField | string | data member of message |
-| callOne | boolean | ???? |+| callOne | boolean | newest availabe message is fetched (false), oldest not yet read message is fetched (true) |
 | queueSize | int | size of buffer, default = 1000 | | queueSize | int | size of buffer, default = 1000 |
 | useEerosSystemTime | boolean | use system time or timestamp of message | | useEerosSystemTime | boolean | use system time or timestamp of message |
Line 47: Line 53:
 | ::: | ::: | range_min | | ::: | ::: | range_min |
 | ::: | ::: | range_max | | ::: | ::: | range_max |
 +| DigIn | std_msgs::BatteryState | present |
 +| DigOut | std_msgs::BatteryState | present |
  
 +You can find a complete example, including a *.json file, in the [[getting_started:tutorials:start|]].
  
-DigIn     & sensor\_msgs::BatteryState & present          \\ 
  
-DigOut    & sensor\_msgs::BatteryState & present          \\ \cline{2-3}  
- 
-You can find a complete example, including a *.json file, in the eeros framework (/examples/hal/Ros*). 
- 
- 
- 
- 
- 
-\subsection{How to use} 
- 
-Refere to the documentation of the EEROS HAL\footnote{http://wiki.eeros.org/eeros\_architecture/hal/start?s[]=hal} and check the example in the eeros framework (/examples/ros). 
- 
- 
- 
-First initialize the HAL in your main function: 
- 
-<code cpp> 
-... 
- 
-int main(int argc, char **argv) { 
- 
- ... 
- 
- // HAL 
- 
- // //////////////////////////////////////////////////////////////////////// 
- 
- HAL& hal = HAL::instance(); 
- 
- hal.readConfigFromFile(&argc, argv); 
- 
- ... 
-</code> 
- 
- 
-Add the header file to your control system: 
- 
-\lstset{language=c} 
- 
-\begin{lstlisting} 
- 
-#include <eeros/hal/HAL.hpp> 
- 
-\end{lstlisting} 
- 
- 
- 
-You can now declare \textit{PeripheralInputs} and \textit{PeripheralOutputs}: 
- 
-<code cpp> 
- PeripheralInput<double> analogIn0; 
- 
- PeripheralInput<bool> digitalIn0; 
- 
- PeripheralOutput<double> analogOut0; 
- 
- PeripheralOutput<bool> digitalOut0; 
-</code> 
- 
- 
- 
-Call the constructor of the peripheral IOs with the \textit{signalID} used in the *.json file 
- 
-<code cpp> 
- 
-class MyControlSystem { 
- 
-public: 
- 
- MyControlSystem(double ts, ros::NodeHandle& rosNodeHandler): 
- 
- dt(ts), 
- 
- ... 
- 
- analogIn0("scanTimeIn0"), // argument has to match signalId of json 
- 
- digitalIn0("batteryPresent0"), 
- 
- analogOut0("scanTimeEchoOut0"), 
- 
- digitalOut0("batteryPresentEchoOut0"), 
- 
- ... 
- 
-} 
-</code> 
eeros_architecture/hal/config_ros.1513272547.txt.gz · Last modified: 2017/12/14 18:29 (external edit)