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
eeros_architecture:hal:start [2017/04/16 20:53] – [Configuration of the HAL] grafeeros_architecture:hal:start [2019/03/26 11:39] (current) gehrig
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 [[Configuration File]]. 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]].
Line 15: Line 23:
   hal.readConfigFromFile(&argc, argv);   hal.readConfigFromFile(&argc, argv);
 </code> </code>
 +Now, you can pass the configuration file with
 +<code>
 +$ ./myApplication -c /path/to/config/NameOfConfigurationFile
 +</code>
 +Note: This HAL option has to be the first option if additional command line options are used.
 +
 This call causes the following actions: This call causes the following actions:
   * the configuration file will be parsed   * the configuration file will be parsed
Line 20: Line 34:
   * 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); 
 +  Output<bool>* getLogicOutput(std::string name, bool exclusive = true); 
 +  ScalableOutput<double>* getScalableOutput(std::string name, bool exclusive = true); 
 +  InputInterface* getInput(std::string name, bool exclusive = true); 
 +  Input<bool>* getLogicInput(std::string name, bool exclusive = true); 
 +  ScalableInput<double>* getScalableInput(std::string name, bool exclusive = true);
 </code> </code>
-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. 
  
-==== Inputs and Outputs of the Control System ==== 
-The control system can read from or write to the hardware solely through its [[eeros_architecture:control_system:available_blocks:peripheralinput|]] or [[eeros_architecture:control_system:available_blocks:peripheraloutput|]] block. When you declare one of these blocks you have to give an id as parameter to its constructor. 
- 
-<code cpp> 
-  eeros::control::PeripheralInput<double> enc("q0"); 
-  eeros::control::PeripheralOutput<double> controlVoltage("dac0"); 
-</code> 
-Please make sure that the ids ("q0", "dac0") are the same as given in the configuration file. 
- 
-==== Exclusive Access ==== 
-Whenever you request an input or output from the HAL manager you will get exclusive access to this channel. This could be the safety system or the control system but not both. There might be a case where an input is a critical input to the safety system and at the same time serves as an input to to control system. In this case you can request the input with   
-<code cpp> 
-  eeros::control::PeripheralInput<double> enc("q0", false); 
-</code> 
-Please keep in mind that whenever the safety system or the control system read from this input, the actual hardware is read for any access, which might take some time.  
-It is possible to change the access privilege by releasing a channel and requesting it again, e.g. 
-<code cpp> 
-  eeros::control::PeripheralInput<double> enc("q0", false); 
-  HAL& hal = HAL::instance(); 
-  hal.releaseInput("q0"); 
-  eeros::control::PeripheralInput<double> enc("q0"); 
-</code> 
-The latter example is a very uncommon case and might be useful for testing purposes. 
eeros_architecture/hal/start.1492368819.txt.gz · Last modified: 2017/04/16 20:53 (external edit)