| 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 | void setAcceleration(float acceleration); |
| 32 | |
| 33 | void getLaunchbarMount(float* out); |
| 34 | void getHoldbackMount(float* out); |
| 35 | const char* getState(void); |
| 36 | float getLength(void); |
| 37 | float getHoldbackLength(void); |
| 38 | float getDownAngle(void); |
| 39 | float getUpAngle(void); |
| 40 | float getExtension(void); |
| 41 | bool getStrop(void); |
| 42 | |
| 43 | void getTipPosition(float* out); |
| 44 | void getHoldbackTipPosition(float* out); |
| 45 | float getTipPos(int i); |
| 46 | float getHoldbackTipPos(int i); |
| 47 | void getTipGlobalPosition(State* s, double* out); |
| 48 | |
| 49 | float getPercentPosOnCat(float* lpos, float off, float lends[2][3]); |
| 50 | void getPosOnCat(float perc, float* lpos, float* lvel, |
| 51 | float lends[2][3], float lendvels[2][3]); |
| 52 | |
| 53 | // Takes a velocity of the aircraft relative to ground, a rotation |
| 54 | // vector, and a ground plane (all specified in local coordinates) |
| 55 | // and make a force and point of application (i.e. ground contact) |
| 56 | // available via getForce(). |
| 57 | void calcForce(Ground *g_cb, RigidBody* body, State* s, |
| 58 | float* lv, float* lrot); |
| 59 | |
| 60 | // Computed values: total force, weight-on-wheels (force normal to |
| 61 | // ground) and compression fraction. |
| 62 | void getForce(float* force1, float* off1, float* force2, float* off2); |
| 63 | float getCompressFraction(void); |
| 64 | float getHoldbackCompressFraction(void); |
| 65 | float getAngle(void); |
| 66 | float getHoldbackAngle(void); |
| 67 | float getLaunchbarPos(int i); |
| 68 | float getHoldbackPos(int j); |
| 69 | |
| 70 | private: |
| 71 | float _launchbar_mount[3]; |
| 72 | float _holdback_mount[3]; |
| 73 | float _length; |
| 74 | float _holdback_length; |
| 75 | float _down_ang; |
| 76 | float _up_ang; |
| 77 | float _ang; |
| 78 | float _h_ang; |
| 79 | float _extension; |
| 80 | float _launchbar_force[3]; |
| 81 | float _holdback_force[3]; |
| 82 | float _frac; |
| 83 | float _h_frac; |
| 84 | float _pos_on_cat; |
| 85 | bool _launch_cmd; |
| 86 | bool _strop; |
| 87 | double _global_ground[4]; |
| 88 | LBState _state; |
| 89 | float _acceleration; |
| 90 | }; |
| 91 | |
| 92 | }; // namespace yasim |
| 93 | #endif // _LAUNCHBAR_HPP |