Back To Projects: http://www.cs.uml.edu/ecg/index.php/OPLfall14/Project
December 7th, 2014
This project is a functioning RWR (Radar Warning Receiver) for the flight simulator, DCS World. Specifically, our goal was to recreate the display of the F-15C from the Flaming Cliffs 3 module of DCS World.
The simulator gives us JSON encoded data representing received radar emissions from various threats such as aircraft, surface to air missiles, etc. We then recreate the behavior and display of the F-15C's RWR over the network with racket to allow a small embedded device (e.g. Raspberry Pi) to act as a secondary display for the simulator.
This project lets sim enthusiasts enjoy greater immersion while flying the simulator.
|The display as shown in the simulator:||The display as we recreated it:|
- Object Orientation was used to model the RWR system (rwr%) and threats (threat%).
- Our main 'loop' uses tail recursion.
- We work with first-class functions every time we map across a list, or sort a list.
- We benefit from local bindings with let and let*.
- Lists of threats represent our received data.
- We sort, filter and map across these lists, mostly with local anonymous functions created with lambda.
- A hash table stores keys representing unit types, and string values to be shown on the display itself.
External Technology and Libraries:
Favorite Lines of Code:
TEWS.rkt: (define i 0 )
(set! i (+ i 1) ) (send rwr frame-counter i)
Classes.rkt: (define (draw-threats dc)
(define frame-counter (send rwr get-i)) (set! tracking (if ( and (equal? signaltype "lock") (equal? (modulo i 2) 0)) #t #f ) )
A frame counter is defined that sends the value of i that is being incremented to the set! tracking procedure and checks if the signaltype of the threat is "lock" or locking on to the user's aircraft if that statement returns #t then the i that is being incremented in TEWS.rkt the modulus of i is taken when i is divided by 2 so when i ends in any even number the threat will be drawn then not drawn when i ends in an odd number, this alternation displays to the user as if the threat is blinking.
Mike's favorite line:
(when (send rwr tcp-ready?) (send rwr accept) ) ; this checks if there's a newer TCP connection, and if there is, switches to it. ; This was the solution to a number of problems, ; but most importantly let our code work with the simulator, even through multiple flights.