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 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:
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);