-
Install Webots on your computer.
-
Add the following line to your
~/.bashrcfile:
export WEBOTS_HOME=/usr/local/webots
- From the hackflight main directory, do the following:
cd webots/plugins/physics/simple
make
cd ../../../controllers/controller
make
make run
If you have a game controller or R/C transmitter with adapter dongle, you can use that to fly (right shoulder button to takeoff and land); otherwise, the simulator will advise you that no such device was found and instruct you on how to fly with the keyboard. The following devices are currently supported:
The basic time step in Webots is 32 milliseonds, which translates to an update rate of around 31 Hz in the control code (e.g., PID control). Although adequate for many robot applications, this rate is much slower than the typical rate of 500 - 1000 Hz used in actual flight controllers. Although it is possible to decrease the timestep in order to increase the update rate, there is as usual a tradeoff, in which a faster update rate can slow down the simulation. Fortunately, Webots supports custom physics plugins, in which you can replace Webots' built-in physics with a physics model of your own. The Hackflight simulator exploits this feature of Webots, using a dynamics model based on the equations presented in this paper. The webots update step represents a slow, outer loop, in which is embeded a faster control loop, which in turn embeds an even faster dynamics loop. The following figure illustrates this arrangement, using a traditional cascade-control diagram:

