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;
144 waypoints.push_back(wpt);
146 geo_direct_wgs_84 ( 0, lat, lon, heading,
148 &lat2, &lon2, &az2 );
151 wpt->latitude = lat2;
152 wpt->longitude = lon2;
153 wpt->altitude = dep->getElevation();
155 wpt->crossat = -10000;
156 wpt->gear_down = true;
157 wpt->flaps_down= true;
158 wpt->finished = false;
159 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;
177 waypoints.push_back(wpt);
180 /*******************************************************************
182 * initialize the Aircraft at the parking location
183 ******************************************************************/
184 void FGAIFlightPlan::createTaxi(bool firstFlight, int direction,
185 FGAirport *apt, double latitude, double longitude,
186 double radius, const string& fltType,
187 const string& acType, const string& airline)
191 double lat2, lon2, az2;
194 int nrWaypointsToSkip;
198 // If this function is called during initialization,
199 // make sure we obtain a valid gate ID first
200 // and place the model at the location of the gate.
203 if (!(apt->getDynamics()->getAvailableParking(&lat, &lon,
208 SG_LOG(SG_INPUT, SG_WARN, "Could not find parking for a " <<
210 " of flight type " << fltType <<
211 " of airline " << airline <<
212 " at airport " << apt->getId());
214 //waypoint *wpt = new waypoint;
215 //wpt->name = "park";
216 //wpt->latitude = lat;
217 //wpt->longitude = lon;
218 //wpt->altitude = apt->getElevation();
220 //wpt->crossat = -10000;
221 //wpt->gear_down = true;
222 //wpt->flaps_down= true;
223 //wpt->finished = false;
224 //wpt->on_ground = true;
225 //waypoints.push_back(wpt);
227 // "NOTE: this is currently fixed to "com" for commercial traffic
228 // Should be changed to be used dynamically to allow "gen" and "mil"
230 apt->getDynamics()->getActiveRunway("com", 1, activeRunway);
231 if (!(globals->get_runways()->search(apt->getId(),
235 SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
237 " at airport " << apt->getId());
241 // Determine the beginning of he runway
242 heading = rwy._heading;
243 double azimuth = heading + 180.0;
244 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
245 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
246 rwy._length * SG_FEET_TO_METER * 0.5 - 5.0,
247 &lat2, &lon2, &az2 );
249 if (apt->getDynamics()->getGroundNetwork()->exists())
252 int runwayId = apt->getDynamics()->getGroundNetwork()->findNearestNode(lat2,
256 // A negative gateId indicates an overflow parking, use a
257 // fallback mechanism for this.
258 // Starting from gate 0 in this case is a bit of a hack
259 // which requires a more proper solution later on.
263 taxiRoute = new FGTaxiRoute;
265 *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(gateId,
268 *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(0, runwayId);
271 if (taxiRoute->empty()) {
272 //Add the runway startpoint;
274 wpt->name = "Airport Center";
275 wpt->latitude = latitude;
276 wpt->longitude = longitude;
277 wpt->altitude = apt->getElevation();
279 wpt->crossat = -10000;
280 wpt->gear_down = true;
281 wpt->flaps_down= true;
282 wpt->finished = false;
283 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;
300 waypoints.push_back(wpt);
304 bool isPushBackPoint = false;
306 // If this is called during initialization, randomly
307 // skip a number of waypoints to get a more realistic
309 isPushBackPoint = true;
310 int nrWaypoints = taxiRoute->size();
311 nrWaypointsToSkip = rand() % nrWaypoints;
312 // but make sure we always keep two active waypoints
313 // to prevent a segmentation fault
314 for (int i = 0; i < nrWaypointsToSkip-2; i++) {
315 isPushBackPoint = false;
316 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);
329 while(taxiRoute->next(&node, &route))
331 //FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findSegment(node)->getEnd();
333 snprintf (buffer, 10, "%d", node);
334 FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findNode(node);
337 wpt->name = string(buffer); // fixme: should be the name of the taxiway
338 wpt->latitude = tn->getLatitude();
339 wpt->longitude = tn->getLongitude();
340 // Elevation is currently disregarded when on_ground is true
341 // because the AIModel obtains a periodic ground elevation estimate.
342 wpt->altitude = apt->getElevation();
343 if (isPushBackPoint) {
345 isPushBackPoint = false;
350 wpt->crossat = -10000;
351 wpt->gear_down = true;
352 wpt->flaps_down= true;
353 wpt->finished = false;
354 wpt->on_ground = true;
355 wpt->routeIndex = route;
356 waypoints.push_back(wpt);
359 // finally, rewind the taxiRoute object to the point where we started
360 // generating the Flightplan, for AI use.
361 // This is a bit tricky, because the
364 for (int i = 0; i < nrWaypointsToSkip-1; i++) {
365 taxiRoute->next(&node);
368 int size = taxiRoute->size();
370 //taxiRoute->next(&node);
371 //taxiRoute->next(&node);
372 //taxiRoute->next(&node);
375 } // taxiRoute not empty
379 // This is the fallback mechanism, in case no ground network is available
380 //Add the runway startpoint;
382 wpt->name = "Airport Center";
383 wpt->latitude = apt->getLatitude();
384 wpt->longitude = apt->getLongitude();
385 wpt->altitude = apt->getElevation();
387 wpt->crossat = -10000;
388 wpt->gear_down = true;
389 wpt->flaps_down= true;
390 wpt->finished = false;
391 wpt->on_ground = true;
393 waypoints.push_back(wpt);
395 //Add the runway startpoint;
397 wpt->name = "Runway Takeoff";
398 wpt->latitude = lat2;
399 wpt->longitude = lon2;
400 wpt->altitude = apt->getElevation();
402 wpt->crossat = -10000;
403 wpt->gear_down = true;
404 wpt->flaps_down= true;
405 wpt->finished = false;
406 wpt->on_ground = true;
408 waypoints.push_back(wpt);
413 apt->getDynamics()->getAvailableParking(&lat, &lon, &heading,
414 &gateId, radius, fltType,
417 double lat3 = (*(waypoints.end()-1))->latitude;
418 double lon3 = (*(waypoints.end()-1))->longitude;
419 //cerr << (*(waypoints.end()-1))->name << endl;
421 // Find a route from runway end to parking/gate.
422 if (apt->getDynamics()->getGroundNetwork()->exists())
425 int runwayId = apt->getDynamics()->getGroundNetwork()->findNearestNode(lat3,
427 // A negative gateId indicates an overflow parking, use a
428 // fallback mechanism for this.
429 // Starting from gate 0 is a bit of a hack...
433 taxiRoute = new FGTaxiRoute;
435 *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(runwayId,
438 *taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(runwayId, 0);
441 // No route found: go from gate directly to runway
442 if (taxiRoute->empty()) {
443 //Add the runway startpoint;
445 wpt->name = "Airport Center";
446 wpt->latitude = latitude;
447 wpt->longitude = longitude;
448 wpt->altitude = apt->getElevation();
450 wpt->crossat = -10000;
451 wpt->gear_down = true;
452 wpt->flaps_down= true;
453 wpt->finished = false;
454 wpt->on_ground = true;
456 waypoints.push_back(wpt);
458 //Add the runway startpoint;
460 wpt->name = "Runway Takeoff";
461 wpt->latitude = lat3;
462 wpt->longitude = lon3;
463 wpt->altitude = apt->getElevation();
465 wpt->crossat = -10000;
466 wpt->gear_down = true;
467 wpt->flaps_down= true;
468 wpt->finished = false;
469 wpt->on_ground = true;
471 waypoints.push_back(wpt);
475 int size = taxiRoute->size();
476 // Omit the last two waypoints, as
477 // those are created by createParking()
479 for (int i = 0; i < size-2; i++)
481 taxiRoute->next(&node, &route);
483 snprintf (buffer, 10, "%d", node);
484 //FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findNode(node);
485 FGTaxiNode *tn = apt->getDynamics()->getGroundNetwork()->findNode(node);
487 //wpt->name = "taxiway"; // fixme: should be the name of the taxiway
488 wpt->name = string(buffer);// fixme: should be the name of the taxiway
489 wpt->latitude = tn->getLatitude();
490 wpt->longitude = tn->getLongitude();
491 wpt->altitude = apt->getElevation();
493 wpt->crossat = -10000;
494 wpt->gear_down = true;
495 wpt->flaps_down= true;
496 wpt->finished = false;
497 wpt->on_ground = true;
498 wpt->routeIndex = route;
499 waypoints.push_back(wpt);
501 //taxiRoute->first();
502 //taxiRoute->next(&node);
507 // Use a fallback mechanism in case no ground network is available
508 // obtain the location of the gate entrance point
512 geo_direct_wgs_84 ( 0, lat, lon, heading,
514 &lat2, &lon2, &az2 );
516 wpt->name = "Airport Center";
517 wpt->latitude = apt->getLatitude();
518 wpt->longitude = apt->getLongitude();
519 wpt->altitude = apt->getElevation();
521 wpt->crossat = -10000;
522 wpt->gear_down = true;
523 wpt->flaps_down= true;
524 wpt->finished = false;
525 wpt->on_ground = true;
527 waypoints.push_back(wpt);
530 wpt->name = "Begin Parking"; //apt->getId(); //wpt_node->getStringValue("name", "END");
531 wpt->latitude = lat2;
532 wpt->longitude = lon2;
533 wpt->altitude = apt->getElevation();
535 wpt->crossat = -10000;
536 wpt->gear_down = true;
537 wpt->flaps_down= true;
538 wpt->finished = false;
539 wpt->on_ground = true;
541 waypoints.push_back(wpt);
547 apt->getDynamics()->getParking(gateId, &lat, &lon, &heading);
553 wpt->name = "END"; //wpt_node->getStringValue("name", "END");
555 wpt->longitude = lon;
558 wpt->crossat = -10000;
559 wpt->gear_down = true;
560 wpt->flaps_down= true;
561 wpt->finished = false;
562 wpt->on_ground = true;
564 waypoints.push_back(wpt);
570 /*******************************************************************
572 * initialize the Aircraft at the parking location
573 ******************************************************************/
574 void FGAIFlightPlan::createTakeOff(bool firstFlight, FGAirport *apt, double speed)
578 double lat2, lon2, az2;
581 // Get the current active runway, based on code from David Luff
582 // This should actually be unified and extended to include
583 // Preferential runway use schema's
587 // "NOTE: this is currently fixed to "com" for commercial traffic
588 // Should be changed to be used dynamically to allow "gen" and "mil"
590 apt->getDynamics()->getActiveRunway("com", 1, activeRunway);
591 if (!(globals->get_runways()->search(apt->getId(),
595 SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
597 " at airport " << apt->getId());
601 heading = rwy._heading;
602 double azimuth = heading + 180.0;
603 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
604 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
605 rwy._length * SG_FEET_TO_METER * 0.5 - 105.0,
606 &lat2, &lon2, &az2 );
609 wpt->latitude = lat2;
610 wpt->longitude = lon2;
611 wpt->altitude = apt->getElevation();
613 wpt->crossat = -10000;
614 wpt->gear_down = true;
615 wpt->flaps_down= true;
616 wpt->finished = false;
617 wpt->on_ground = true;
619 waypoints.push_back(wpt);
625 //Next: the Start of Climb
626 geo_direct_wgs_84 ( 0, lat, lon, heading,
627 2560 * SG_FEET_TO_METER,
628 &lat2, &lon2, &az2 );
632 wpt->latitude = lat2;
633 wpt->longitude = lon2;
634 wpt->altitude = apt->getElevation()+3000;
636 wpt->crossat = -10000;
637 wpt->gear_down = true;
638 wpt->flaps_down= true;
639 wpt->finished = false;
640 wpt->on_ground = false;
642 waypoints.push_back(wpt);
645 /*******************************************************************
647 * initialize the Aircraft at the parking location
648 ******************************************************************/
649 void FGAIFlightPlan::createClimb(bool firstFlight, FGAirport *apt, double speed, double alt)
653 double lat2, lon2, az2;
661 // "NOTE: this is currently fixed to "com" for commercial traffic
662 // Should be changed to be used dynamically to allow "gen" and "mil"
664 apt->getDynamics()->getActiveRunway("com", 1, activeRunway);
665 if (!(globals->get_runways()->search(apt->getId(),
669 SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
671 " at airport " << apt->getId());
677 heading = rwy._heading;
678 double azimuth = heading + 180.0;
679 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
680 //cerr << "Creating climb at : " << rwy._id << " " << rwy._rwy_no << endl;
681 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, heading,
683 &lat2, &lon2, &az2 );
685 wpt->name = "10000ft climb";
686 wpt->latitude = lat2;
687 wpt->longitude = lon2;
688 wpt->altitude = 10000;
690 wpt->crossat = -10000;
691 wpt->gear_down = true;
692 wpt->flaps_down= true;
693 wpt->finished = false;
694 wpt->on_ground = false;
696 waypoints.push_back(wpt);
699 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, heading,
701 &lat2, &lon2, &az2 );
703 wpt->name = "18000ft climb";
704 wpt->latitude = lat2;
705 wpt->longitude = lon2;
706 wpt->altitude = 18000;
708 wpt->crossat = -10000;
709 wpt->gear_down = true;
710 wpt->flaps_down= true;
711 wpt->finished = false;
712 wpt->on_ground = false;
714 waypoints.push_back(wpt);
718 // /*******************************************************************
720 // * initialize the Aircraft at the parking location
721 // ******************************************************************/
722 // void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
723 // FGAirport *arr, double latitude,
724 // double longitude, double speed,
727 // double wind_speed;
728 // double wind_heading;
730 // double lat, lon, az;
731 // double lat2, lon2, az2;
735 // wpt = new waypoint;
736 // wpt->name = "Cruise"; //wpt_node->getStringValue("name", "END");
737 // wpt->latitude = latitude;
738 // wpt->longitude = longitude;
739 // wpt->altitude = alt;
740 // wpt->speed = speed;
741 // wpt->crossat = -10000;
742 // wpt->gear_down = false;
743 // wpt->flaps_down= false;
744 // wpt->finished = false;
745 // wpt->on_ground = false;
746 // waypoints.push_back(wpt);
749 // // should be changed dynamically to allow "gen" and "mil"
750 // arr->getDynamics()->getActiveRunway("com", 2, activeRunway);
751 // if (!(globals->get_runways()->search(arr->getId(),
755 // SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
757 // " at airport " << arr->getId());
760 // heading = rwy._heading;
761 // azimuth = heading + 180.0;
762 // while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
765 // geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
767 // &lat2, &lon2, &az2 );
768 // wpt = new waypoint;
769 // wpt->name = "BOD";
770 // wpt->latitude = lat2;
771 // wpt->longitude = lon2;
772 // wpt->altitude = alt;
773 // wpt->speed = speed;
774 // wpt->crossat = alt;
775 // wpt->gear_down = false;
776 // wpt->flaps_down= false;
777 // wpt->finished = false;
778 // wpt->on_ground = false;
779 // waypoints.push_back(wpt);
782 /*******************************************************************
784 * initialize the Aircraft at the parking location
785 ******************************************************************/
786 void FGAIFlightPlan::createDecent(FGAirport *apt)
789 // Ten thousand ft. Slowing down to 240 kts
792 double lat2, lon2, az2;
797 //Beginning of Decent
799 // allow "mil" and "gen" as well
800 apt->getDynamics()->getActiveRunway("com", 2, activeRunway);
801 if (!(globals->get_runways()->search(apt->getId(),
805 SG_LOG(SG_INPUT, SG_ALERT, "Failed to find runway " <<
807 " at airport " << apt->getId());
811 heading = rwy._heading;
812 azimuth = heading + 180.0;
813 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
814 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
816 &lat2, &lon2, &az2 );
819 wpt->name = "Dec 10000ft"; //wpt_node->getStringValue("name", "END");
820 wpt->latitude = lat2;
821 wpt->longitude = lon2;
822 wpt->altitude = apt->getElevation();
824 wpt->crossat = 10000;
825 wpt->gear_down = false;
826 wpt->flaps_down= false;
827 wpt->finished = false;
828 wpt->on_ground = false;
830 waypoints.push_back(wpt);
832 // Three thousand ft. Slowing down to 160 kts
833 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
835 &lat2, &lon2, &az2 );
837 wpt->name = "DEC 3000ft"; //wpt_node->getStringValue("name", "END");
838 wpt->latitude = lat2;
839 wpt->longitude = lon2;
840 wpt->altitude = apt->getElevation();
843 wpt->gear_down = true;
844 wpt->flaps_down= true;
845 wpt->finished = false;
846 wpt->on_ground = false;
848 waypoints.push_back(wpt);
850 /*******************************************************************
852 * initialize the Aircraft at the parking location
853 ******************************************************************/
854 void FGAIFlightPlan::createLanding(FGAirport *apt)
856 // Ten thousand ft. Slowing down to 150 kts
859 double lat2, lon2, az2;
865 heading = rwy._heading;
866 azimuth = heading + 180.0;
867 while ( azimuth >= 360.0 ) { azimuth -= 360.0; }
870 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
871 rwy._length*0.45 * SG_FEET_TO_METER,
872 &lat2, &lon2, &az2 );
874 wpt->name = "Threshold"; //wpt_node->getStringValue("name", "END");
875 wpt->latitude = lat2;
876 wpt->longitude = lon2;
877 wpt->altitude = apt->getElevation();
879 wpt->crossat = apt->getElevation();
880 wpt->gear_down = true;
881 wpt->flaps_down= true;
882 wpt->finished = false;
883 wpt->on_ground = true;
885 waypoints.push_back(wpt);
887 //Full stop at the runway centerpoint
888 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth,
890 &lat2, &lon2, &az2 );
892 wpt->name = "Center"; //wpt_node->getStringValue("name", "END");
893 wpt->latitude = rwy._lat;
894 wpt->longitude = rwy._lon;
895 wpt->altitude = apt->getElevation();
897 wpt->crossat = -10000;
898 wpt->gear_down = true;
899 wpt->flaps_down= true;
900 wpt->finished = false;
901 wpt->on_ground = true;
903 waypoints.push_back(wpt);
905 geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, heading,
906 rwy._length*0.45 * SG_FEET_TO_METER,
907 &lat2, &lon2, &az2 );
909 wpt->name = "Threshold"; //wpt_node->getStringValue("name", "END");
910 wpt->latitude = lat2;
911 wpt->longitude = lon2;
912 wpt->altitude = apt->getElevation();
914 wpt->crossat = apt->getElevation();
915 wpt->gear_down = true;
916 wpt->flaps_down= true;
917 wpt->finished = false;
918 wpt->on_ground = true;
920 waypoints.push_back(wpt);
923 /*******************************************************************
925 * initialize the Aircraft at the parking location
926 ******************************************************************/
927 void FGAIFlightPlan::createParking(FGAirport *apt, double radius)
934 apt->getDynamics()->getParking(gateId, &lat, &lon, &heading);
938 geo_direct_wgs_84 ( 0, lat, lon, heading,
940 &lat2, &lon2, &az2 );
942 wpt->name = "taxiStart";
943 wpt->latitude = lat2;
944 wpt->longitude = lon2;
945 wpt->altitude = apt->getElevation();
947 wpt->crossat = -10000;
948 wpt->gear_down = true;
949 wpt->flaps_down= true;
950 wpt->finished = false;
951 wpt->on_ground = true;
953 waypoints.push_back(wpt);
954 geo_direct_wgs_84 ( 0, lat, lon, heading,
956 &lat2, &lon2, &az2 );
958 wpt->name = "taxiStart";
959 wpt->latitude = lat2;
960 wpt->longitude = lon2;
961 wpt->altitude = apt->getElevation();
963 wpt->crossat = -10000;
964 wpt->gear_down = true;
965 wpt->flaps_down= true;
966 wpt->finished = false;
967 wpt->on_ground = true;
969 waypoints.push_back(wpt);
972 wpt->name = "END"; //wpt_node->getStringValue("name", "END");
974 wpt->longitude = lon;
975 wpt->altitude = apt->getElevation();
977 wpt->crossat = -10000;
978 wpt->gear_down = true;
979 wpt->flaps_down= true;
980 wpt->finished = false;
981 wpt->on_ground = true;
983 waypoints.push_back(wpt);