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.

Alt text

To define your controller, do the following

  1. 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

  2. Add your controller to sw/simulation/includes_controllers.h

  3. 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.