User Tools

Site Tools


getting_started:practical_problems:seq_endless

This is an old revision of the document!


Do not use Endless Loops in Sequences

Though a sequence might run endlessly - or at least as long as a robot is powered - it should be avoided to write something like

public:
  int action() {
    while (true) step1();
  }

when defining the method action of the sequence. Due to some extraordinary condition such as a fault or stopping the application prematurely the sequence should stop as soon as the sequencer itself stops together with all its associated sequences. For this purpose the correct implementation of the action method is as follows:

public:
  int action() {
    while (getRunningState() == SequenceState::running) step1();
  }

This also ensures that if a caller sequence stops due to a monitor, this sequence terminates as well.

getting_started/practical_problems/seq_endless.1554406561.txt.gz · Last modified: 2019/04/04 21:36 by graf