1 /******************************************************************************
2 * AIFlightPlanCreate.cxx
3 * Written by Durk Talsma, started May, 2004.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 **************************************************************************/
20 #include "AIFlightPlan.hxx"
21 #include <simgear/math/sg_geodesy.hxx>
22 #include <Airports/runways.hxx>
24 #include <Environment/environment_mgr.hxx>
25 #include <Environment/environment.hxx>
28 /* FGAIFlightPlan::create()
29 * dynamically create a flight plan for AI traffic, based on data provided by the
30 * Traffic Manager, when reading a filed flightplan failes. (DT, 2004/07/10)
32 * This is the top-level function, and the only one that is publicly available.
37 // Check lat/lon values during initialization;
38 void FGAIFlightPlan::create(FGAirport *dep, FGAirport *arr, int legNr,
39 double alt, double speed, double latitude,
40 double longitude, bool firstFlight,double radius,
41 const string& fltType, const string& aircraftType,
42 const string& airline)
44 int currWpt = wpt_iterator - waypoints.begin();
48 createPushBack(firstFlight,dep, latitude, longitude,
49 radius, fltType, aircraftType, airline);
52 createTaxi(firstFlight, 1, dep, latitude, longitude,
53 radius, fltType, aircraftType, airline);
56 createTakeOff(firstFlight, dep, speed);
59 createClimb(firstFlight, dep, speed, alt);
62 createCruise(firstFlight, dep,arr, latitude, longitude, speed, alt);
71 createTaxi(false, 2, arr, latitude, longitude, radius,
72 fltType, aircraftType, airline);
75 createParking(arr, radius);
79 SG_LOG(SG_INPUT, SG_ALERT, "AIFlightPlan::create() attempting to create unknown leg"
80 " this is probably an internal program error");
82 wpt_iterator = waypoints.begin()+currWpt;
86 /*******************************************************************
88 * initialize the Aircraft at the parking location
89 ******************************************************************/
90 void FGAIFlightPlan::createPushBack(bool firstFlight, FGAirport *dep,
94 const string& fltType,
95 const string& aircraftType,
96 const string& airline)
105 //int currWpt = wpt_iterator - waypoints.begin();
106 // Erase all existing waypoints.
109 // We only need to get a valid parking if this is the first leg.
110 // Otherwise use the current aircraft position.
113 if (!(dep->getDynamics()->getAvailableParking(&lat, &lon,
116 aircraftType, airline)))
118 SG_LOG(SG_INPUT, SG_WARN, "Could not find parking for a " <<
120 " of flight type " << fltType <<
121 " of airline " << airline <<
122 " at airport " << dep->getId());
127 dep->getDynamics()->getParking(gateId, &lat, &lon, &heading);
132 waypoint *wpt = new waypoint;
135 wpt->longitude = lon;
136 wpt->altitude = dep->getElevation();
138 wpt->crossat = -10000;
139 wpt->gear_down = true;
140 wpt->flaps_down= true;
141 wpt->finished = false;
142 wpt->on_ground = true;
143 waypoints.push_back(wpt);
145 // Add park twice, because it uses park once for initialization and once
146 // to trigger the departure ATC message
147 geo_direct_wgs_84 ( 0, lat, lon, heading,
149 &lat2, &lon2, &az2 );
152 wpt->latitude = lat2;
153 wpt->longitude = lon2;
154 wpt->altitude = dep->getElevation();
156 wpt->crossat = -10000;
157 wpt->gear_down = true;
158 wpt->flaps_down= true;
159 wpt->finished = false;
160 wpt->on_ground = true;
161 waypoints.push_back(wpt);
162 geo_direct_wgs_84 ( 0, lat, lon, heading,
164 &lat2, &lon2, &az2 );
166 wpt->name = "taxiStart";
167 wpt->latitude = lat2;
168 wpt->longitude = lon2;
169 wpt->altitude = dep->getElevation();
171 wpt->crossat = -10000;
172 wpt->gear_down = true;
173 wpt->flaps_down= true;
174 wpt->finished = false;
175 wpt->on_ground = true;
176 waypoints.push_back(wpt);
179 /*******************************************************************
181 * initialize the Aircraft at the parking location
182 ******************************************************************/
183 void FGAIFlightPlan::createTaxi(bool firstFlight, int direction,
184 FGAirport *apt, double latitude, double longitude,
185 double radius, const string& fltType,
186 const string& acType, const string& airline)
192 double lat2, lon2, az2;
195 int nrWaypointsToSkip;
199 // If this function is called during initialization,
200 // make sure we obtain a valid gate ID first
201 // and place the model at the location of the gate.
204 if (!(apt->getDynamics()->getAvailableParking(&lat, &lon,
209 SG_LOG(SG_INPUT, SG_WARN, "Could not find parking for a " <<
211 " of flight type " << fltType <<
212 " of airline " << airline <<
213 " at airport " << apt->getId());
215 //waypoint *wpt = new waypoint;
216 //wpt->name = "park";
217 //wpt->latitude = lat;
218 //wpt->longitude = lon;
219 //wpt->altitude = apt->getElevation();
221 //wpt->crossat = -10000;
222 //wpt->gear_down = true;
223 //wpt->flaps_down= true;
224 //wpt->finished = false;
225 //wpt->on_ground = true;
226 //waypoints.push_back(wpt);
228 // "NOTE: this is currently fixed to "com" for commercial traffic
229 // Should be changed to be used dynamically to allow "gen" and "mil"
231 apt->getDynamics()->getActiveRunway("com", 1, activeRunway);
232 if (!(globals->get_runways()->search(apt->getId(),
236 SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
238 " at airport " << apt->getId());
242 // Determine the beginning of he runway
243 heading = rwy._heading;
244 double azimuth = heading + 180.0;
245 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
246 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
247 rwy._length * SG_FEET_TO_METER * 0.5 - 5.0,
248 &lat2, &lon2, &az2 );
250 if (apt->getDynamics()->getGroundNetwork()->exists())
253 int runwayId = apt->getDynamics()->getGroundNetwork()->findNearestNode(lat2,
257 // A negative gateId indicates an overflow parking, use a
258 // fallback mechanism for this.
259 // Starting from gate 0 in this case is a bit of a hack
260 // which requires a more proper solution later on.
264 taxiRoute = new FGTaxiRoute;
266 *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(gateId,
269 *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(0, runwayId);
272 if (taxiRoute->empty()) {
273 //Add the runway startpoint;
275 wpt->name = "Airport Center";
276 wpt->latitude = latitude;
277 wpt->longitude = longitude;
278 wpt->altitude = apt->getElevation();
280 wpt->crossat = -10000;
281 wpt->gear_down = true;
282 wpt->flaps_down= true;
283 wpt->finished = false;
284 wpt->on_ground = true;
285 waypoints.push_back(wpt);
287 //Add the runway startpoint;
289 wpt->name = "Runway Takeoff";
290 wpt->latitude = lat2;
291 wpt->longitude = lon2;
292 wpt->altitude = apt->getElevation();
294 wpt->crossat = -10000;
295 wpt->gear_down = true;
296 wpt->flaps_down= true;
297 wpt->finished = false;
298 wpt->on_ground = true;
299 waypoints.push_back(wpt);
303 bool isPushBackPoint = false;
305 // If this is called during initialization, randomly
306 // skip a number of waypoints to get a more realistic
308 isPushBackPoint = true;
309 int nrWaypoints = taxiRoute->size();
310 nrWaypointsToSkip = rand() % nrWaypoints;
311 // but make sure we always keep two active waypoints
312 // to prevent a segmentation fault
313 for (int i = 0; i < nrWaypointsToSkip-2; i++) {
314 isPushBackPoint = false;
315 taxiRoute->next(&node);
319 //chop off the first two waypoints, because
320 // those have already been created
321 // by create pushback
322 int size = taxiRoute->size();
324 taxiRoute->next(&node);
325 taxiRoute->next(&node);
328 while(taxiRoute->next(&node))
330 //FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findSegment(node)->getEnd();
331 FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findNode(node);
334 wpt->name = "taxiway"; // fixme: should be the name of the taxiway
335 wpt->latitude = tn->getLatitude();
336 wpt->longitude = tn->getLongitude();
337 // Elevation is currently disregarded when on_ground is true
338 // because the AIModel obtains a periodic ground elevation estimate.
339 wpt->altitude = apt->getElevation();
340 if (isPushBackPoint) {
342 isPushBackPoint = false;
347 wpt->crossat = -10000;
348 wpt->gear_down = true;
349 wpt->flaps_down= true;
350 wpt->finished = false;
351 wpt->on_ground = true;
352 waypoints.push_back(wpt);
355 // finally, rewind the taxiRoute object to the point where we started
358 for (int i = 0; i < nrWaypointsToSkip-2; i++) {
359 taxiRoute->next(&node);
362 int size = taxiRoute->size();
364 taxiRoute->next(&node);
365 taxiRoute->next(&node);
372 // This is the fallback mechanism, in case no ground network is available
373 //Add the runway startpoint;
375 wpt->name = "Airport Center";
376 wpt->latitude = apt->getLatitude();
377 wpt->longitude = apt->getLongitude();
378 wpt->altitude = apt->getElevation();
380 wpt->crossat = -10000;
381 wpt->gear_down = true;
382 wpt->flaps_down= true;
383 wpt->finished = false;
384 wpt->on_ground = true;
385 waypoints.push_back(wpt);
387 //Add the runway startpoint;
389 wpt->name = "Runway Takeoff";
390 wpt->latitude = lat2;
391 wpt->longitude = lon2;
392 wpt->altitude = apt->getElevation();
394 wpt->crossat = -10000;
395 wpt->gear_down = true;
396 wpt->flaps_down= true;
397 wpt->finished = false;
398 wpt->on_ground = true;
399 waypoints.push_back(wpt);
404 apt->getDynamics()->getAvailableParking(&lat, &lon, &heading,
405 &gateId, radius, fltType,
408 double lat3 = (*(waypoints.end()-1))->latitude;
409 double lon3 = (*(waypoints.end()-1))->longitude;
410 //cerr << (*(waypoints.end()-1))->name << endl;
412 // Find a route from runway end to parking/gate.
413 if (apt->getDynamics()->getGroundNetwork()->exists())
416 int runwayId = apt->getDynamics()->getGroundNetwork()->findNearestNode(lat3,
418 // A negative gateId indicates an overflow parking, use a
419 // fallback mechanism for this.
420 // Starting from gate 0 is a bit of a hack...
424 taxiRoute = new FGTaxiRoute;
426 *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(runwayId,
429 *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(runwayId, 0);
432 // No route found: go from gate directly to runway
433 if (taxiRoute->empty()) {
434 //Add the runway startpoint;
436 wpt->name = "Airport Center";
437 wpt->latitude = latitude;
438 wpt->longitude = longitude;
439 wpt->altitude = apt->getElevation();
441 wpt->crossat = -10000;
442 wpt->gear_down = true;
443 wpt->flaps_down= true;
444 wpt->finished = false;
445 wpt->on_ground = true;
446 waypoints.push_back(wpt);
448 //Add the runway startpoint;
450 wpt->name = "Runway Takeoff";
451 wpt->latitude = lat2;
452 wpt->longitude = lon2;
453 wpt->altitude = apt->getElevation();
455 wpt->crossat = -10000;
456 wpt->gear_down = true;
457 wpt->flaps_down= true;
458 wpt->finished = false;
459 wpt->on_ground = true;
460 waypoints.push_back(wpt);
464 int size = taxiRoute->size();
465 // Omit the last two waypoints, as
466 // those are created by createParking()
467 for (int i = 0; i < size-2; i++)
469 taxiRoute->next(&node);
470 //FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findNode(node);
471 FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findNode(node);
473 wpt->name = "taxiway"; // fixme: should be the name of the taxiway
474 wpt->latitude = tn->getLatitude();
475 wpt->longitude = tn->getLongitude();
476 wpt->altitude = apt->getElevation();
478 wpt->crossat = -10000;
479 wpt->gear_down = true;
480 wpt->flaps_down= true;
481 wpt->finished = false;
482 wpt->on_ground = true;
483 waypoints.push_back(wpt);
489 // Use a fallback mechanism in case no ground network is available
490 // obtain the location of the gate entrance point
494 geo_direct_wgs_84 ( 0, lat, lon, heading,
496 &lat2, &lon2, &az2 );
498 wpt->name = "Airport Center";
499 wpt->latitude = apt->getLatitude();
500 wpt->longitude = apt->getLongitude();
501 wpt->altitude = apt->getElevation();
503 wpt->crossat = -10000;
504 wpt->gear_down = true;
505 wpt->flaps_down= true;
506 wpt->finished = false;
507 wpt->on_ground = true;
508 waypoints.push_back(wpt);
511 wpt->name = "Begin Parking"; //apt->getId(); //wpt_node->getStringValue("name", "END");
512 wpt->latitude = lat2;
513 wpt->longitude = lon2;
514 wpt->altitude = apt->getElevation();
516 wpt->crossat = -10000;
517 wpt->gear_down = true;
518 wpt->flaps_down= true;
519 wpt->finished = false;
520 wpt->on_ground = true;
521 waypoints.push_back(wpt);
527 apt->getDynamics()->getParking(gateId, &lat, &lon, &heading);
533 wpt->name = "END"; //wpt_node->getStringValue("name", "END");
535 wpt->longitude = lon;
538 wpt->crossat = -10000;
539 wpt->gear_down = true;
540 wpt->flaps_down= true;
541 wpt->finished = false;
542 wpt->on_ground = true;
543 waypoints.push_back(wpt);
549 /*******************************************************************
551 * initialize the Aircraft at the parking location
552 ******************************************************************/
553 void FGAIFlightPlan::createTakeOff(bool firstFlight, FGAirport *apt, double speed)
559 double lat2, lon2, az2;
562 // Get the current active runway, based on code from David Luff
563 // This should actually be unified and extended to include
564 // Preferential runway use schema's
568 // "NOTE: this is currently fixed to "com" for commercial traffic
569 // Should be changed to be used dynamically to allow "gen" and "mil"
571 apt->getDynamics()->getActiveRunway("com", 1, activeRunway);
572 if (!(globals->get_runways()->search(apt->getId(),
576 SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
578 " at airport " << apt->getId());
582 heading = rwy._heading;
583 double azimuth = heading + 180.0;
584 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
585 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
586 rwy._length * SG_FEET_TO_METER * 0.5 - 105.0,
587 &lat2, &lon2, &az2 );
590 wpt->latitude = lat2;
591 wpt->longitude = lon2;
592 wpt->altitude = apt->getElevation();
594 wpt->crossat = -10000;
595 wpt->gear_down = true;
596 wpt->flaps_down= true;
597 wpt->finished = false;
598 wpt->on_ground = true;
599 waypoints.push_back(wpt);
605 //Next: the Start of Climb
606 geo_direct_wgs_84 ( 0, lat, lon, heading,
607 2560 * SG_FEET_TO_METER,
608 &lat2, &lon2, &az2 );
612 wpt->latitude = lat2;
613 wpt->longitude = lon2;
614 wpt->altitude = apt->getElevation()+3000;
616 wpt->crossat = -10000;
617 wpt->gear_down = true;
618 wpt->flaps_down= true;
619 wpt->finished = false;
620 wpt->on_ground = false;
621 waypoints.push_back(wpt);
624 /*******************************************************************
626 * initialize the Aircraft at the parking location
627 ******************************************************************/
628 void FGAIFlightPlan::createClimb(bool firstFlight, FGAirport *apt, double speed, double alt)
635 double lat2, lon2, az2;
643 // "NOTE: this is currently fixed to "com" for commercial traffic
644 // Should be changed to be used dynamically to allow "gen" and "mil"
646 apt->getDynamics()->getActiveRunway("com", 1, activeRunway);
647 if (!(globals->get_runways()->search(apt->getId(),
651 SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
653 " at airport " << apt->getId());
659 heading = rwy._heading;
660 double azimuth = heading + 180.0;
661 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
662 //cerr << "Creating climb at : " << rwy._id << " " << rwy._rwy_no << endl;
663 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, heading,
665 &lat2, &lon2, &az2 );
667 wpt->name = "10000ft climb";
668 wpt->latitude = lat2;
669 wpt->longitude = lon2;
670 wpt->altitude = 10000;
672 wpt->crossat = -10000;
673 wpt->gear_down = true;
674 wpt->flaps_down= true;
675 wpt->finished = false;
676 wpt->on_ground = false;
677 waypoints.push_back(wpt);
680 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, heading,
682 &lat2, &lon2, &az2 );
684 wpt->name = "18000ft climb";
685 wpt->latitude = lat2;
686 wpt->longitude = lon2;
687 wpt->altitude = 18000;
689 wpt->crossat = -10000;
690 wpt->gear_down = true;
691 wpt->flaps_down= true;
692 wpt->finished = false;
693 wpt->on_ground = false;
694 waypoints.push_back(wpt);
698 // /*******************************************************************
700 // * initialize the Aircraft at the parking location
701 // ******************************************************************/
702 // void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
703 // FGAirport *arr, double latitude,
704 // double longitude, double speed,
707 // double wind_speed;
708 // double wind_heading;
710 // double lat, lon, az;
711 // double lat2, lon2, az2;
715 // wpt = new waypoint;
716 // wpt->name = "Cruise"; //wpt_node->getStringValue("name", "END");
717 // wpt->latitude = latitude;
718 // wpt->longitude = longitude;
719 // wpt->altitude = alt;
720 // wpt->speed = speed;
721 // wpt->crossat = -10000;
722 // wpt->gear_down = false;
723 // wpt->flaps_down= false;
724 // wpt->finished = false;
725 // wpt->on_ground = false;
726 // waypoints.push_back(wpt);
729 // // should be changed dynamically to allow "gen" and "mil"
730 // arr->getDynamics()->getActiveRunway("com", 2, activeRunway);
731 // if (!(globals->get_runways()->search(arr->getId(),
735 // SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
737 // " at airport " << arr->getId());
740 // heading = rwy._heading;
741 // azimuth = heading + 180.0;
742 // while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
745 // geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
747 // &lat2, &lon2, &az2 );
748 // wpt = new waypoint;
749 // wpt->name = "BOD";
750 // wpt->latitude = lat2;
751 // wpt->longitude = lon2;
752 // wpt->altitude = alt;
753 // wpt->speed = speed;
754 // wpt->crossat = alt;
755 // wpt->gear_down = false;
756 // wpt->flaps_down= false;
757 // wpt->finished = false;
758 // wpt->on_ground = false;
759 // waypoints.push_back(wpt);
762 /*******************************************************************
764 * initialize the Aircraft at the parking location
765 ******************************************************************/
766 void FGAIFlightPlan::createDecent(FGAirport *apt)
769 // Ten thousand ft. Slowing down to 240 kts
775 double lat2, lon2, az2;
780 //Beginning of Decent
782 // allow "mil" and "gen" as well
783 apt->getDynamics()->getActiveRunway("com", 2, activeRunway);
784 if (!(globals->get_runways()->search(apt->getId(),
788 SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
790 " at airport " << apt->getId());
794 heading = rwy._heading;
795 azimuth = heading + 180.0;
796 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
797 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
799 &lat2, &lon2, &az2 );
802 wpt->name = "Dec 10000ft"; //wpt_node->getStringValue("name", "END");
803 wpt->latitude = lat2;
804 wpt->longitude = lon2;
805 wpt->altitude = apt->getElevation();
807 wpt->crossat = 10000;
808 wpt->gear_down = false;
809 wpt->flaps_down= false;
810 wpt->finished = false;
811 wpt->on_ground = false;
812 waypoints.push_back(wpt);
814 // Three thousand ft. Slowing down to 160 kts
815 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
817 &lat2, &lon2, &az2 );
819 wpt->name = "DEC 3000ft"; //wpt_node->getStringValue("name", "END");
820 wpt->latitude = lat2;
821 wpt->longitude = lon2;
822 wpt->altitude = apt->getElevation();
825 wpt->gear_down = true;
826 wpt->flaps_down= true;
827 wpt->finished = false;
828 wpt->on_ground = false;
829 waypoints.push_back(wpt);
831 /*******************************************************************
833 * initialize the Aircraft at the parking location
834 ******************************************************************/
835 void FGAIFlightPlan::createLanding(FGAirport *apt)
837 // Ten thousand ft. Slowing down to 150 kts
843 double lat2, lon2, az2;
849 heading = rwy._heading;
850 azimuth = heading + 180.0;
851 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
854 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
855 rwy._length*0.45 * SG_FEET_TO_METER,
856 &lat2, &lon2, &az2 );
858 wpt->name = "Threshold"; //wpt_node->getStringValue("name", "END");
859 wpt->latitude = lat2;
860 wpt->longitude = lon2;
861 wpt->altitude = apt->getElevation();
863 wpt->crossat = apt->getElevation();
864 wpt->gear_down = true;
865 wpt->flaps_down= true;
866 wpt->finished = false;
867 wpt->on_ground = true;
868 waypoints.push_back(wpt);
870 //Full stop at the runway centerpoint
871 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
873 &lat2, &lon2, &az2 );
875 wpt->name = "Center"; //wpt_node->getStringValue("name", "END");
876 wpt->latitude = rwy._lat;
877 wpt->longitude = rwy._lon;
878 wpt->altitude = apt->getElevation();
880 wpt->crossat = -10000;
881 wpt->gear_down = true;
882 wpt->flaps_down= true;
883 wpt->finished = false;
884 wpt->on_ground = true;
885 waypoints.push_back(wpt);
887 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, heading,
888 rwy._length*0.45 * SG_FEET_TO_METER,
889 &lat2, &lon2, &az2 );
891 wpt->name = "Threshold"; //wpt_node->getStringValue("name", "END");
892 wpt->latitude = lat2;
893 wpt->longitude = lon2;
894 wpt->altitude = apt->getElevation();
896 wpt->crossat = apt->getElevation();
897 wpt->gear_down = true;
898 wpt->flaps_down= true;
899 wpt->finished = false;
900 wpt->on_ground = true;
901 waypoints.push_back(wpt);
904 /*******************************************************************
906 * initialize the Aircraft at the parking location
907 ******************************************************************/
908 void FGAIFlightPlan::createParking(FGAirport *apt, double radius)
915 apt->getDynamics()->getParking(gateId, &lat, &lon, &heading);
919 geo_direct_wgs_84 ( 0, lat, lon, heading,
921 &lat2, &lon2, &az2 );
923 wpt->name = "taxiStart";
924 wpt->latitude = lat2;
925 wpt->longitude = lon2;
926 wpt->altitude = apt->getElevation();
928 wpt->crossat = -10000;
929 wpt->gear_down = true;
930 wpt->flaps_down= true;
931 wpt->finished = false;
932 wpt->on_ground = true;
933 waypoints.push_back(wpt);
934 geo_direct_wgs_84 ( 0, lat, lon, heading,
936 &lat2, &lon2, &az2 );
938 wpt->name = "taxiStart";
939 wpt->latitude = lat2;
940 wpt->longitude = lon2;
941 wpt->altitude = apt->getElevation();
943 wpt->crossat = -10000;
944 wpt->gear_down = true;
945 wpt->flaps_down= true;
946 wpt->finished = false;
947 wpt->on_ground = true;
948 waypoints.push_back(wpt);
951 wpt->name = "END"; //wpt_node->getStringValue("name", "END");
953 wpt->longitude = lon;
954 wpt->altitude = apt->getElevation();
956 wpt->crossat = -10000;
957 wpt->gear_down = true;
958 wpt->flaps_down= true;
959 wpt->finished = false;
960 wpt->on_ground = true;
961 waypoints.push_back(wpt);