getting_started:tutorials:firstproject
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
getting_started:tutorials:firstproject [2015/08/06 12:59] – visentin | getting_started:tutorials:firstproject [2016/11/29 15:36] (current) – removed graf | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Your First EEROS Project ====== | ||
- | First of all, make sure that you have set up your environment as described in [[..: | ||
- | <code c> | ||
- | int main() { | ||
- | std::cout << "SCARA Robot Control started" | ||
- | | ||
- | // Define logger | ||
- | StreamLogWriter w(std:: | ||
- | w.show(); | ||
- | Logger< | ||
- | | ||
- | // Get HAL istance | ||
- | HAL& hal = HAL:: | ||
- | | ||
- | // Get Control System instance | ||
- | MyControlSystem controlSystem; | ||
- | | ||
- | // Get Safety System instance | ||
- | double dt = 0.001; | ||
- | | ||
- | MySafetyProperties safetyProperties(& | ||
- | SafetySystem safetySystem (safetyProperties, | ||
- | |||
- | Sequencer sequencer; | ||
- | MySequencer | ||
- | sequencer.start(& | ||
- | | ||
- | while(sequencer.getState() != state:: | ||
- | usleep(10000); | ||
- | } | ||
- | | ||
- | controlSystem.stop(); | ||
- | safetySystem.shutdown(); | ||
- | sequencer.shutdown(); | ||
- | | ||
- | std::cout << "SCARA Robot Control stopped" | ||
- | return 0; | ||
- | } | ||
- | </ | ||
- | |||
- | To start, create an instance of the [[eeros_architecture: | ||
- | |||
- | Then you have to define the [[eeros_architecture: | ||
- | |||
- | Finally, a sequence has to be defined and assigned to a [[eeros_architecture: | ||
- | |||
- | Here follows the basic implementation of the three subsystems of a simple EEROS application: | ||
- | |||
- | === Control System: === | ||
- | |||
- | == .hpp: == | ||
- | |||
- | <code c> | ||
- | #ifndef CH_NTB_TEST_MYCONTROLSYSTEM_HPP_ | ||
- | #define CH_NTB_TEST_MYCONTROLSYSTEM_HPP_ | ||
- | |||
- | #include < | ||
- | #include < | ||
- | #include < | ||
- | |||
- | namespace testproject { | ||
- | | ||
- | class MyControlSystem { | ||
- | | ||
- | public: | ||
- | MyControlSystem(); | ||
- | | ||
- | void start(); // starts timedomains | ||
- | void stop(); | ||
- | | ||
- | // Define blocks here | ||
- | | ||
- | private: | ||
- | eeros:: | ||
- | | ||
- | }; // end class | ||
- | }; // end namepspace | ||
- | |||
- | #endif // | ||
- | </ | ||
- | |||
- | == .cpp: == | ||
- | |||
- | <code c> | ||
- | #include " | ||
- | |||
- | using namespace testproject; | ||
- | |||
- | MyControlSystem:: | ||
- | |||
- | timedomain(" | ||
- | |||
- | { | ||
- | // Configure Blocks | ||
- | | ||
- | // Connect Blocks | ||
- | // e.g. gain.getIn().connect(constant.getOut()); | ||
- | | ||
- | // Run Blocks | ||
- | // e.g. timedomain.addBlock(& | ||
- | } | ||
- | |||
- | void MyControlSystem:: | ||
- | timedomain.start(); | ||
- | } | ||
- | |||
- | void MyControlSystem:: | ||
- | timedomain.stop(); | ||
- | timedomain.join(); | ||
- | } | ||
- | </ | ||
- | |||
- | === Safety System: === | ||
- | |||
- | == .hpp: == | ||
- | |||
- | <code c> | ||
- | </ | ||
- | |||
- | == .cpp: == | ||
- | |||
- | <code c> | ||
- | </ | ||
- | |||
- | === Main Sequencer: === | ||
- | |||
- | == .hpp: == | ||
- | |||
- | <code c> | ||
- | </ | ||
- | |||
- | == .cpp: == | ||
- | |||
- | <code c> | ||
- | </ | ||
getting_started/tutorials/firstproject.1438858789.txt.gz · Last modified: 2015/08/06 12:59 (external edit)