2007-01-17 20:42:39 +00:00
|
|
|
#ifndef _HITCH_HPP
|
|
|
|
#define _HITCH_HPP
|
2007-01-20 21:08:04 +00:00
|
|
|
|
2009-07-15 23:16:05 +00:00
|
|
|
#include <string>
|
|
|
|
|
2007-01-20 21:08:04 +00:00
|
|
|
#include <Main/fg_props.hxx>
|
|
|
|
|
2007-01-17 20:42:39 +00:00
|
|
|
namespace yasim {
|
|
|
|
|
|
|
|
class Ground;
|
|
|
|
class RigidBody;
|
|
|
|
struct State;
|
|
|
|
|
|
|
|
class Hitch {
|
|
|
|
public:
|
|
|
|
Hitch(const char *name);
|
|
|
|
~Hitch();
|
|
|
|
|
|
|
|
// Externally set values
|
|
|
|
void setPosition(float* position);
|
|
|
|
void setOpen(bool isOpen);
|
|
|
|
//void setName(const char *text);
|
|
|
|
|
|
|
|
void setTowLength(float length);
|
|
|
|
void setTowElasticConstant(float sc);
|
|
|
|
void setTowBreakForce(float bf);
|
|
|
|
void setTowWeightPerM(float rw);
|
|
|
|
void setWinchMaxSpeed(float mws);
|
|
|
|
void setWinchRelSpeed(float rws);
|
|
|
|
void setWinchPosition(double *winchPosition); //in global coordinates!
|
|
|
|
void setWinchPositionAuto(bool doit);
|
|
|
|
void findBestAIObject(bool doit,bool running_as_autoconnect=false);
|
|
|
|
void setWinchInitialTowLength(float length);
|
|
|
|
void setWinchPower(float power);
|
|
|
|
void setWinchMaxForce(float force);
|
|
|
|
void setWinchMaxTowLength(float length);
|
|
|
|
void setWinchMinTowLength(float length);
|
|
|
|
void setMpAutoConnectPeriod(float dt);
|
|
|
|
void setForceIsCalculatedByOther(bool b);
|
|
|
|
|
|
|
|
void setGlobalGround(double *global_ground, float *global_vel);
|
|
|
|
|
|
|
|
void getPosition(float* out);
|
|
|
|
float getTowLength(void);
|
|
|
|
|
|
|
|
void calcForce(Ground *g_cb, RigidBody* body, State* s);
|
|
|
|
|
|
|
|
// Computed values: total force
|
|
|
|
void getForce(float* force, float* off);
|
|
|
|
|
|
|
|
void integrate (float dt);
|
|
|
|
|
2009-07-15 23:16:05 +00:00
|
|
|
std::string getConnectedPropertyNode() const;
|
2007-01-17 20:42:39 +00:00
|
|
|
void setConnectedPropertyNode(const char *nodename);
|
|
|
|
|
|
|
|
private:
|
|
|
|
float _pos[3];
|
|
|
|
bool _open;
|
|
|
|
bool _oldOpen;
|
|
|
|
float _towLength;
|
|
|
|
float _towElasticConstant;
|
|
|
|
float _towBrakeForce;
|
|
|
|
float _towWeightPerM;
|
|
|
|
float _winchMaxSpeed;
|
|
|
|
float _winchRelSpeed;
|
|
|
|
float _winchInitialTowLength;
|
|
|
|
float _winchMaxTowLength;
|
|
|
|
float _winchMinTowLength;
|
|
|
|
float _winchPower;
|
|
|
|
float _winchMaxForce;
|
|
|
|
float _winchActualForce;
|
|
|
|
double _winchPos[3];
|
|
|
|
float _force[3];
|
|
|
|
float _towEndForce[3];
|
|
|
|
float _reportTowEndForce[3];
|
|
|
|
float _forceMagnitude;
|
|
|
|
double _global_ground[4];
|
|
|
|
float _global_vel[3];
|
|
|
|
char _name[256];
|
|
|
|
State* _state;
|
|
|
|
float _dist;
|
|
|
|
float _timeLagCorrectedDist;
|
2007-01-20 21:08:04 +00:00
|
|
|
SGPropertyNode_ptr _towEndNode;
|
2007-01-17 20:42:39 +00:00
|
|
|
const char *_towEndPropertyName;
|
|
|
|
bool _towEndIsConnectedToProperty;
|
|
|
|
bool _nodeIsMultiplayer;
|
|
|
|
bool _nodeIsAiAircraft;
|
|
|
|
bool _forceIsCalculatedByMaster;
|
|
|
|
int _nodeID;
|
|
|
|
//const char *_ai_MP_callsign;
|
|
|
|
bool _isSlave;
|
|
|
|
float _mpAutoConnectPeriod;
|
|
|
|
float _timeToNextAutoConnectTry;
|
|
|
|
float _timeToNextReConnectTry;
|
|
|
|
float _height_above_ground;
|
|
|
|
float _winch_height_above_ground;
|
|
|
|
float _loPosFrac;
|
|
|
|
float _lowest_tow_height;
|
|
|
|
float _speed_in_tow_direction;
|
|
|
|
float _mp_time_lag;
|
|
|
|
float _mp_last_reported_dist;
|
|
|
|
float _mp_last_reported_v;
|
|
|
|
float _mp_v;
|
|
|
|
float _mp_dist;
|
|
|
|
float _mp_lpos[3];
|
|
|
|
float _mp_force[3];
|
|
|
|
bool _mp_is_slave;
|
|
|
|
bool _mp_open_last_state;
|
2007-01-20 21:08:04 +00:00
|
|
|
|
2007-01-17 20:42:39 +00:00
|
|
|
bool _displayed_len_lower_dist_message;
|
|
|
|
bool _last_wish;
|
|
|
|
|
2007-01-20 21:08:04 +00:00
|
|
|
SGPropertyNode_ptr _node;
|
2007-01-17 20:42:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace yasim
|
|
|
|
#endif // _HITCH_HPP
|