User Tools

Site Tools


eeros_architecture:sequencer:sequencer

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
eeros_architecture:sequencer:sequencer [2017/09/24 10:56] – [Sequencer] grafeeros_architecture:sequencer:sequencer [2021/12/23 17:40] (current) ursgraf
Line 2: Line 2:
 ====== Sequencer ====== ====== Sequencer ======
 The sequencer is responsible to run the main sequence. There is a single instance of the sequencer and therefore only one main sequence. Further, the sequencer contains a list with all sequences. Whenever you define a sequence it will automatically be added to this list. The list helps to retrieve a reference to a given sequence. This can be helpful is you wish to pass information into this sequence.\\ The sequencer is responsible to run the main sequence. There is a single instance of the sequencer and therefore only one main sequence. Further, the sequencer contains a list with all sequences. Whenever you define a sequence it will automatically be added to this list. The list helps to retrieve a reference to a given sequence. This can be helpful is you wish to pass information into this sequence.\\
-First, get the instance of the sequencer. +First, get the instance of the sequencer. Make sure to set the default logger output to an output stream, as the sequencer uses loggers
 <code cpp> <code cpp>
 +  Logger::setDefaultStreamLogger(std::cout);
   auto& sequencer = Sequencer::instance();               // get instance   auto& sequencer = Sequencer::instance();               // get instance
 </code> </code>
  
-The next step is to define a meaningfull sequence (see [[.:sequence]]) and add it to the sequencer. After this you can start the sequence with //start()//. The main program may terminate when the main sequencer has terminated. For this purpose it has to wait for the sequence thread with //join()//+The next step is to define a meaningfull sequence (see [[.:sequence]]) and add it to the sequencer. After this you can start the sequence with //start()//. The main program may terminate when the main sequencer has terminated. For this purpose it has to wait for the sequence thread.  
 <code cpp> <code cpp>
   MainSequence mainSequence("Main Sequence", sequencer); // define main sequence   MainSequence mainSequence("Main Sequence", sequencer); // define main sequence
-  sequencer.addSequence(mainSequence);                   // add it to the sequencer +  mainSequence();                                        // start it
-  mainSequence.start();                                  // start it+
   ...                                                    // do other things such as starting the executor   ...                                                    // do other things such as starting the executor
-  mainSequence.join();                                   // wait for the sequencer to finish+  sequencer.wait();                                      // wait for the sequencer to finish its sequence
 </code> </code>
  
 ===== Forcing the Sequencer to Stop Immediately ===== ===== Forcing the Sequencer to Stop Immediately =====
-For a system under development you often want to abort a running system. This case must be handled carefully. As described in [[getting_started:tutorials:stoppingsystem|]] you may want to install an appropriate signal handler which shuts down the safety system. This action finally stops the executor. Further, you have to stop any running sequence. For this purpose every sequence includes a monitor with an associated abort condition. By calling +For a system under development you often want to abort a running system. This case must be handled carefully. As described in [[getting_started:practical_problems:abort|]] you may want to install an appropriate signal handler which shuts down the safety system. This action finally stops the executor. Further, you have to stop any running sequence. For this purpose every sequence includes a monitor with an associated abort condition. By calling 
 <code cpp> <code cpp>
 void signalHandler(int signum) { void signalHandler(int signum) {
Line 24: Line 24:
 } }
 </code> </code>
-not only the safety system will gracefully shutdown but the sequencer running any set of sequences will terminate as well. Please make sure that your program waits for those sequences to terminate before your main program stops. This can be accomplished as follows: +not only the safety system will gracefully shutdown but the sequencer running any set of sequences will abort as well. Please make sure that your program waits for those sequences to abort before your main program stops. This can be accomplished as follows: 
 +<code cpp> 
 +  ...                                                   
 +  sequencer.wait();                                      // wait for any running sequence to abort 
 +  ... 
 +</code>
  
eeros_architecture/sequencer/sequencer.1506243393.txt.gz · Last modified: 2017/09/24 10:56 (external edit)