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