Hi Harald, On Wednesday 08 August 2007 19:08, Harald JOHNSEN wrote: > Durk Talsma wrote: > >Hi, > > > >For those among us not subscribed to the CVS log messages mailing list; I > > have just committed a rather large patch that provides some support for > > AI aircraft pushback operations at the beginning of the taxi stage. This > > code is designed around the new editing features that have appeared in > > TaxiDraw (CVS / NEW_GUI_CODE branch). > >... > > I've started to code some nasal script to manage some airport facilities > for the user aircraft (docking system, animated jetways, etc). While I'm > allready reading the ground network xml file to get the parkings I think > it's a bit overkill and counterproductive to do any coding for the taxi > network (path finding) on my side , but I need this kind of info to lead > the aircraft to a parking place or even code a pushback animation. > Do you think it would be possible to : > - reserve a parking place for a non AI aircraft > - query a path from node a to node b > - handle the user aircraft in your traffic jam code to reduce the > risk of collision ? > This could be very usefull for me. >
Sounds like you're working on interesting stuff. Using C++ most of this would be quite doable already. I'm not exactly sure how this all could be tied in to the nasal system, but if you have a very specific problem you're like to address, please let me know, and I'd be happy to help you out with the C++ part, or trying to interface particular functions with nasal. Anyway, here's the C++ explanation. Reserving a parking for the user aircraft would be done using something like[1]: string id("EHAM"); FGAirport *apt = globals->get_airports()->search(id); apt->getDynamics()->getAvailableParking(&lat, &lon, &heading, &gateId, radius, fltType, acType, airline); this function searches for the next available parking, that fit the criteria radius (approximate size of aircraft), fltType (currently defined as "gate", "cargo", "ga", "mil-fighter", or "mil-transport"), acType (currently unused), and airline (a three letter ICAO airline code). If an available parking is found, it is marked as used, and position and heading of this gate are copied back into &lat &lon, and &heading. Likewise, the internally assigned gate number is copied into &gateId. For direct access to the parking object your can run: FGParking *park = apt->getDynamics()->getParking(gateId); and when you want to release the gate, after departure, call apt->getDynamics()->releaseParking(gateId); Querying a path through the network would extend this example. We already have the gate Id, but not yet the Id of the node at the end point of the runway. For this, we first need to get the active runway: string rwyClass("com"); apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway); // use 1 for takeoff, 2 for landing globals->get_runways()->search(apt->getId(), activeRunway, &rwy); // Geometry of the active runway is stored in "rwy". Find the // end of the runway heading = rwy._heading; double azimuth = heading + 180.0; while ( azimuth >= 360.0 ) { azimuth -= 360.0; } geo_direct_wgs_84 ( 0, rwy._lat, rwy._lon, azimuth, rwy._length * SG_FEET_TO_METER * 0.5 - 5.0, &lat2, &lon2, &az2 ); // lat2, and lon2 now contain the coordinates of the runway end point // find the ground network node nearest. if (apt->getDynamics()->getGroundNetwork()->exists()) { intVec ids; int runwayId =apt->getDynamics()->getGroundNetwork()->findNearestNode(lat2, lon2); } // okay, now we have gateId and runway endpoint, find the shortest route: FGTaxiRoute taxiRoute = apt->getDynamics()->getGroundNetwork()->findShortestRoute(gateId, runwayId); // taxiroute now contains all the nodes (waypoints) and routes required to go from a to b. Finally, as for including the user aircraft, that is the ultimate goal. I have been thinking about having one additional AI aircraft added to the AI route tracking system, which would be slaved to the user aircraft; get it's positional information from the user aircraft, and it's intentions from a user specified Flightplan. I've been thinking about this idea for about a year now, but haven't really gotten around to seriously work on it. This is in part because I haven't found the time yet, but also in part because I found the AI collission detection system to be quite stable enough yet, to start such a big endeavor, while other more immediate tasks are still waiting. Cheers, Durk [1] Note: I've copied these code snippets from various fgfs sources, and editied them slightly for example's sake. Most examples of the use of this code can be found in AIModels/AIFlightPlanCreate.cxx. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel