]> git.mxchange.org Git - flightgear.git/commit
David Culp:
authorehofman <ehofman>
Fri, 27 Feb 2004 10:20:17 +0000 (10:20 +0000)
committerehofman <ehofman>
Fri, 27 Feb 2004 10:20:17 +0000 (10:20 +0000)
commit85a1e5cc983169594563763c903436c8f1cfa934
treeaa811a659f222f56b5c4b116b96480dbcbce9a51
parentef1231434678d57dce3b47e35496670957585e63
David Culp:

Here's a new batch of AI code which includes a working radar instrument.

I put the radar calculations into the existing AIAircraft class.  It was
easier that way, and it can always be migrated out later if we have to.
Every tenth sim cycle the AIManager makes a copy of the current user state
information.  When the AIAircraft updates it uses this information to
calculate the radar numbers.  It calculates:

1) bearing from user to target
2) range to target in nautical miles
3) "horizontal offset" to target.  This is the angle from the nose to the
   target, in degrees, from -180 to 180.  This will be useful later for a HUD.
4) elevation, in degrees (vertical angle from user's position to target
   position)
5) vertical offset, in degrees (this is elevation corrected for user's pitch)
6) rdot (range rate in knots, note:  not working yet, so I commented it out)

and three items used by the radar instrument to place the "blip"

7) y_shift, in nautical miles
8) x_shift, in nautical miles
9) rotation, in degrees

The radar instrument uses the above three items, and applies a scale factor to
the x-shift and y-shift in order to match the instrument's scale.  Changing
the display scale can be done entirely in the XML code for the instrument.
Right now it's set up only to display a 40 mile scale.

The radar is an AWACS view, which is not very realistic, but it is useful and
demonstrates the technology.  With just a little more work I can get a HUD
marker.  All I need to do there is make a bank angle adjustment to the
current values.
src/AIModel/AIAircraft.cxx
src/AIModel/AIAircraft.hxx
src/AIModel/AIBallistic.cxx
src/AIModel/AIBallistic.hxx
src/AIModel/AIBase.cxx
src/AIModel/AIBase.hxx
src/AIModel/AIManager.cxx
src/AIModel/AIManager.hxx
src/AIModel/AIShip.cxx
src/AIModel/AIShip.hxx