]> git.mxchange.org Git - flightgear.git/blob - src/AIModel/AIGroundVehicle.hxx
Walk the AImodels property tree only once at init, rather than at update. Should...
[flightgear.git] / src / AIModel / AIGroundVehicle.hxx
1 // FGAIGroundVehicle - FGAIShip-derived class creates an AI Ground Vehicle\r
2 // by adding a ground following utility\r
3 //\r
4 // Written by Vivian Meazza, started August 2009.\r
5 // - vivian.meazza at lineone.net\r
6 //\r
7 // This program is free software; you can redistribute it and/or\r
8 // modify it under the terms of the GNU General Public License as\r
9 // published by the Free Software Foundation; either version 2 of the\r
10 // License, or (at your option) any later version.\r
11 //\r
12 // This program is distributed in the hope that it will be useful, but\r
13 // WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
15 // General Public License for more details.\r
16 //\r
17 // You should have received a copy of the GNU General Public License\r
18 // along with this program; if not, write to the Free Software\r
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
20 \r
21 #ifndef _FG_AIGROUNDVEHICLE_HXX\r
22 #define _FG_AIGROUNDVEHICLE_HXX\r
23 \r
24 #include <math.h>\r
25 #include <vector>\r
26 #include <simgear/structure/SGSharedPtr.hxx>\r
27 #include <simgear/scene/material/mat.hxx>\r
28 \r
29 #include "AIShip.hxx"\r
30 \r
31 #include "AIManager.hxx"\r
32 #include "AIBase.hxx"\r
33 \r
34 class FGAIGroundVehicle : public FGAIShip {\r
35 public:\r
36     FGAIGroundVehicle();\r
37     virtual ~FGAIGroundVehicle();\r
38 \r
39     virtual void readFromScenario(SGPropertyNode* scFileNode);\r
40     virtual void bind();\r
41     virtual void unbind();\r
42     virtual const char* getTypeString(void) const { return "groundvehicle"; }\r
43 \r
44     bool init(bool search_in_AI_path=false);\r
45 \r
46 private:\r
47 \r
48     virtual void reinit() { init(); }\r
49     virtual void update (double dt);\r
50 \r
51     void setNoRoll(bool nr);\r
52     void setContactX1offset(double x1);\r
53     void setContactX2offset(double x2);\r
54     void setXOffset(double x);\r
55     void setYOffset(double y);\r
56     void setZOffset(double z);\r
57 \r
58     void setPitchCoeff(double pc);\r
59     void setElevCoeff(double ec);\r
60     void setTowAngleGain(double g);\r
61     void setTowAngleLimit(double l);\r
62     void setElevation(double _elevation, double dt, double _elevation_coeff);\r
63     void setPitch(double _pitch, double dt, double _pitch_coeff);\r
64     void setTowAngle(double _relbrg, double dt, double _towangle_coeff);\r
65     void setParentName(const string& p);\r
66     void setTrainSpeed(double s, double dt, double coeff);\r
67     void setParent();\r
68     void setParentNode();\r
69     void AdvanceFP();\r
70     void setTowSpeed();\r
71     void RunGroundVehicle(double dt);\r
72 \r
73     bool getGroundElev(SGGeod inpos);\r
74     bool getPitch();\r
75 \r
76     SGVec3d getCartHitchPosAt(const SGVec3d& off) const;\r
77 \r
78     void calcRangeBearing(double lat, double lon, double lat2, double lon2,\r
79         double &range, double &bearing) const;\r
80     double calcRelBearingDeg(double bearing, double heading);\r
81 \r
82     SGGeod _selectedpos;\r
83 \r
84     bool   _solid;           // if true ground is solid for FDMs\r
85     double _load_resistance; // ground load resistanc N/m^2\r
86     double _frictionFactor;  // dimensionless modifier for Coefficient of Friction\r
87     double _elevation, _elevation_coeff;\r
88     double _tow_angle_gain, _tow_angle_limit;\r
89     double _ht_agl_ft;\r
90     double _contact_x1_offset, _contact_x2_offset, _contact_z_offset;\r
91     double _pitch, _pitch_coeff, _pitch_deg;\r
92     double _speed_coeff, _speed_kt;\r
93     double _x_offset, _y_offset;\r
94     double _range_ft;\r
95     double _relbrg;\r
96     double _parent_speed, _parent_x_offset, _parent_y_offset, _parent_z_offset;\r
97     double _hitch_x_offset_m, _hitch_y_offset_m, _hitch_z_offset_m;\r
98     double _dt_count, _next_run, _break_count;\r
99 \r
100     const SGMaterial* _material;\r
101     SGPropertyNode_ptr _selected_ac;\r
102 \r
103     string _parent;\r
104 \r
105 };\r
106 \r
107 #endif  // FG_AIGROUNDVEHICLE_HXX\r