1
0
Fork 0
flightgear/src/FDM/YASim/Model.hpp

88 lines
1.9 KiB
C++
Raw Normal View History

#ifndef _MODEL_HPP
#define _MODEL_HPP
#include "Integrator.hpp"
#include "RigidBody.hpp"
#include "BodyEnvironment.hpp"
2001-12-06 18:16:22 +00:00
#include "Vector.hpp"
namespace yasim {
// Declare the types whose pointers get passed around here
class Integrator;
class Thruster;
class Surface;
class Gear;
class Model : public BodyEnvironment {
public:
Model();
virtual ~Model();
RigidBody* getBody();
Integrator* getIntegrator();
State* getState();
void setState(State* s);
void iterate();
// Externally-managed subcomponents
int addThruster(Thruster* t);
int addSurface(Surface* surf);
int addGear(Gear* gear);
Surface* getSurface(int handle);
Gear* getGear(int handle);
// Semi-private methods for use by the Airplane solver.
2001-12-06 18:13:24 +00:00
int numThrusters();
Thruster* getThruster(int handle);
void setThruster(int handle, Thruster* t);
void initIteration();
void getThrust(float* out);
//
// Per-iteration settables
//
void setGroundPlane(double* planeNormal, double fromOrigin);
2001-12-06 18:13:24 +00:00
void setGroundEffect(float* pos, float span, float mul);
void setWind(float* wind);
void setAir(float pressure, float temp);
// BodyEnvironment callbacks
virtual void calcForces(State* s);
virtual void newState(State* s);
private:
void calcGearForce(Gear* g, float* v, float* rot, float* ground);
float gearFriction(float wgt, float v, Gear* g);
float localGround(State* s, float* out);
void localWind(float* pos, State* s, float* out);
Integrator _integrator;
RigidBody _body;
Vector _thrusters;
Vector _surfaces;
Vector _gears;
2001-12-06 18:13:24 +00:00
float _groundEffectSpan;
float _groundEffect;
float _wingCenter[3];
double _ground[4];
2001-12-07 20:00:59 +00:00
float _pressure;
float _temp;
float _rho;
float _wind[3];
// Accumulators for the total internal gyro and engine torque
float _gyro[3];
float _torque[3];
State* _s;
};
}; // namespace yasim
#endif // _MODEL_HPP