User Tools

Site Tools


getting_started:tutorials:mockrobot

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
Next revisionBoth sides next revision
getting_started:tutorials:mockrobot [2020/12/03 13:21] – [Sequencer] ursgrafgetting_started:tutorials:mockrobot [2021/03/31 17:31] – [Mock Robot Example] ursgraf
Line 1: Line 1:
 ====== Mock Robot Example ====== ====== Mock Robot Example ======
-This tutorial demonstrates an EEROS application complete with a control system, a safety system, and a sequencer. You can find the code in the directory with the examples. Start the program with +This tutorial demonstrates an EEROS application complete with a control system, a safety system, and a sequencer. You can find the code under [[https://github.com/eeros-project/eeros-framework/blob/master/examples/system/MockRobotExample.cpp|MockRobotExample.cpp]]. 
 + 
 +Start the program with 
 <code cpp> <code cpp>
 $ sudo ./examples/system/mockRobotExample $ sudo ./examples/system/mockRobotExample
Line 102: Line 104:
   MoveUp(std::string name, Sequence* caller, MockRobotControlSystem& cs) : Step(name, caller), cs(cs) { }   MoveUp(std::string name, Sequence* caller, MockRobotControlSystem& cs) : Step(name, caller), cs(cs) { }
   int action() {   int action() {
-    cs.setpointX.setValue(0.7)+    Matrix<2,1,double> dest{8.2, 27.0}
-    cs.setpointY.setValue(0.3);+    cs.pp.move(dest); 
 +    return 0;
   }   }
-  bool checkExitCondition() {return cs.iX.getOut().getSignal().getValue() >= 5.0;}+  bool checkExitCondition() {return cs.pp.endReached();}
   MockRobotControlSystem& cs;   MockRobotControlSystem& cs;
 }; };
Line 113: Line 116:
   MoveDown(std::string name, Sequence* caller, MockRobotControlSystem& cs) : Step(name, caller), cs(cs) { }   MoveDown(std::string name, Sequence* caller, MockRobotControlSystem& cs) : Step(name, caller), cs(cs) { }
   int action() {   int action() {
-    cs.setpointX.setValue(-0.6); +    Matrix<2,1,double> dest{-5, 3}; 
-    cs.setpointY.setValue(-0.3);+    cs.pp.move(dest); 
 +    return 0;
   }   }
-  bool checkExitCondition() {return cs.iX.getOut().getSignal().getValue() <= -5.0;} +  bool checkExitCondition() {return cs.pp.endReached();}
-private:+
   MockRobotControlSystem& cs;   MockRobotControlSystem& cs;
 }; };
Line 133: Line 136:
         moveDown();         moveDown();
       }       }
 +      return 0;
     }     }
-private: 
   MoveUp moveUp;   MoveUp moveUp;
   MoveDown moveDown;   MoveDown moveDown;
getting_started/tutorials/mockrobot.txt · Last modified: 2021/03/31 17:45 by ursgraf