FlightGear next
AIGroundVehicle.hxx
Go to the documentation of this file.
1/*
2 * SPDX-FileName: AIGroundVehicle.hxx
3 * SPDX-FileComment: AIShip-derived class creates an AI Ground Vehicle by adding a ground following utility
4 * SPDX-FileCopyrightText: Written by Vivian Meazza, started August 2009 - vivian.meazza at lineone.net
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8#pragma once
9
10#include <cmath>
11#include <string_view>
12#include <vector>
13
14#include <simgear/scene/material/mat.hxx>
15#include <simgear/structure/SGSharedPtr.hxx>
16
17#include "AIShip.hxx"
18
19#include "AIBase.hxx"
20#include "AIManager.hxx"
21
22
24{
25public:
27 virtual ~FGAIGroundVehicle() = default;
28
29 std::string_view getTypeString(void) const override { return "groundvehicle"; }
30 void readFromScenario(SGPropertyNode* scFileNode) override;
31
32 bool init(ModelSearchOrder searchOrder) override;
33 void bind() override;
34 void reinit() override;
35 void update(double dt) override;
36
37private:
38 void setNoRoll(bool nr);
39 void setContactX1offset(double x1);
40 void setContactX2offset(double x2);
41 void setXOffset(double x);
42 void setYOffset(double y);
43 void setZOffset(double z);
44
45 void setPitchCoeff(double pc);
46 void setElevCoeff(double ec);
47 void setTowAngleGain(double g);
48 void setTowAngleLimit(double l);
49 void setElevation(double _elevation, double dt, double _elevation_coeff);
50 void setPitch(double _pitch, double dt, double _pitch_coeff);
51 void setTowAngle(double _relbrg, double dt, double _towangle_coeff);
52 void setTrainSpeed(double s, double dt, double coeff);
53 void setParent();
54 void AdvanceFP();
55 void setTowSpeed();
56 void RunGroundVehicle(double dt);
57
58 bool getGroundElev(SGGeod inpos);
59 bool getPitch();
60
61 SGVec3d getCartHitchPosAt(const SGVec3d& off) const;
62
63 void calcRangeBearing(double lat, double lon, double lat2, double lon2,
64 double& range, double& bearing) const;
65
66 SGGeod _selectedpos;
67
68 bool _solid = true; // if true ground is solid for FDMs
69 double _load_resistance = 0.0; // ground load resistance N/m^2
70 double _frictionFactor = 0.0; // dimensionless modifier for Coefficient of Friction
71
72 double _elevation = 0.0;
73 double _elevation_coeff = 0.0;
74 double _ht_agl_ft = 0.0;
75
76 double _tow_angle_gain = 0.0;
77 double _tow_angle_limit = 0.0;
78
79 double _contact_x1_offset = 0.0;
80 double _contact_x2_offset = 0.0;
81 double _contact_z_offset = 0.0;
82
83 double _pitch = 0.0;
84 double _pitch_coeff = 0.0;
85 double _pitch_deg = 0.0;
86
87 double _speed_coeff = 0.0;
88 double _speed_kt = 0.0;
89
90 double _range_ft = 0.0;
91 double _relbrg = 0.0;
92
93 double _parent_speed = 0.0;
94 double _parent_x_offset = 0.0;
95 double _parent_y_offset = 0.0;
96 double _parent_z_offset = 0.0;
97
98 double _hitch_x_offset_m = 0.0;
99 double _hitch_y_offset_m = 0.0;
100 double _hitch_z_offset_m = 0.0;
101 double _break_count = 0.0;
102
103 double _tunnel_start_alt = 0.0;
104 double _tunnel_end_alt = 0.0;
105 double _tunnel_distance = 0.0;
106};
double bearing
Definition AIBase.hxx:239
double range
Definition AIBase.hxx:241
ModelSearchOrder
Definition AIBase.hxx:63
void bind() override
void update(double dt) override
std::string_view getTypeString(void) const override
void reinit() override
void readFromScenario(SGPropertyNode *scFileNode) override
bool init(ModelSearchOrder searchOrder) override
virtual ~FGAIGroundVehicle()=default
FGAIShip(object_type ot=object_type::otShip)
Definition AIShip.cxx:30
static void calcRangeBearing(double lat1, double lon1, double lat2, double lon2, double &rangeNm, double &bearing)
calculate range and bearing of lat2/lon2 relative to lat1/lon1
Definition tcas.cxx:170