]> git.mxchange.org Git - flightgear.git/blob - src/AIModel/AIGroundVehicle.hxx
721ebf3032e4d15604e28424b0f42aae043e1716
[flightgear.git] / src / AIModel / AIGroundVehicle.hxx
1 // FGAIGroundVehicle - FGAIShip-derived class creates an AI Ground Vehicle
2 // by adding a ground following utility
3 //
4 // Written by Vivian Meazza, started August 2009.
5 // - vivian.meazza at lineone.net
6 //
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.
11 //
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.
16 //
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.
20
21 #ifndef _FG_AIGROUNDVEHICLE_HXX
22 #define _FG_AIGROUNDVEHICLE_HXX
23
24 #include <math.h>
25 #include <vector>
26 #include <simgear/structure/SGSharedPtr.hxx>
27 #include <simgear/scene/material/mat.hxx>
28
29 #include "AIShip.hxx"
30
31 #include "AIManager.hxx"
32 #include "AIBase.hxx"
33
34 class FGAIGroundVehicle : public FGAIShip {
35 public:
36     FGAIGroundVehicle();
37     virtual ~FGAIGroundVehicle();
38
39     virtual void readFromScenario(SGPropertyNode* scFileNode);
40     virtual void bind();
41     virtual void unbind();
42     virtual const char* getTypeString(void) const { return "groundvehicle"; }
43
44     bool init(bool search_in_AI_path=false);
45
46 private:
47
48     virtual void reinit() { init(); }
49     virtual void update (double dt);
50
51     void setNoRoll(bool nr);
52     void setContactX1offset(double x1);
53     void setContactX2offset(double x2);
54     void setXOffset(double x);
55     void setYOffset(double y);
56     void setZOffset(double z);
57
58     void setPitchCoeff(double pc);
59     void setElevCoeff(double ec);
60     void setTowAngleGain(double g);
61     void setTowAngleLimit(double l);
62     void setElevation(double _elevation, double dt, double _elevation_coeff);
63     void setPitch(double _pitch, double dt, double _pitch_coeff);
64     void setTowAngle(double _relbrg, double dt, double _towangle_coeff);
65     void setParentName(const string& p);
66     void setTrainSpeed(double s, double dt, double coeff);
67     void setParent();
68     void AdvanceFP();
69     void setTowSpeed();
70     void RunGroundVehicle(double dt);
71
72     bool getGroundElev(SGGeod inpos);
73     bool getPitch();
74
75     SGVec3d getCartHitchPosAt(const SGVec3d& off) const;
76
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
81     SGGeod _selectedpos;
82
83     bool   _solid;           // if true ground is solid for FDMs
84     double _load_resistance; // ground load resistanc N/m^2
85     double _frictionFactor;  // dimensionless modifier for Coefficient of Friction
86     double _elevation, _elevation_coeff;
87     double _tow_angle_gain, _tow_angle_limit;
88     double _ht_agl_ft;
89     double _contact_x1_offset, _contact_x2_offset, _contact_z_offset;
90     double _pitch, _pitch_coeff, _pitch_deg;
91     double _speed_coeff, _speed_kt;
92     double _x_offset, _y_offset;
93     double _range_ft;
94     double _relbrg;
95     double _parent_speed, _parent_x_offset, _parent_y_offset, _parent_z_offset;
96     double _dt_count, _next_run, _break_count;
97
98     const SGMaterial* _material;
99     SGPropertyNode_ptr _selected_ac;
100
101     string _parent;
102
103 };
104
105 #endif  // FG_AIGROUNDVEHICLE_HXX