EEROS  0.4.1.0
API for the EEROS Real-Time Robotics Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PeripheralOutput.hpp
Go to the documentation of this file.
1 #ifndef ORG_EEROS_CONTROL_PERIPHERALOUTPUT_HPP
2 #define ORG_EEROS_CONTROL_PERIPHERALOUTPUT_HPP
3 
5 #include <eeros/hal/HAL.hpp>
7 
8 namespace eeros {
9  namespace control {
10 
11  template < typename T = double >
12  class PeripheralOutput : public Block1i<T> {
13 
14  public:
15  PeripheralOutput(std::string id) : hal(hal::HAL::instance()) {
16  systemOutput = dynamic_cast<hal::PeripheralOutput<T>*>(hal.getPeripheralOutput(id));
17  if(systemOutput == nullptr) throw EEROSException("Peripheral output '" + id + "' not found!");
18  }
19 
20  virtual void run() {
21  systemOutput->set(this->in.getSignal().getValue());
22  }
23 
24  private:
25  hal::HAL& hal;
26  hal::PeripheralOutput<T>* systemOutput;
27  };
28 
29  };
30 };
31 
32 #endif // ORG_EEROS_CONTROL_PERIPHERALOUTPUT_HPP
Definition: PeripheralOutput.hpp:17
Definition: HAL.hpp:13
Definition: Block1i.hpp:12
Definition: EEROSException.hpp:9
PeripheralOutputInterface * getPeripheralOutput(std::string name, bool exclusive=false)
Definition: HAL.cpp:41
virtual void run()
Definition: PeripheralOutput.hpp:20
PeripheralOutput(std::string id)
Definition: PeripheralOutput.hpp:15
Input< T > in
Definition: Block1i.hpp:21
Definition: PeripheralOutput.hpp:12