1 // FGAIGroundVehicle - FGAIShip-derived class creates an AI Ground Vehicle
2 // by adding a ground following utility
4 // Written by Vivian Meazza, started August 2009.
5 // - vivian.meazza at lineone.net
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef _FG_AIESCORT_HXX
22 #define _FG_AIESCORT_HXX
27 #include <simgear/compiler.h>
36 #include "AIManager.hxx"
39 class FGAIEscort : public FGAIShip {
42 virtual ~FGAIEscort();
44 virtual void readFromScenario(SGPropertyNode* scFileNode);
46 virtual void unbind();
47 virtual const char* getTypeString(void) const { return "escort"; }
49 bool init(bool search_in_AI_path=false);
53 virtual void reinit() { init(); }
54 virtual void update (double dt);
56 void setParentName(const string& p);
58 void setStnRange(double r);
59 void setStnBrg(double y);
60 void setStationSpeed();
61 void setStnLimit(double l);
62 void setStnAngleLimit(double l);
63 void setStnSpeed(double s);
64 void setStnHtFt(double h);
65 void setStnPatrol(bool p);
66 void setStnDegTrue(bool t);
68 void setMaxSpeed(double m);
69 void setUpdateInterval(double i);
71 void RunEscort(double dt);
73 bool getGroundElev(SGGeod inpos);
75 SGVec3d getCartHitchPosAt(const SGVec3d& off) const;
77 void calcRangeBearing(double lat, double lon, double lat2, double lon2,
78 double &range, double &bearing) const;
79 double calcRelBearingDeg(double bearing, double heading);
80 double calcTrueBearingDeg(double bearing, double heading);
81 double calcRecipBearingDeg(double bearing);
86 bool _solid; // if true ground is solid for FDMs
87 double _load_resistance; // ground load resistanc N/m^2
88 double _frictionFactor; // dimensionless modifier for Coefficient of Friction
89 double _tgtrange, _tgtbrg;
91 double _relbrg, _truebrg;
92 double _parent_speed, _parent_hdg;
95 double _stn_relbrg, _stn_truebrg, _stn_brg, _stn_range, _stn_height;
96 double _stn_speed, _stn_angle_limit, _stn_limit;
100 const SGMaterial* _material;
101 const SGPropertyNode *_selected_ac;
103 bool _MPControl, _patrol, _stn_deg_true;
109 #endif // FG_AIGROUNDVEHICLE_HXX