CVS: source/src/ATC trafficcontrol.cxx, 1.14, 1.15 trafficcontrol.hxx, 1.8, 1.9

Durk Talsma <[email protected]> Sun, 25 Apr 2010 03:33:59 -0500
Newsgroups gmane.games.flightgear.cvc
Message-ID <[email protected]>
Update of /var/cvs/FlightGear-0.9/source/src/ATC
In directory baron.flightgear.org:/tmp/cvs-serv18630/src/ATC

Modified Files:
	trafficcontrol.cxx trafficcontrol.hxx 
Log Message:
Expanded ATC communication between AI aircraft and Airport ground control.


Index: trafficcontrol.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/ATC/trafficcontrol.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- trafficcontrol.cxx	21 Feb 2010 14:15:18 -0000	1.14
+++ trafficcontrol.cxx	25 Apr 2010 08:33:20 -0000	1.15
@@ -340,11 +340,27 @@
   alt     = 0;
 }
 
+
 bool FGATCInstruction::hasInstruction()
 {
   return (holdPattern || holdPosition || changeSpeed || changeHeading || changeAltitude || resolveCircularWait);
 }
 
+/***************************************************************************
+ * FGATCController
+ *
+ **************************************************************************/
+
+
+
+
+FGATCController::FGATCController() 
+{
+     dt_count = 0; 
+     available = true; 
+     lastTransmission = 0;
+}
+
 string FGATCController::getGateName(FGAIAircraft *ref) 
 {
     return ref->atGate();
@@ -370,6 +386,7 @@
 
     //double commFreqD;
     sender = rec->getAircraft()->getTrafficRef()->getCallSign();
+    //cerr << "transmitting for: " << sender << "Leg = " << rec->getLeg() << endl;
     switch (rec->getLeg()) {
         case 2:
         case 3:
@@ -449,6 +466,12 @@
                taxiFreqStr = formatATCFrequency3_2(taxiFreq);
                text = receiver + ". Switching to " + taxiFreqStr + ". " + sender;
                break;
+           case MSG_INITIATE_CONTACT:
+                text = receiver + ". With you. " + sender;
+                break;
+           case MSG_ACKNOWLEDGE_INITIATE_CONTACT:
+                text = receiver + ". Roger. " + sender;
+                break;
            case MSG_REQUEST_PUSHBACK_CLEARANCE:
                text = receiver + ". Request push-back. " + sender;
                break;
@@ -457,9 +480,30 @@
                break;
            case MSG_HOLD_PUSHBACK_CLEARANCE:
                 text = receiver + ". Standby. " + sender;
-                 break;
-            default:
-                 text = sender + ". Transmitting unknown Message";
+                break;
+           case MSG_REQUEST_TAXI_CLEARANCE:
+                text = receiver + ". Ready to Taxi. " + sender;
+                break;
+           case MSG_ISSUE_TAXI_CLEARANCE:
+                text = receiver + ". Cleared to taxi. " + sender;
+                break;
+           case MSG_ACKNOWLEDGE_TAXI_CLEARANCE:
+                text = receiver + ". Cleared to taxi. " + sender;
+                break;
+           case MSG_HOLD_POSITION:
+                text = receiver + ". Hold Position. " + sender;
+                break;
+           case MSG_ACKNOWLEDGE_HOLD_POSITION:
+                text = receiver + ". Holding Position. " + sender;
+                break;
+           case MSG_RESUME_TAXI:
+                text = receiver + ". Resume Taxiing. " + sender;
+                break;
+           case MSG_ACKNOWLEDGE_RESUME_TAXI:
+                text = receiver + ". Continuing Taxi. " + sender;
+                break;
+           default:
+                 text = text + sender + ". Transmitting unknown Message";
                   break;
     }
     double onBoardRadioFreq0 = fgGetDouble("/instrumentation/comm[0]/frequencies/selected-mhz");
@@ -691,8 +735,6 @@
 FGStartupController::FGStartupController() :
   FGATCController()
 {
-    available        = false;
-    lastTransmission = 0;
 }
 
 void FGStartupController::announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentPosition,
@@ -874,7 +916,7 @@
              available = false;
         }
      }
-     // Note: The next two stages are only necessesary when Startup control is
+     // Note: The next four stages are only necessesary when Startup control is
      //  on a different frequency, compared to ground control
      if ((state == 4) && available){
         if (now > startTime+130) {
@@ -885,20 +927,36 @@
              available = false;
         }
      }
+     if ((state == 5) && available){
+        if (now > startTime+140) {
+            transmit(&(*i), MSG_INITIATE_CONTACT, ATC_AIR_TO_GROUND);
+            i->updateState();
+            lastTransmission = now;
+             available = false;
+        }
+     }
+     if ((state == 6) && available){
+        if (now > startTime+150) {
+            transmit(&(*i), MSG_ACKNOWLEDGE_INITIATE_CONTACT, ATC_GROUND_TO_AIR);
+            i->updateState();
+            lastTransmission = now;
+             available = false;
+        }
+     }
 
 
      // TODO: Switch to APRON control and request pushback Clearance.
      // Get Push back clearance
-     if ((state == 5) && available){
-        if (now > startTime+160) {
+     if ((state == 7) && available){
+        if (now > startTime+180) {
             transmit(&(*i), MSG_REQUEST_PUSHBACK_CLEARANCE, ATC_AIR_TO_GROUND);
             i->updateState();
             lastTransmission = now;
              available = false;
         }
      }
-     if ((state == 6) && available){
-        if (now > startTime+180) {
+     if ((state == 8) && available){
+        if (now > startTime+200) {
             if (i->pushBackAllowed()) {
                  i->allowRepeatedTransmissions();
                  transmit(&(*i), MSG_PERMIT_PUSHBACK_CLEARANCE, ATC_GROUND_TO_AIR);
@@ -911,7 +969,7 @@
              available = false;
         }
      }
-     if ((state == 6) && available){
+     if ((state == 9) && available){
           i->setHoldPosition(false);
      }
 }

Index: trafficcontrol.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/ATC/trafficcontrol.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- trafficcontrol.hxx	21 Feb 2010 14:15:18 -0000	1.8
+++ trafficcontrol.hxx	25 Apr 2010 08:33:26 -0000	1.9
@@ -129,6 +129,7 @@
   void setLeg(int lg) { leg = lg;};
   int getId() { return id;};
   int getState() { return state;};
+  int setState(int s) { state = s;}
   FGATCInstruction getInstruction() { return instruction;};
   bool hasInstruction() { return instruction.hasInstruction(); };
   void setPositionAndHeading(double lat, double lon, double hdg, double spd, double alt);
@@ -210,7 +211,10 @@
  *************************************************************************************/
 class FGATCController
 {
-private:
+protected:
+  bool available;
+  time_t lastTransmission;
+
   double dt_count;
 
 
@@ -220,18 +224,27 @@
 public:
   typedef enum {
       MSG_ANNOUNCE_ENGINE_START,
-      MSG_REQUEST_ENGINE_START, 
+      MSG_REQUEST_ENGINE_START,
       MSG_PERMIT_ENGINE_START,
       MSG_DENY_ENGINE_START,
       MSG_ACKNOWLEDGE_ENGINE_START,
       MSG_REQUEST_PUSHBACK_CLEARANCE,
-      MSG_PERMIT_PUSHBACK_CLEARANCE, 
+      MSG_PERMIT_PUSHBACK_CLEARANCE,
       MSG_HOLD_PUSHBACK_CLEARANCE,
-      MSG_ACKNOWLEDGE_SWITCH_GROUND_FREQUENCY } AtcMsgId;
+      MSG_ACKNOWLEDGE_SWITCH_GROUND_FREQUENCY,
+      MSG_INITIATE_CONTACT,
+      MSG_ACKNOWLEDGE_INITIATE_CONTACT,
+      MSG_REQUEST_TAXI_CLEARANCE,
+      MSG_ISSUE_TAXI_CLEARANCE,
+      MSG_ACKNOWLEDGE_TAXI_CLEARANCE,
+      MSG_HOLD_POSITION,
+      MSG_ACKNOWLEDGE_HOLD_POSITION,
+      MSG_RESUME_TAXI,
+      MSG_ACKNOWLEDGE_RESUME_TAXI } AtcMsgId;
   typedef enum {
       ATC_AIR_TO_GROUND,
       ATC_GROUND_TO_AIR } AtcMsgDir;
-  FGATCController() { dt_count = 0;};
+  FGATCController();
   virtual ~FGATCController() {};
   virtual void announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute,
 				double lat, double lon,
@@ -284,8 +297,6 @@
 {
 private:
   TrafficVector activeTraffic;
-  bool available;
-  time_t lastTransmission;
   //ActiveRunwayVec activeRunways;
   
 public:


------------------------------------------------------------------------------