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_AIGROUNDVEHICLE_HXX
22 #define _FG_AIGROUNDVEHICLE_HXX
26 #include <simgear/structure/SGSharedPtr.hxx>
27 #include <simgear/scene/material/mat.hxx>
31 #include "AIManager.hxx"
34 class FGAIGroundVehicle : public FGAIShip {
37 virtual ~FGAIGroundVehicle();
39 virtual void readFromScenario(SGPropertyNode* scFileNode);
41 bool init(bool search_in_AI_path=false);
43 virtual void reinit();
44 virtual void update (double dt);
46 virtual const char* getTypeString(void) const { return "groundvehicle"; }
50 void setNoRoll(bool nr);
51 void setContactX1offset(double x1);
52 void setContactX2offset(double x2);
53 void setXOffset(double x);
54 void setYOffset(double y);
55 void setZOffset(double z);
57 void setPitchCoeff(double pc);
58 void setElevCoeff(double ec);
59 void setTowAngleGain(double g);
60 void setTowAngleLimit(double l);
61 void setElevation(double _elevation, double dt, double _elevation_coeff);
62 void setPitch(double _pitch, double dt, double _pitch_coeff);
63 void setTowAngle(double _relbrg, double dt, double _towangle_coeff);
64 void setTrainSpeed(double s, double dt, double coeff);
68 void RunGroundVehicle(double dt);
70 bool getGroundElev(SGGeod inpos);
73 SGVec3d getCartHitchPosAt(const SGVec3d& off) const;
75 void calcRangeBearing(double lat, double lon, double lat2, double lon2,
76 double &range, double &bearing) const;
80 bool _solid; // if true ground is solid for FDMs
81 double _load_resistance; // ground load resistanc N/m^2
82 double _frictionFactor; // dimensionless modifier for Coefficient of Friction
83 double _elevation, _elevation_coeff;
84 double _tow_angle_gain, _tow_angle_limit;
86 double _contact_x1_offset, _contact_x2_offset, _contact_z_offset;
87 double _pitch, _pitch_coeff, _pitch_deg;
88 double _speed_coeff, _speed_kt;
89 double _x_offset, _y_offset;
92 double _parent_speed, _parent_x_offset, _parent_y_offset, _parent_z_offset;
93 double _hitch_x_offset_m, _hitch_y_offset_m, _hitch_z_offset_m;
94 double _dt_count, _next_run, _break_count;
98 #endif // FG_AIGROUNDVEHICLE_HXX