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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 **************************************************************************/
21 #include "AIFlightPlan.hxx"
22 #include <simgear/math/sg_geodesy.hxx>
23 #include <Airports/runways.hxx>
25 #include <Environment/environment_mgr.hxx>
26 #include <Environment/environment.hxx>
29 /* FGAIFlightPlan::create()
30 * dynamically create a flight plan for AI traffic, based on data provided by the
31 * Traffic Manager, when reading a filed flightplan failes. (DT, 2004/07/10)
33 * This is the top-level function, and the only one that publicly available.
38 // Check lat/lon values during initialization;
39 void FGAIFlightPlan::create(FGAirport *dep, FGAirport *arr, int legNr, double alt, double speed,
40 double latitude, double longitude, bool firstFlight,
41 double radius, const string& fltType, const string& aircraftType, const string& airline)
43 int currWpt = wpt_iterator - waypoints.begin();
47 //cerr << "Creating Push_Back" << endl;
48 createPushBack(firstFlight,dep, latitude, longitude, radius, fltType, aircraftType, airline);
49 //cerr << "Done" << endl;
52 //cerr << "Creating Taxi" << endl;
53 createTaxi(firstFlight, 1, dep, latitude, longitude, radius, fltType, aircraftType, airline);
56 //cerr << "Creating TAkeoff" << endl;
57 createTakeOff(firstFlight, dep, speed);
60 //cerr << "Creating Climb" << endl;
61 createClimb(firstFlight, dep, speed, alt);
64 //cerr << "Creating Cruise" << endl;
65 createCruise(firstFlight, dep,arr, latitude, longitude, speed, alt);
68 //cerr << "Creating Decent" << endl;
72 //cerr << "Creating Landing" << endl;
76 //cerr << "Creating Taxi 2" << endl;
77 createTaxi(false, 2, arr, latitude, longitude, radius, fltType, aircraftType, airline);
80 //cerr << "Creating Parking" << endl;
85 cerr << "Unknown case: " << legNr << endl;
87 wpt_iterator = waypoints.begin()+currWpt;
91 /*******************************************************************
93 * initialize the Aircraft at the parking location
94 ******************************************************************/
95 void FGAIFlightPlan::createPushBack(bool firstFlight, FGAirport *dep,
99 const string& fltType,
100 const string& aircraftType,
101 const string& airline)
110 //int currWpt = wpt_iterator - waypoints.begin();
111 // Erase all existing waypoints.
114 // We only need to get a valid parking if this is the first leg.
115 // Otherwise use the current aircraft position.
118 if (!(dep->getAvailableParking(&lat, &lon, &heading, &gateId, radius, fltType, aircraftType, airline)))
120 cerr << "Could not find parking " << endl;
125 dep->getParking(gateId, &lat, &lon, &heading);
128 //heading = getHeading();
133 waypoint *wpt = new waypoint;
136 wpt->longitude = lon;
137 wpt->altitude = dep->getElevation();
139 wpt->crossat = -10000;
140 wpt->gear_down = true;
141 wpt->flaps_down= true;
142 wpt->finished = false;
143 wpt->on_ground = true;
144 waypoints.push_back(wpt);
146 // Add park twice, because it uses park once for initialization and once
147 // to trigger the departure ATC message
148 geo_direct_wgs_84 ( 0, lat, lon, heading,
150 &lat2, &lon2, &az2 );
153 wpt->latitude = lat2;
154 wpt->longitude = lon2;
155 wpt->altitude = dep->getElevation();
157 wpt->crossat = -10000;
158 wpt->gear_down = true;
159 wpt->flaps_down= true;
160 wpt->finished = false;
161 wpt->on_ground = true;
162 waypoints.push_back(wpt);
163 geo_direct_wgs_84 ( 0, lat, lon, heading,
164 radius, // push back one entire aircraft radius
165 &lat2, &lon2, &az2 );
167 wpt->name = "taxiStart";
168 wpt->latitude = lat2;
169 wpt->longitude = lon2;
170 wpt->altitude = dep->getElevation();
172 wpt->crossat = -10000;
173 wpt->gear_down = true;
174 wpt->flaps_down= true;
175 wpt->finished = false;
176 wpt->on_ground = true;
177 waypoints.push_back(wpt);
182 /*******************************************************************
184 * initialize the Aircraft at the parking location
185 ******************************************************************/
186 void FGAIFlightPlan::createTaxi(bool firstFlight, int direction, FGAirport *apt, double latitude, double longitude, double radius, const string& fltType, const string& acType, const string& airline)
193 double lat2, lon2, az2;
197 // Erase all existing waypoints.
198 // wpt_vector_iterator i= waypoints.begin();
200 //int currWpt = wpt_iterator - waypoints.begin();
204 // "NOTE: this is currently fixed to "com" for commercial traffic
205 // Should be changed to be used dynamically to allow "gen" and "mil"
207 apt->getActiveRunway("com", 1, activeRunway);
208 if (!(globals->get_runways()->search(apt->getId(),
212 cout << "Failed to find runway for " << apt->getId() << endl;
213 // Hmm, how do we handle a potential error like this?
217 //apt->getActiveRunway(string("com"), 1, test);
220 heading = rwy._heading;
221 double azimuth = heading + 180.0;
222 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
223 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
224 rwy._length * SG_FEET_TO_METER * 0.5 - 5.0,
225 &lat2, &lon2, &az2 );
226 if (apt->getGroundNetwork()->exists())
229 int runwayId = apt->getGroundNetwork()->findNearestNode(lat2, lon2);
230 //int currId = apt->getGroundNetwork()->findNearestNode(latitude,longitude);
233 // A negative gateId indicates an overflow parking, use a
234 // fallback mechanism for this.
235 // Starting from gate 0 is a bit of a hack...
238 route = apt->getGroundNetwork()->findShortestRoute(gateId, runwayId);
240 route = apt->getGroundNetwork()->findShortestRoute(0, runwayId);
242 //cerr << "creating route : ";
243 // No route found: go from gate directly to runway
245 //Add the runway startpoint;
247 wpt->name = "Airport Center";
248 wpt->latitude = latitude;
249 wpt->longitude = longitude;
250 wpt->altitude = apt->getElevation();
252 wpt->crossat = -10000;
253 wpt->gear_down = true;
254 wpt->flaps_down= true;
255 wpt->finished = false;
256 wpt->on_ground = true;
257 waypoints.push_back(wpt);
259 //Add the runway startpoint;
261 wpt->name = "Runway Takeoff";
262 wpt->latitude = lat2;
263 wpt->longitude = lon2;
264 wpt->altitude = apt->getElevation();
266 wpt->crossat = -10000;
267 wpt->gear_down = true;
268 wpt->flaps_down= true;
269 wpt->finished = false;
270 wpt->on_ground = true;
271 waypoints.push_back(wpt);
275 while(route.next(&node))
278 //cerr << "Creating Node: " << node << endl;
279 FGTaxiNode *tn = apt->getGroundNetwork()->findNode(node);
282 wpt->name = "taxiway"; // fixme: should be the name of the taxiway
283 wpt->latitude = tn->getLatitude();
284 wpt->longitude = tn->getLongitude();
285 wpt->altitude = apt->getElevation(); // should maybe be tn->elev too
287 wpt->crossat = -10000;
288 wpt->gear_down = true;
289 wpt->flaps_down= true;
290 wpt->finished = false;
291 wpt->on_ground = true;
292 waypoints.push_back(wpt);
300 //Add the runway startpoint;
302 wpt->name = "Airport Center";
303 wpt->latitude = apt->getLatitude();
304 wpt->longitude = apt->getLongitude();
305 wpt->altitude = apt->getElevation();
307 wpt->crossat = -10000;
308 wpt->gear_down = true;
309 wpt->flaps_down= true;
310 wpt->finished = false;
311 wpt->on_ground = true;
312 waypoints.push_back(wpt);
314 //Add the runway startpoint;
316 wpt->name = "Runway Takeoff";
317 wpt->latitude = lat2;
318 wpt->longitude = lon2;
319 wpt->altitude = apt->getElevation();
321 wpt->crossat = -10000;
322 wpt->gear_down = true;
323 wpt->flaps_down= true;
324 wpt->finished = false;
325 wpt->on_ground = true;
326 waypoints.push_back(wpt);
327 //wpt = new waypoint;
328 //wpt->finished = false;
329 //waypoints.push_back(wpt); // add one more to prevent a segfault.
335 // "NOTE: this is currently fixed to "com" for commercial traffic
336 // Should be changed to be used dynamically to allow "gen" and "mil"
338 //apt->getActiveRunway("com", 1, name);
339 //if (!(globals->get_runways()->search(apt->getId(),
343 //cout << "Failed to find runway for " << apt->getId() << endl;
344 // Hmm, how do we handle a potential error like this?
348 //apt->getActiveRunway(string("com"), 1, test);
351 //heading = rwy._heading;
352 //double azimuth = heading + 180.0;
353 //while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
354 //geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
355 // rwy._length * SG_FEET_TO_METER * 0.5 - 5.0,
356 // &lat2, &lon2, &az2 );
357 apt->getAvailableParking(&lat, &lon, &heading, &gateId, radius, fltType, acType, airline);
361 geo_direct_wgs_84 ( 0, lat, lon, heading,
363 &lat2, &lon2, &az2 );
364 double lat3 = (*(waypoints.end()-1))->latitude;
365 double lon3 = (*(waypoints.end()-1))->longitude;
366 cerr << (*(waypoints.end()-1))->name << endl;
367 if (apt->getGroundNetwork()->exists())
370 int runwayId = apt->getGroundNetwork()->findNearestNode(lat3, lon3);
371 //int currId = apt->getGroundNetwork()->findNearestNode(latitude,longitude);
374 // A negative gateId indicates an overflow parking, use a
375 // fallback mechanism for this.
376 // Starting from gate 0 is a bit of a hack...
379 route = apt->getGroundNetwork()->findShortestRoute(runwayId, gateId);
381 route = apt->getGroundNetwork()->findShortestRoute(runwayId, 0);
383 //cerr << "creating route : ";
384 // No route found: go from gate directly to runway
386 //Add the runway startpoint;
388 wpt->name = "Airport Center";
389 wpt->latitude = latitude;
390 wpt->longitude = longitude;
391 wpt->altitude = apt->getElevation();
393 wpt->crossat = -10000;
394 wpt->gear_down = true;
395 wpt->flaps_down= true;
396 wpt->finished = false;
397 wpt->on_ground = true;
398 waypoints.push_back(wpt);
400 //Add the runway startpoint;
402 wpt->name = "Runway Takeoff";
403 wpt->latitude = lat2;
404 wpt->longitude = lon2;
405 wpt->altitude = apt->getElevation();
407 wpt->crossat = -10000;
408 wpt->gear_down = true;
409 wpt->flaps_down= true;
410 wpt->finished = false;
411 wpt->on_ground = true;
412 waypoints.push_back(wpt);
416 while(route.next(&node))
419 //cerr << "Creating Node: " << node << endl;
420 FGTaxiNode *tn = apt->getGroundNetwork()->findNode(node);
423 wpt->name = "taxiway"; // fixme: should be the name of the taxiway
424 wpt->latitude = tn->getLatitude();
425 wpt->longitude = tn->getLongitude();
426 wpt->altitude = apt->getElevation(); // should maybe be tn->elev too
428 wpt->crossat = -10000;
429 wpt->gear_down = true;
430 wpt->flaps_down= true;
431 wpt->finished = false;
432 wpt->on_ground = true;
433 waypoints.push_back(wpt);
441 //Add the runway startpoint;
443 wpt->name = "Airport Center";
444 wpt->latitude = apt->getLatitude();
445 wpt->longitude = apt->getLongitude();
446 wpt->altitude = apt->getElevation();
448 wpt->crossat = -10000;
449 wpt->gear_down = true;
450 wpt->flaps_down= true;
451 wpt->finished = false;
452 wpt->on_ground = true;
453 waypoints.push_back(wpt);
460 // Add the final destination waypoint
462 wpt->name = "Begin Parking"; //apt->getId(); //wpt_node->getStringValue("name", "END");
463 wpt->latitude = lat2;
464 wpt->longitude = lon2;
465 wpt->altitude = apt->getElevation();
467 wpt->crossat = -10000;
468 wpt->gear_down = true;
469 wpt->flaps_down= true;
470 wpt->finished = false;
471 wpt->on_ground = true;
472 waypoints.push_back(wpt);
476 // wpt_iterator = waypoints.begin();
479 //wpt_iterator = waypoints.begin()+currWpt;
482 /*******************************************************************
484 * initialize the Aircraft at the parking location
485 ******************************************************************/
486 void FGAIFlightPlan::createTakeOff(bool firstFlight, FGAirport *apt, double speed)
493 double lat2, lon2, az2;
498 // Erase all existing waypoints.
499 // wpt_vector_iterator i= waypoints.begin();
500 //while(waypoints.begin() != waypoints.end())
503 // waypoints.erase(i);
508 // Get the current active runway, based on code from David Luff
509 // This should actually be unified and extended to include
510 // Preferential runway use schema's
514 // "NOTE: this is currently fixed to "com" for commercial traffic
515 // Should be changed to be used dynamically to allow "gen" and "mil"
517 apt->getActiveRunway("com", 1, activeRunway);
518 if (!(globals->get_runways()->search(apt->getId(),
522 cout << "Failed to find runway for " << apt->getId() << endl;
523 // Hmm, how do we handle a potential error like this?
527 //apt->getActiveRunway(string("com"), 1, test);
531 heading = rwy._heading;
532 double azimuth = heading + 180.0;
533 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
534 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
535 rwy._length * SG_FEET_TO_METER * 0.5 - 105.0,
536 &lat2, &lon2, &az2 );
539 wpt->latitude = lat2;
540 wpt->longitude = lon2;
541 wpt->altitude = apt->getElevation();
543 wpt->crossat = -10000;
544 wpt->gear_down = true;
545 wpt->flaps_down= true;
546 wpt->finished = false;
547 wpt->on_ground = true;
548 waypoints.push_back(wpt);
554 //Next: the Start of Climb
555 geo_direct_wgs_84 ( 0, lat, lon, heading,
556 2560 * SG_FEET_TO_METER,
557 &lat2, &lon2, &az2 );
561 wpt->latitude = lat2;
562 wpt->longitude = lon2;
563 wpt->altitude = apt->getElevation()+3000;
565 wpt->crossat = -10000;
566 wpt->gear_down = true;
567 wpt->flaps_down= true;
568 wpt->finished = false;
569 wpt->on_ground = false;
570 waypoints.push_back(wpt);
571 // waypoints.push_back(wpt);
572 //waypoints.push_back(wpt); // add one more to prevent a segfault.
573 // wpt_iterator = waypoints.begin();
578 /*******************************************************************
580 * initialize the Aircraft at the parking location
581 ******************************************************************/
582 void FGAIFlightPlan::createClimb(bool firstFlight, FGAirport *apt, double speed, double alt)
589 double lat2, lon2, az2;
593 // Erase all existing waypoints.
594 // wpt_vector_iterator i= waypoints.begin();
595 //while(waypoints.begin() != waypoints.end())
598 // waypoints.erase(i);
603 // Get the current active runway, based on code from David Luff
604 // This should actually be unified and extended to include
605 // Preferential runway use schema's
609 // "NOTE: this is currently fixed to "com" for commercial traffic
610 // Should be changed to be used dynamically to allow "gen" and "mil"
612 apt->getActiveRunway("com", 1, activeRunway);
613 if (!(globals->get_runways()->search(apt->getId(),
617 cout << "Failed to find runway for " << apt->getId() << endl;
618 // Hmm, how do we handle a potential error like this?
622 //apt->getActiveRunway(string("com"), 1, test);
627 heading = rwy._heading;
628 double azimuth = heading + 180.0;
629 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
630 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, heading,
632 &lat2, &lon2, &az2 );
634 wpt->name = "10000ft climb";
635 wpt->latitude = lat2;
636 wpt->longitude = lon2;
637 wpt->altitude = 10000;
639 wpt->crossat = -10000;
640 wpt->gear_down = true;
641 wpt->flaps_down= true;
642 wpt->finished = false;
643 wpt->on_ground = false;
644 waypoints.push_back(wpt);
647 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, heading,
649 &lat2, &lon2, &az2 );
651 wpt->name = "18000ft climb";
652 wpt->latitude = lat2;
653 wpt->longitude = lon2;
654 wpt->altitude = 18000;
656 wpt->crossat = -10000;
657 wpt->gear_down = true;
658 wpt->flaps_down= true;
659 wpt->finished = false;
660 wpt->on_ground = false;
661 waypoints.push_back(wpt);
662 //waypoints.push_back(wpt);
663 //waypoints.push_back(wpt); // add one more to prevent a segfault.
664 // wpt_iterator = waypoints.begin();
670 /*******************************************************************
672 * initialize the Aircraft at the parking location
673 ******************************************************************/
674 void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep, FGAirport *arr, double latitude, double longitude, double speed, double alt)
681 double lat2, lon2, az2;
686 // Erase all existing waypoints.
687 // wpt_vector_iterator i= waypoints.begin();
688 //while(waypoints.begin() != waypoints.end())
691 // waypoints.erase(i);
696 wpt->name = "Cruise"; //wpt_node->getStringValue("name", "END");
697 wpt->latitude = latitude;
698 wpt->longitude = longitude;
701 wpt->crossat = -10000;
702 wpt->gear_down = false;
703 wpt->flaps_down= false;
704 wpt->finished = false;
705 wpt->on_ground = false;
706 waypoints.push_back(wpt);
707 //Beginning of Decent
710 // should be changed dynamically to allow "gen" and "mil"
711 arr->getActiveRunway("com", 2, activeRunway);
712 if (!(globals->get_runways()->search(arr->getId(),
716 cout << "Failed to find runway for " << arr->getId() << endl;
717 // Hmm, how do we handle a potential error like this?
721 //arr->getActiveRunway(string("com"), 1, test);
724 //cerr << "Altitude = " << alt << endl;
725 //cerr << "Done" << endl;
726 //if (arr->getId() == "EHAM")
728 // cerr << "Creating cruise to EHAM " << latitude << " " << longitude << endl;
730 heading = rwy._heading;
731 azimuth = heading + 180.0;
732 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
735 // Note: This places us at the location of the active
736 // runway during initial cruise. This needs to be
738 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
740 &lat2, &lon2, &az2 );
742 wpt->name = "BOD"; //wpt_node->getStringValue("name", "END");
743 wpt->latitude = lat2;
744 wpt->longitude = lon2;
748 wpt->gear_down = false;
749 wpt->flaps_down= false;
750 wpt->finished = false;
751 wpt->on_ground = false;
752 waypoints.push_back(wpt);
753 //waypoints.push_back(wpt);
754 //waypoints.push_back(wpt); // add one more to prevent a segfault.
755 //wpt_iterator = waypoints.begin();
760 /*******************************************************************
762 * initialize the Aircraft at the parking location
763 ******************************************************************/
764 void FGAIFlightPlan::createDecent(FGAirport *apt)
767 // Ten thousand ft. Slowing down to 240 kts
773 double lat2, lon2, az2;
778 //// Erase all existing waypoints.
779 // wpt_vector_iterator i= waypoints.begin();
780 //while(waypoints.begin() != waypoints.end())
783 // waypoints.erase(i);
787 //Beginning of Decent
789 // allow "mil" and "gen" as well
790 apt->getActiveRunway("com", 2, activeRunway);
791 if (!(globals->get_runways()->search(apt->getId(),
795 cout << "Failed to find runway for " << apt->getId() << endl;
796 // Hmm, how do we handle a potential error like this?
800 //apt->getActiveRunway(string("com"), 1, test);
803 //cerr << "Done" << endl;
804 heading = rwy._heading;
805 azimuth = heading + 180.0;
806 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
810 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
812 &lat2, &lon2, &az2 );
815 wpt->name = "Dec 10000ft"; //wpt_node->getStringValue("name", "END");
816 wpt->latitude = lat2;
817 wpt->longitude = lon2;
818 wpt->altitude = apt->getElevation();
820 wpt->crossat = 10000;
821 wpt->gear_down = false;
822 wpt->flaps_down= false;
823 wpt->finished = false;
824 wpt->on_ground = false;
825 waypoints.push_back(wpt);
827 // Three thousand ft. Slowing down to 160 kts
828 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
830 &lat2, &lon2, &az2 );
832 wpt->name = "DEC 3000ft"; //wpt_node->getStringValue("name", "END");
833 wpt->latitude = lat2;
834 wpt->longitude = lon2;
835 wpt->altitude = apt->getElevation();
838 wpt->gear_down = true;
839 wpt->flaps_down= true;
840 wpt->finished = false;
841 wpt->on_ground = false;
842 waypoints.push_back(wpt);
843 //waypoints.push_back(wpt);
844 //waypoints.push_back(wpt); // add one more to prevent a segfault.
845 //wpt_iterator = waypoints.begin();
847 //if (apt->getId() == "EHAM")
849 // cerr << "Created Decend to EHAM " << lat2 << " " << lon2 << ": Runway = " << rwy._rwy_no
850 // << "heading " << heading << endl;
853 /*******************************************************************
855 * initialize the Aircraft at the parking location
856 ******************************************************************/
857 void FGAIFlightPlan::createLanding(FGAirport *apt)
859 // Ten thousand ft. Slowing down to 240 kts
865 double lat2, lon2, az2;
871 heading = rwy._heading;
872 azimuth = heading + 180.0;
873 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
876 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
877 rwy._length*0.45 * SG_FEET_TO_METER,
878 &lat2, &lon2, &az2 );
880 wpt->name = "Threshold"; //wpt_node->getStringValue("name", "END");
881 wpt->latitude = lat2;
882 wpt->longitude = lon2;
883 wpt->altitude = apt->getElevation();
885 wpt->crossat = apt->getElevation();
886 wpt->gear_down = true;
887 wpt->flaps_down= true;
888 wpt->finished = false;
889 wpt->on_ground = true;
890 waypoints.push_back(wpt);
892 //Full stop at the runway centerpoint
893 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
895 &lat2, &lon2, &az2 );
897 wpt->name = "Center"; //wpt_node->getStringValue("name", "END");
898 wpt->latitude = rwy._lat;
899 wpt->longitude = rwy._lon;
900 wpt->altitude = apt->getElevation();
902 wpt->crossat = -10000;
903 wpt->gear_down = true;
904 wpt->flaps_down= true;
905 wpt->finished = false;
906 wpt->on_ground = true;
907 waypoints.push_back(wpt);
909 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, heading,
910 rwy._length*0.45 * SG_FEET_TO_METER,
911 &lat2, &lon2, &az2 );
913 wpt->name = "Threshold"; //wpt_node->getStringValue("name", "END");
914 wpt->latitude = lat2;
915 wpt->longitude = lon2;
916 wpt->altitude = apt->getElevation();
918 wpt->crossat = apt->getElevation();
919 wpt->gear_down = true;
920 wpt->flaps_down= true;
921 wpt->finished = false;
922 wpt->on_ground = true;
923 waypoints.push_back(wpt);
924 //waypoints.push_back(wpt);
925 //waypoints.push_back(wpt); // add one more to prevent a segfault.
926 //wpt_iterator = waypoints.begin();
929 //if (apt->getId() == "EHAM")
931 // cerr << "Created Landing to EHAM " << lat2 << " " << lon2 << ": Runway = " << rwy._rwy_no
932 // << "heading " << heading << endl;
936 /*******************************************************************
938 * initialize the Aircraft at the parking location
939 ******************************************************************/
940 void FGAIFlightPlan::createParking(FGAirport *apt)
946 apt->getParking(gateId, &lat, &lon, &heading);
951 // Erase all existing waypoints.
952 // wpt_vector_iterator i= waypoints.begin();
953 //while(waypoints.begin() != waypoints.end())
956 // waypoints.erase(i);
959 // And finally one more named "END"
961 wpt->name = "END"; //wpt_node->getStringValue("name", "END");
963 wpt->longitude = lon;
966 wpt->crossat = -10000;
967 wpt->gear_down = true;
968 wpt->flaps_down= true;
969 wpt->finished = false;
970 wpt->on_ground = true;
971 waypoints.push_back(wpt);
972 //waypoints.push_back(wpt);
973 //waypoints.push_back(wpt); // add one more to prevent a segfault.
974 //wpt_iterator = waypoints.begin();