-
Install Webots on your computer.
-
Add the following line to your
~/.bashrc
file:
export WEBOTS_HOME=/usr/local/webots
- From the hackflight main directory, do the following:
cd webots/plugins/physics/standard
make
cd ../../../controllers/standard
make
make run
If you have a game controller or R/C transmitter with adapter dongle, you can use that to fly; 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:
- MGEAR Wired Controller for PS3
- Logitech Gamepad F310
- Logitech Extreme 3D Pro
- FrSky XSR-SIM USB Dongle
- Spektrum Ws2000 Wireless USB RC Flight Simulator Dongle
- Nyko 83069 Playstation(R)3 Core Wired Controller
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 equestions 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: