]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Hitch.hpp
accomodate changed getDisplayName interface in yasim::Hitch
[flightgear.git] / src / FDM / YASim / Hitch.hpp
1 #ifndef _HITCH_HPP
2 #define _HITCH_HPP
3
4 #include <string>
5
6 #include <Main/fg_props.hxx>
7
8 namespace yasim {
9
10 class Ground;
11 class RigidBody;
12 struct State;
13
14 class Hitch {
15 public:
16     Hitch(const char *name);
17     ~Hitch();
18
19     // Externally set values
20     void setPosition(float* position);
21     void setOpen(bool isOpen);
22     //void setName(const char *text);
23
24     void setTowLength(float length);
25     void setTowElasticConstant(float sc);
26     void setTowBreakForce(float bf);
27     void setTowWeightPerM(float rw);
28     void setWinchMaxSpeed(float mws);
29     void setWinchRelSpeed(float rws);
30     void setWinchPosition(double *winchPosition); //in global coordinates!
31     void setWinchPositionAuto(bool doit);
32     void findBestAIObject(bool doit,bool running_as_autoconnect=false);
33     void setWinchInitialTowLength(float length);
34     void setWinchPower(float power);
35     void setWinchMaxForce(float force);
36     void setWinchMaxTowLength(float length);
37     void setWinchMinTowLength(float length);
38     void setMpAutoConnectPeriod(float dt);
39     void setForceIsCalculatedByOther(bool b);
40     
41     void setGlobalGround(double *global_ground, float *global_vel);
42
43     void getPosition(float* out);
44     float getTowLength(void);
45
46     void calcForce(Ground *g_cb, RigidBody* body, State* s);
47
48     // Computed values: total force
49     void getForce(float* force, float* off);
50
51     void integrate (float dt);
52
53     std::string getConnectedPropertyNode() const;
54     void setConnectedPropertyNode(const char *nodename);
55
56 private:
57     float _pos[3];
58     bool _open;
59     bool _oldOpen;
60     float _towLength;
61     float _towElasticConstant;
62     float _towBrakeForce;
63     float _towWeightPerM;
64     float _winchMaxSpeed;
65     float _winchRelSpeed;
66     float _winchInitialTowLength;
67     float _winchMaxTowLength;
68     float _winchMinTowLength;
69     float _winchPower;
70     float _winchMaxForce;
71     float _winchActualForce;
72     double _winchPos[3];
73     float _force[3];
74     float _towEndForce[3];
75     float _reportTowEndForce[3];
76     float _forceMagnitude;
77     double _global_ground[4];
78     float _global_vel[3];
79     char _name[256];
80     State* _state;
81     float _dist;
82     float _timeLagCorrectedDist;
83     SGPropertyNode_ptr _towEndNode;
84     const char *_towEndPropertyName;
85     bool _towEndIsConnectedToProperty;
86     bool _nodeIsMultiplayer;
87     bool _nodeIsAiAircraft;
88     bool _forceIsCalculatedByMaster;
89     int _nodeID;
90     //const char *_ai_MP_callsign;
91     bool _isSlave;
92     float _mpAutoConnectPeriod;
93     float _timeToNextAutoConnectTry;
94     float _timeToNextReConnectTry;
95     float _height_above_ground;
96     float _winch_height_above_ground;
97     float _loPosFrac;
98     float _lowest_tow_height;
99     float _speed_in_tow_direction;
100     float _mp_time_lag;
101     float _mp_last_reported_dist;
102     float _mp_last_reported_v;
103     float _mp_v;
104     float _mp_dist;
105     float _mp_lpos[3];
106     float _mp_force[3];
107     bool _mp_is_slave;
108     bool _mp_open_last_state;
109
110     bool _displayed_len_lower_dist_message;
111     bool _last_wish;
112
113     SGPropertyNode_ptr _node;
114 };
115
116 }; // namespace yasim
117 #endif // _HITCH_HPP