1
0
Fork 0

Expose c-of-g to property tree in YASim.

Patch by Henning Stalkhe
This commit is contained in:
James Turner 2016-11-18 16:40:38 +01:00
parent 1a6263f22a
commit 9bf337148d
2 changed files with 12 additions and 1 deletions

View file

@ -127,7 +127,9 @@ void FGFDM::init()
_turb_magnitude_norm = fgGetNode("/environment/turbulence/magnitude-norm", true);
_turb_rate_hz = fgGetNode("/environment/turbulence/rate-hz", true);
_gross_weight_lbs = fgGetNode("/yasim/gross-weight-lbs", true);
_cg_x = fgGetNode("/yasim/cg-x-m", true);
_cg_y = fgGetNode("/yasim/cg-y-m", true);
_cg_z = fgGetNode("/yasim/cg-z-m", true);
// Allows the user to start with something other than full fuel
_airplane.setFuelFraction(fgGetFloat("/sim/fuel-fraction", 1));
@ -610,6 +612,12 @@ void FGFDM::setOutputProperties(float dt)
float grossWgt = _airplane.getModel()->getBody()->getTotalMass() * KG2LBS;
_gross_weight_lbs->setFloatValue(grossWgt);
float cg[3];
_airplane.getModel()->getBody()->getCG(cg);
_cg_x->setFloatValue(cg[0]);
_cg_y->setFloatValue(cg[1]);
_cg_z->setFloatValue(cg[2]);
ControlMap* cm = _airplane.getControlMap();
for(int i=0; i<_controlProps.size(); i++) {
PropOut* p = (PropOut*)_controlProps.get(i);

View file

@ -104,6 +104,9 @@ private:
SGPropertyNode_ptr _turb_magnitude_norm, _turb_rate_hz;
SGPropertyNode_ptr _gross_weight_lbs;
SGPropertyNode_ptr _cg_x;
SGPropertyNode_ptr _cg_y;
SGPropertyNode_ptr _cg_z;
std::vector<SGPropertyNode_ptr> _tank_level_lbs;
std::vector<ThrusterProps> _thrust_props;
std::vector<FuelProps> _fuel_props;