]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Gear.hpp
Mathias Frohlich: Add carrier capabilities for YASim aircraft.
[flightgear.git] / src / FDM / YASim / Gear.hpp
1 #ifndef _GEAR_HPP
2 #define _GEAR_HPP
3
4 namespace yasim {
5
6 class RigidBody;
7 class State;
8
9 // A landing gear has the following parameters:
10 //
11 // position: a point in the aircraft's local coordinate system where the
12 //     fully-extended wheel will be found.
13 // compression: a vector from position where a fully-compressed wheel
14 //     will be, also in aircraft-local coordinates.
15 // spring coefficient: force coefficient along the compression axis, in
16 //     Newtons per meter.
17 // damping coefficient: force per compression speed, in Ns/m
18 // static coefficient of friction: force along the ground plane exerted
19 //     by a motionless wheel.  A unitless scalar.
20 // dynamic coefficient of friction: force along the ground plane exerted
21 //     by a sliding/skidding wheel.
22 // braking fraction: fraction of the dynamic friction that will be
23 //     actually exerted by a rolling wheel
24 // rotation: the angle from "forward" by which the wheel is rotated
25 //     around its compression axis.  In radians.
26 //
27 class Gear {
28 public:
29     Gear();
30
31     // Externally set values
32     void setPosition(float* position);
33     void setCompression(float* compression);
34     void setSpring(float spring);
35     void setDamping(float damping);
36     void setStaticFriction(float sfric);
37     void setDynamicFriction(float dfric);
38     void setBrake(float brake);
39     void setRotation(float rotation);
40     void setExtension(float extension);
41     void setCastering(bool castering);
42     void setGlobalGround(double* global_ground, float* global_vel);
43
44     void getPosition(float* out);
45     void getCompression(float* out);
46     void getGlobalGround(double* global_ground);
47     float getSpring();
48     float getDamping();
49     float getStaticFriction();
50     float getDynamicFriction();
51     float getBrake();
52     float getRotation();
53     float getExtension();
54     bool getCastering();
55
56     // Takes a velocity of the aircraft relative to ground, a rotation
57     // vector, and a ground plane (all specified in local coordinates)
58     // and make a force and point of application (i.e. ground contact)
59     // available via getForce().
60     void calcForce(RigidBody* body, State* s, float* v, float* rot);
61
62     // Computed values: total force, weight-on-wheels (force normal to
63     // ground) and compression fraction.
64     void getForce(float* force, float* contact);
65     float getWoW();
66     float getCompressFraction();
67
68 private:
69     float calcFriction(float wgt, float v);
70
71     bool _castering;
72     float _pos[3];
73     float _cmpr[3];
74     float _spring;
75     float _damp;
76     float _sfric;
77     float _dfric;
78     float _brake;
79     float _rot;
80     float _extension;
81     float _force[3];
82     float _contact[3];
83     float _wow;
84     float _frac;
85     double _global_ground[4];
86     float _global_vel[3];
87 };
88
89 }; // namespace yasim
90 #endif // _GEAR_HPP