6. Using your own controller - coppolam/swarmulator GitHub Wiki
With Swarmulator it is easy to use your own controller.
All controllers must be a child class of Controller
, to be found at sw/simulation/controller.cpp
.
To define your controller, do the following
-
Run the script to make the skeleton for a new controllers.
cd scripts
./make_new_controller.sh <name_of_controller>
This will create the skeleton of your new controller, which can be found in
sw/simulation/controllers
-
Add your controller to
sw/simulation/includes_controllers.h
-
To use the controller, define it in
settings.h
You can use the functions in OmniscientObserver
in order to simulate the sensing of other agents as you see fit, see the other controllers for examples.