PilotDemo class
From Tekkotsu Wiki
The PilotDemo class is both a demo in its own right and a framework for building your own navigation demos. PilotDemo implements a simple command listener so that you can issue requests to the Pilot by sending text messages from the Tekkotsu console.
You can run PilotDemo directly by going to Root Control > Framework Demos > Navigation Demos > PilotDemo.
PilotDemo Commands
| f / b | forward/backward 100 mm |
| F / B | forward/backward 500 mm |
| fwd dist | forward dist mm (use negative numbers to go backwards) |
| l / r | turn left/right by 10 degrees |
| L / R | turn left/right by 90 degrees |
| turn deg | turn left by deg degrees (negative numbers turn right) |
| loc | localize using landmarks and the world map |
| clear | clear the world map |
| build | find landmarks in current view and add to world map |
| disp n | display best n particles in the world map |
| rand | randomize the particles |
| rundemo | start the user's state machine |
Making Your Own Demo
You can make your own demo by creating a state machine whose parent node inherits from PilotDemo. This is useful if you want to create your own world map and navigation application; you can use PilotDemo to provide a convenient command interface.
To build your own world map, override the buildMap() method.
PilotDemo takes over the state machine's startnode, so in order for your own code to run, your initial node should be called startdemo or rundemo. If it's called startdemo then it will be started automatically when the demo runs. If it's called rundemo then a rumdemo command will be included in the PilotDemo menu, and you can start the behavior manually by typing msg rundemo.
#include "Behaviors/Demos/Navigation/PilotDemo.h"
$nodeclass MyDemo : PilotDemo {
virtual void buildMap() {
// code to create the landmarks and (optional) worldBounds polygon for your world map
// ...
}
$setupmachine{
startdemo: SpeechNode($,"This is my demo") =C=> ...
}
}
Adding Your Own Commands
PilotDemo provides an addCommand() method that allows you to add your own commands to the menu. Each command must be implemented as a node in your state machine. See the source code in PilotDemo.h.fsm for examples.


