The _test race track_ and `tx2-auto-3` are used in F1/10 project of [IID][]
group. The `libgoforward` controls the robot to just go straight.
+`libgobackward` is the same as `libgoforward` but with the negative speed. It's
+written in more OOP way.
+
[IID]: https://iid.ciirc.cvut.cz/
--- /dev/null
+#include "stage.hh"
+using namespace Stg;
+
+class ControlledRobot {
+private:
+ ModelPosition *pos = nullptr;
+public:
+ ControlledRobot(Model *m) : pos(dynamic_cast<ModelPosition *>(m))
+ {
+ assert(this->pos != nullptr);
+ this->pos->Subscribe();
+ }
+ ModelPosition *get_pos() const { return this->pos; }
+};
+
+extern "C" int Init(Model *model, CtrlArgs *)
+{
+ auto r = new ControlledRobot(model);
+ r->get_pos()->SetXSpeed(-3.0);
+ return 0;
+}
dependencies: stgdep,
include_directories: stginc,
)
+library('gobackward',
+ 'ctrl/gobackward.cc',
+ dependencies: stgdep,
+ include_directories: stginc,
+)