1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
25jun11abu
(c) Software Lab. Alexander Burger
RC Flight Simulator
===================
The PicoLisp RC Flight Simulator is a very simple toy simulator, allowing you to
fly an airplane in a way similar to a radio controlled model plane.
It is all implemented within the PicoLisp system, so that no additional
libraries like OpenGL or GL4Java are needed. It may be regarded as a proof of
concept, because a flight simulator is one of the least typical things to do in
Lisp.
The plane is similar to the German WW-I aircraft Fokker "D-VII" (and a bit to
the British Sopwith Camel ;-). Though the user's position is that of a model
plane's pilot (i.e. viewing the plane from a fixed position), all parameters
like dimensions, mass, engine power and flight data are intended to be as close
as possible to a "real" Fokker D-VII. Unfortunately, some of these parameters
are not known exactly, but it is a fun project anyway, and I hope it comes
close.
The simulator supports two different kinds of user interface. The version in the
standard release uses a plain Xlib frontend. To use it, you'll have to build it
once:
$ (cd src; make x11)
Then start the PicoLisp server with
$ ./dbg rcsim/main.l -main -go
and then the Z3d-Client from another X-terminal
$ bin/z3dClient localhost 8080
Then make sure that your keyboard focus is on the first X-terminal (where you
started the simulator from, _not_ the Z3d-Client window).
Hitting ENTER at the PicoLisp prompt (the colon ':') will terminate the
simulation process and close the Z3d-Client window. As always, you can stop the
PicoLisp servers with 'killall picolisp'.
The second version runs in an Applet in any Java-enabled browser.To run it
locally, please download and unpack the "picoJavaGUI.tgz" tarball. It
contains the Java applet GUI which is no longer part of the standard PicoLisp
release.
You can start the PicoLisp server with
$ ./pil rcsim/applet.main.l -main -go -wait
or (to get an interactive PicoLisp command line) with
$ ./pil rcsim/main.l -main -go +
and then point your browser to "http://localhost:8080".
If you don't have PicoLisp installed, you might want to try the online
version at:
http://rcsim.7fach.de
(please take care not to use a proxy for that address)
In both cases, click onto the image to set the keyboard focus.
The simulator runs in the background, so if it is started interactively (see
above), the Lisp interpreter is fully available and lets you inspect or modify
the environment. For example
: (show *Model)
shows the current state of the model.
In the Z3d-Version, terminal output is interlaced with the simulator's output.
If you see no ':' prompt, it is helpful to type a single dot '.' and ENTER, to
avoid terminating the interpreter:
...
0 % 0 km/h 0 m/s 1 m
.
-> NIL
:
The simulator is controlled by the following 10 keys:
- The cursor (arrow) keys UP and DOWN control the elevator
- The LEFT and RIGHT cursor keys control the combined rudder/ailerons
- The HOME key sets full throttle (F8)
- PAGE UP/DOWN increase/decrease the throttle (F7/F6)
- The END key turns the engine off (F5)
- INS/DEL zoom in/out (or F4/F3)
For a first flight, just hit the HOME key as the plane sits waiting on the
runway, and watch it accelerate. After some time, when it starts to jump a bit
nervously, give a little up-elevator (the DOWN arrow key) to gain height. Then
hit the PAGE DOWN key once or twice to decrease the throttle, and cautiously
experiment with with the arrow keys.
There is some rudimentary sound implemented. It is not intended to be realistic
(the graphic isn't either ;-) but to give some audible feedback to the user. It
produces a simple square wave sound, depending on the engine's thrust, the
airspeed, the distance, and the Doppler effect.
If you are using the Java/Applet version, you might simply click on the "Sound"
checkbox. Be warned, however, that this induces additional load on the client
side, and doesn't sound very smooth. BTW, does anybody know of a better way to
produce continuous sound with variable frequency in a Java applet?
In the Z3d-Client version, a console speaker interface is used, which gives
better results. As the speaker can be accessed in Linux only from a virtual
console (not from an X-terminal), log into a virtual console (typically tty1 ..
tty6) _before_ you start the simulator, change to the installation directory,
and run the simple tone server:
$ rcsim/tone
When done, you can stop it with 'killall tone'.
|