User Tools

Site Tools


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.

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 configuration given in the file can be loaded as follows:

  HAL& hal = HAL::instance();
  hal.readConfigFromFile(std::string file);

Most probably you want to pass the configuration file name via parameters to main with:

  HAL& hal = HAL::instance();
  hal.readConfigFromFile(&argc, argv);

Now, you can pass the configuration file with

$ ./myApplication -c /path/to/config/NameOfConfigurationFile

Note: This HAL option has to be the first option if additional command line options are used.

This call causes the following actions:

  • the configuration file will be parsed
  • the necessary hardware libraries will be loaded
  • 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

Available HAL Objects

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> respectively. Analog inputs or outputs are of type ScalableInput<double> or ScalableOutput<double> respectively.
The following functions are available:

  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);
eeros_architecture/hal/start.txt · Last modified: 2019/03/26 11:39 by gehrig