Simulating the Helicopter
In order to better develope and debug the flight control system,
we've extended Aaron Kahn's aerodynamical simulator that he used
for his X-Cell 60 project. The
original source code
were written for Windows +
we've converted it to work with Linux and our
IMU / AHRS
is available as
A packaged tar file is available for
(get Release 2.2).
The graphics aren't photorealistic, but the model includes the aerodynamic
effects of the horizontal and vertical tail surfaces, engine torque,
swashplate non-linearity, inertia, transmission power loss, translational
lift and many, many other factors. These constants are specified in
the init_model() routine in
As a compile time option, you can select an
model for the display. This helps with orientation and visual presentation,
but does slow down the frame rate for the display model.
Models are extracted from
Search and Rescue
The first step is to get the software working with a joystick and
manual control. Most of the code is already there, although it needed
to be ported from Aaron's Windows version to use the Linux joystick
This code is in place in
although it is not very polished at this time. It requires that the
limits on each axis be set in the limits array. The included
program prints out this array for it.
This was based on the earlier joystick parsing code in the
All three axes are debugged and working now. You can fly the helicopter
around with the joystick and generally have fun. If you crash, the
aircraft rights itself and gives you another chance.
The second step is to extract the IMU-related data from the simulator
model and feed it to our control code. We can begin giving different
flight controls to the software as we develop the different axes.
Rather than require a human pilot to operate the remaining controls,
it is possible to "lock" them in place and have the model ignore
program can now handle all three axes and six degrees of freedom. It will
position the helicopter at (0,0) and 2m off the ground, then hold it there.
The internal algorithm is a PD loop for pitch and roll attitude, with a
PID loop for position control. You can watch an
MPEG of it hovering
(266 kb). You can also view
a graph of the North/East parameters
a graph of the flight path.
After getting the PID constants tuned, noise will be introduced into the
"sensor" data. The
should be able to cope with this. It will better model the data produced
by the actual IMU.
The third step will be to feed the simulated IMU data to the AVR in
real time and have our control board run the software. This will
help us determine if the 4 Mhz microcontroller is fast enough at
doing the Kalman filtering to safely fly the helicopter.
And the fourth step is to actually put the system onto the helicopter.
We should be flying by then...