User Tools

Site Tools


eeros_architecture:hal:start

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
Last revisionBoth sides next revision
eeros_architecture:hal:start [2017/04/16 20:22] – [Inputs and Outputs of the Safety System] grafeeros_architecture:hal:start [2017/11/30 19:42] – [Hardware Abstraction Layer] graf
Line 1: Line 1:
 ====== Hardware Abstraction Layer ====== ====== Hardware Abstraction Layer ======
 The HAL provides an interface between the robot control system (consisting of control system, safety system, and sequencer) and the hardware of the robot. Any signal from a hardware input or output must pass through the HAL.  The HAL provides an interface between the robot control system (consisting of control system, safety system, and sequencer) and the hardware of the robot. Any signal from a hardware input or output must pass through the HAL. 
 +  * [[eeros_architecture:hal:using_hal|]] 
 +  * [[eeros_architecture:hal:configuration_file|]] 
 +    * [[eeros_architecture:hal:scaling|]] 
 +    * [[eeros_architecture:hal:scaling_multi|]] 
 +    * [[eeros_architecture:hal:config_ros|]] 
 +  * [[eeros_architecture:hal:feature_functions|]] 
 +  * [[eeros_architecture:hal:hardware_libraries|]] 
 +    * [[eeros_architecture:hal:hardware_libraries_sim|]] 
 +  * [[eeros_architecture:hal:input_devices|]]
 ===== Configuration of the HAL ===== ===== Configuration of the HAL =====
-The inputs and outputs of the system are given by a specific hardware setup. This can vary widely among different systems. To account for many possible hardware settings we use a configuration file. This file describes the current hardware together with the necessary library to access them, see [[coming soon]].+The inputs and outputs of the system are given by a specific hardware setup. This can vary widely among different systems. To account for many possible hardware settings we use a configuration file. This file describes the current hardware together with the necessary library to access them, see [[Configuration File]].
 The configuration given in the file can be loaded as follows: The configuration given in the file can be loaded as follows:
 <code cpp> <code cpp>
Line 14: Line 22:
   HAL& hal = HAL::instance();   HAL& hal = HAL::instance();
   hal.readConfigFromFile(&argc, argv);   hal.readConfigFromFile(&argc, argv);
 +</code>
 +Now, you can pass the configuration file with
 +<code>
 +$ ./myApplication --config     /path/to/config/NameOfConfigurationFile
 +$ ./myApplication -c           /path/to/config/NameOfConfigurationFile    // short version
 +$ ./myApplication --configFile /path/to/config/NameOfConfigurationFile    // also possible
 +$ ./myApplication -f           /path/to/config/NameOfConfigurationFile    // short version
 </code> </code>
 This call causes the following actions: This call causes the following actions:
Line 20: Line 35:
   * for each channel an appropriate object is created with the id given in the configuration file   * for each channel an appropriate object is created with the id given in the configuration file
   * these objects will be registered in the HAL manager   * these objects will be registered in the HAL manager
-===== Using HAL Objects ===== +===== Available HAL Objects ===== 
-Hal objects are all the input and output channels given in the configuration aboveYou can use these objects either from the safety system or the control system.  +All input objects of the HAL have a common type base type ''InputInterface'' while the output objects have a common type ''OutputInterface''Digital inputs or outputs are of type ''Input<bool>'' or ''Output<bool>'' respectivelyAnalog inputs or outputs are of type ''ScalableInput<double>'' or ''ScalableOutput<double>'' respectively. \\ 
-==== Inputs and Outputs of the Safety System ==== +The following functions are available:
-The safety system can check for each of its safety levels whether the level of certain channels meet given criteriasSuch channels are called critical inputs and outputs and have to be defined as such, see [[eeros_architecture:safety_system:properties#Critical Inputs and Outputs|]]. If the criterias are not met you can choose what action has to be taken, see [[eeros_architecture:safety_system:io_actions|]]. \\ +
-The safety system will get a handle to tha HAL object with:+
 <code cpp> <code cpp>
-  eeros::hal::Input<bool>* emergency hal.getLogicInput("emergency"); +  OutputInterface* getOutput(std::string name, bool exclusive true); 
-</code> +  Output<bool>* getLogicOutput(std::string namebool exclusive true); 
-Here, you get a reference to an digital input representing the emergency button. Please make sure that the id ("emergency") is the same as given in the configuration file. +  ScalableOutput<double>getScalableOutput(std::string name, bool exclusive = true); 
- +  InputInterfacegetInput(std::string namebool exclusive = true); 
- +  Input<bool>* getLogicInput(std::string namebool exclusive = true); 
- +  ScalableInput<double>* getScalableInput(std::string namebool exclusive = true);
-  * Define inputs and outputs: +
-To access the digital I/O hardware within the comedi frameworkyou have to define the inputs and outputs and add them to the HAL. +
-<code c> +
-  ComediDevice* comedi0 new ComediDevice("/dev/comedi0"); +
-  ComediDevicecomedi1 = new ComediDevice("/dev/comedi1"); +
-   +
-  hal.addSystemInput(new ComediFqd("q0", comedi0, 11, 8, 10, 9, 6.28318530718 / (4 4096.0), 0, 0));   +
-  hal.addSystemOutput(new ComediDigOut("watchdog"comedi1, 2, 22)); +
-  hal.addSystemOutput(new ComediDigOut("enable0"comedi0, 2, 24)); +
-  hal.addSystemOutput(new ComediDigOut("brake0", comedi1, 2, 4, true));+
 </code> </code>
  
-  * **Note:** The class //SystemInput<T>// and //SystemOutput<T>// are template classes. If you define a input or an output as boolean or double, it should really be a boolean (on or off) or a double (e.g. voltage) on the hardware. 
eeros_architecture/hal/start.txt · Last modified: 2019/03/26 11:39 by gehrig