User Tools

Site Tools


getting_started:tutorials:firstproject

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
Last revisionBoth sides next revision
getting_started:tutorials:firstproject [2015/08/10 11:13] visentingetting_started:tutorials:firstproject [2016/10/07 14:02] gehrig
Line 4: Line 4:
   - Then create a new project following the steps under "preparation" on [[getting_started:tutorials:helloworld|Getting Started]].   - Then create a new project following the steps under "preparation" on [[getting_started:tutorials:helloworld|Getting Started]].
   - The following example shows a typical EEROS application.     - The following example shows a typical EEROS application.  
 +  - After creating all those files, modify the CMakeLists.txt and CMAkeCache.txt files accoring to [[getting_started:tutorials:helloworld|Getting Started]], "Say Hello World with EEROS", point 2 and 3. 
 +
 <code c> <code c>
 +#include <iostream>
 +#include <unistd.h>
 +
 +#include <eeros/logger/Logger.hpp>
 +#include <eeros/logger/StreamLogWriter.hpp>
 +
 +#include "MySequencer.hpp"
 +#include "MySafetyProperties.hpp"
 +#include "MyControlSystem.hpp"
 +
 +
 +using namespace eeros;
 +using namespace eeros::hal;
 +using namespace eeros::control;
 +using namespace eeros::safety;
 +using namespace eeros::logger;
 +using namespace eeros::sequencer;
 +using namespace testproject;
 +
 +
 int main() { int main() {
   std::cout << "SCARA Robot Control started" << std::endl;   std::cout << "SCARA Robot Control started" << std::endl;
Line 29: Line 51:
   sequencer.start(&mainSequence);   sequencer.start(&mainSequence);
      
-  while(sequencer.getState() != state::terminated) { +//  while(sequencer.getState() != state::terminated) { 
-      usleep(10000); +//      usleep(10000); 
-  }+//  } 
 +   
 +  sequencer.join();
      
-  controlSystem.stop(); +//  controlSystem.stop(); 
-  safetySystem.shutdown(); +//  safetySystem.shutdown(); 
-  sequencer.shutdown();+//  sequencer.shutdown();
      
   std::cout << "SCARA Robot Control stopped" << std::endl;   std::cout << "SCARA Robot Control stopped" << std::endl;
Line 102: Line 126:
     // Run Blocks     // Run Blocks
     // e.g. timedomain.addBlock(&constant);     // e.g. timedomain.addBlock(&constant);
-} 
- 
-void MyControlSystem::start() { 
-    timedomain.start(); 
-} 
- 
-void MyControlSystem::stop() { 
-    timedomain.stop(); 
-    timedomain.join();   
 } }
 </code> </code>
Line 316: Line 331:
 target_link_libraries(test-project eeros) target_link_libraries(test-project eeros)
 </code> </code>
- 
-  - After creating all those files, modify the CMakeLists.txt and CMAkeCache.txt files accoring to [[getting_started:tutorials:helloworld|Getting Started]], "Say Hello World with EEROS", point 2 and 3.