]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Launchbar.hpp
Port over remaining Point3D usage to the more type and unit safe SG* classes.
[flightgear.git] / src / FDM / YASim / Launchbar.hpp
1 #ifndef _LAUNCHBAR_HPP
2 #define _LAUNCHBAR_HPP
3
4 namespace yasim {
5
6 class Ground;
7 class RigidBody;
8 struct State;
9
10 // A launchbar has the following parameters:
11 //
12 // position: a point in the aircraft's local coordinate system where the
13 //     fully-extended wheel will be found.
14 //
15 class Launchbar {
16 public:
17     enum LBState { Arrested, Launch, Unmounted, Completed };
18
19     Launchbar();
20
21     // Externally set values
22     void setLaunchbarMount(float* position);
23     void setHoldbackMount(float* position);
24     void setLength(float length);
25     void setHoldbackLength(float length);
26     void setDownAngle(float ang);
27     void setUpAngle(float ang);
28     void setExtension(float extension);
29     void setLaunchCmd(bool cmd);
30     void setGlobalGround(double *global_ground);
31
32     void getLaunchbarMount(float* out);
33     void getHoldbackMount(float* out);
34     const char* getState(void);
35     float getLength(void);
36     float getHoldbackLength(void);
37     float getDownAngle(void);
38     float getUpAngle(void);
39     float getExtension(void);
40     bool getStrop(void);
41
42     void getTipPosition(float* out);
43     void getHoldbackTipPosition(float* out);
44     float getTipPos(int i);
45     float getHoldbackTipPos(int i);
46     void getTipGlobalPosition(State* s, double* out);
47
48     float getPercentPosOnCat(float* lpos, float off, float lends[2][3]);
49     void getPosOnCat(float perc, float* lpos, float* lvel,
50                      float lends[2][3], float lendvels[2][3]);
51
52     // Takes a velocity of the aircraft relative to ground, a rotation
53     // vector, and a ground plane (all specified in local coordinates)
54     // and make a force and point of application (i.e. ground contact)
55     // available via getForce().
56     void calcForce(Ground *g_cb, RigidBody* body, State* s,
57                    float* lv, float* lrot);
58
59     // Computed values: total force, weight-on-wheels (force normal to
60     // ground) and compression fraction.
61     void getForce(float* force1, float* off1, float* force2, float* off2);
62     float getCompressFraction(void);
63     float getHoldbackCompressFraction(void);
64     float getAngle(void);
65     float getHoldbackAngle(void);
66     float getLaunchbarPos(int i);
67     float getHoldbackPos(int j);
68
69 private:
70     float _launchbar_mount[3];
71     float _holdback_mount[3];
72     float _length;
73     float _holdback_length;
74     float _down_ang;
75     float _up_ang;
76     float _ang;
77     float _h_ang;
78     float _extension;
79     float _launchbar_force[3];
80     float _holdback_force[3];
81     float _frac;
82     float _h_frac;
83     float _pos_on_cat;
84     bool _launch_cmd;
85     bool _strop;
86     double _global_ground[4];
87     LBState _state;
88 };
89
90 }; // namespace yasim
91 #endif // _LAUNCHBAR_HPP