1
0
Fork 0

David Culp:

Here's some additions to AI that allow refueling from an AI tanker (the actual
onload of fuel must be handled by the user's FDM of course, this just lets
the FDM know that the user is in position to refuel).

I've added a new class of AIAircraft called "tanker".  It uses the same
performance struct as a jet transport.  An AI tanker is just like an AI jet
transport, except it uses the already-existing radar data to control the
boolean property systems/refuel/contact.  The code change was minimal.

An AI tanker can be created like this:

  <entry>
   <callsign>Esso 1</callsign>
   <type>aircraft</type>
   <class>tanker</class>
   <model>Aircraft/737/Models/boeing733.xml</model>
   <latitude>37.61633</latitude>
   <longitude>-122.38334</longitude>
   <altitude>3000</altitude>
   <heading>020</heading>
   <speed>280</speed>
   <roll>-15</roll>
  </entry>

This puts a tanker over KSFO at 3000 feet, in a left-hand orbit.  When the
user gets within refueling range (contact position) then the property
systems/refuel/contact will be true.  Otherwise it is false.

The dimensions of the refueling envelope are pretty rough right now, but still
usable.  The user must be behind the tanker (ie. radar y_offset > 0).  The
user must be at or below the tanker's altitude (ie. radar elevation > 0).
The user's lat/lon must be within 250 feet of the tanker's lat/lon (ie. radar
range_ft < 250).  This last requirement is loose because the radar data is
only updated every 100 ms, which is accurate enough for radar use, but
which is sloppy for air refueling.  This could be tightened up by increasing
the radar update rate to once every sim cycle.

I'm going to add a light to the T-38 instrument panel that will monitor the
property systems/refuel/contact.  This will make it easier to explore the
boundaries of the refueling envelope.
This commit is contained in:
ehofman 2004-06-06 08:50:17 +00:00
parent 38f5e2c1dd
commit dda15ac488
3 changed files with 30 additions and 2 deletions

View file

@ -45,7 +45,9 @@ const FGAIAircraft::PERF_STRUCT FGAIAircraft::settings[] = {
// jet_transport
{5.0, 2.0, 3000.0, 1500.0, 140.0, 300.0, 430.0, 300.0, 130.0},
// jet_fighter
{7.0, 3.0, 4000.0, 2000.0, 150.0, 350.0, 500.0, 350.0, 150.0}
{7.0, 3.0, 4000.0, 2000.0, 150.0, 350.0, 500.0, 350.0, 150.0},
// tanker
{5.0, 2.0, 3000.0, 1500.0, 140.0, 300.0, 430.0, 300.0, 130.0}
};
@ -56,6 +58,7 @@ FGAIAircraft::FGAIAircraft(FGAIManager* mgr) {
fp = 0;
dt_count = 0;
use_perf_vs = true;
isTanker = false;
// set heading and altitude locks
hdg_lock = false;
@ -68,6 +71,7 @@ FGAIAircraft::~FGAIAircraft() {
bool FGAIAircraft::init() {
refuel_node = fgGetNode("systems/refuel/contact", true);
return FGAIBase::init();
}
@ -298,6 +302,19 @@ void FGAIAircraft::Run(double dt) {
rotation = hdg - user_heading;
if (rotation < 0.0) rotation += 360.0;
//************************************//
// Tanker code //
//************************************//
if ( isTanker) {
if ( (range_ft < 250.0) &&
(y_shift > 0.0) &&
(elevation > 0.0) ) {
refuel_node->setBoolValue(true);
} else {
refuel_node->setBoolValue(false);
}
}
}

View file

@ -46,7 +46,7 @@ private:
public:
enum aircraft_e {LIGHT=0, WW2_FIGHTER, JET_TRANSPORT, JET_FIGHTER};
enum aircraft_e {LIGHT=0, WW2_FIGHTER, JET_TRANSPORT, JET_FIGHTER, TANKER};
static const PERF_STRUCT settings[];
FGAIAircraft(FGAIManager* mgr);
@ -67,6 +67,8 @@ public:
void TurnTo(double heading);
void ProcessFlightPlan( double dt );
inline void SetTanker(bool setting) { isTanker = setting; };
private:
bool hdg_lock;
@ -76,6 +78,8 @@ private:
const PERF_STRUCT *performance;
bool use_perf_vs;
SGPropertyNode* refuel_node;
bool isTanker;
void Run(double dt);
double sign(double x);

View file

@ -115,6 +115,7 @@ void FGAIManager::update(double dt) {
++ai_list_itr;
}
wind_from_down->setDoubleValue( strength );
}
@ -168,6 +169,9 @@ int FGAIManager::createAircraft( string model_class, string path,
ai_plane->SetPerformance(&FGAIAircraft::settings[FGAIAircraft::JET_TRANSPORT]);
} else if (model_class == "jet_fighter") {
ai_plane->SetPerformance(&FGAIAircraft::settings[FGAIAircraft::JET_FIGHTER]);
} else if (model_class == "tanker") {
ai_plane->SetPerformance(&FGAIAircraft::settings[FGAIAircraft::JET_TRANSPORT]);
ai_plane->SetTanker(true);
} else {
ai_plane->SetPerformance(&FGAIAircraft::settings[FGAIAircraft::JET_TRANSPORT]);
}
@ -199,6 +203,9 @@ int FGAIManager::createAircraft( string model_class, string path,
ai_plane->SetPerformance(&FGAIAircraft::settings[FGAIAircraft::JET_TRANSPORT]);
} else if (model_class == "jet_fighter") {
ai_plane->SetPerformance(&FGAIAircraft::settings[FGAIAircraft::JET_FIGHTER]);
} else if (model_class == "tanker") {
ai_plane->SetPerformance(&FGAIAircraft::settings[FGAIAircraft::JET_TRANSPORT]);
ai_plane->SetTanker(true);
} else {
ai_plane->SetPerformance(&FGAIAircraft::settings[FGAIAircraft::JET_TRANSPORT]);
}