Merge branch 'maint' into next
This commit is contained in:
commit
9bb896dd20
9 changed files with 76 additions and 43 deletions
|
@ -34,11 +34,11 @@
|
||||||
|
|
||||||
#include <Main/util.hxx>
|
#include <Main/util.hxx>
|
||||||
|
|
||||||
|
using namespace simgear;
|
||||||
|
|
||||||
const double FGAIBallistic::slugs_to_kgs = 14.5939029372;
|
const double FGAIBallistic::slugs_to_kgs = 14.5939029372;
|
||||||
const double FGAIBallistic::slugs_to_lbs = 32.1740485564;
|
const double FGAIBallistic::slugs_to_lbs = 32.1740485564;
|
||||||
|
|
||||||
using namespace simgear;
|
|
||||||
|
|
||||||
FGAIBallistic::FGAIBallistic(object_type ot) :
|
FGAIBallistic::FGAIBallistic(object_type ot) :
|
||||||
FGAIBase(ot),
|
FGAIBase(ot),
|
||||||
_elevation(0),
|
_elevation(0),
|
||||||
|
@ -55,6 +55,7 @@ _gravity(32.1740485564),
|
||||||
_report_impact(false),
|
_report_impact(false),
|
||||||
_wind(true),
|
_wind(true),
|
||||||
_impact_report_node(fgGetNode("/ai/models/model-impact", true)),
|
_impact_report_node(fgGetNode("/ai/models/model-impact", true)),
|
||||||
|
_force_stabilised(false),
|
||||||
_external_force(false),
|
_external_force(false),
|
||||||
_slave_to_ac(false),
|
_slave_to_ac(false),
|
||||||
_slave_load_to_ac(false),
|
_slave_load_to_ac(false),
|
||||||
|
@ -91,7 +92,7 @@ void FGAIBallistic::readFromScenario(SGPropertyNode* scFileNode) {
|
||||||
setCd(scFileNode->getDoubleValue("cd", 0.029));
|
setCd(scFileNode->getDoubleValue("cd", 0.029));
|
||||||
//setMass(scFileNode->getDoubleValue("mass", 0.007));
|
//setMass(scFileNode->getDoubleValue("mass", 0.007));
|
||||||
setWeight(scFileNode->getDoubleValue("weight", 0.25));
|
setWeight(scFileNode->getDoubleValue("weight", 0.25));
|
||||||
setStabilisation(scFileNode->getBoolValue("aero_stabilized", false));
|
setStabilisation(scFileNode->getBoolValue("aero-stabilized", false));
|
||||||
setNoRoll(scFileNode->getBoolValue("no-roll", false));
|
setNoRoll(scFileNode->getBoolValue("no-roll", false));
|
||||||
setRandom(scFileNode->getBoolValue("random", false));
|
setRandom(scFileNode->getBoolValue("random", false));
|
||||||
setImpact(scFileNode->getBoolValue("impact", false));
|
setImpact(scFileNode->getBoolValue("impact", false));
|
||||||
|
@ -102,7 +103,7 @@ void FGAIBallistic::readFromScenario(SGPropertyNode* scFileNode) {
|
||||||
setSubID(scFileNode->getIntValue("SubID", 0));
|
setSubID(scFileNode->getIntValue("SubID", 0));
|
||||||
setExternalForce(scFileNode->getBoolValue("external-force", false));
|
setExternalForce(scFileNode->getBoolValue("external-force", false));
|
||||||
setForcePath(scFileNode->getStringValue("force-path", ""));
|
setForcePath(scFileNode->getStringValue("force-path", ""));
|
||||||
setForceStabilisation(scFileNode->getBoolValue("force_stabilized", false));
|
setForceStabilisation(scFileNode->getBoolValue("force-stabilized", false));
|
||||||
setXoffset(scFileNode->getDoubleValue("x-offset", 0.0));
|
setXoffset(scFileNode->getDoubleValue("x-offset", 0.0));
|
||||||
setYoffset(scFileNode->getDoubleValue("y-offset", 0.0));
|
setYoffset(scFileNode->getDoubleValue("y-offset", 0.0));
|
||||||
setZoffset(scFileNode->getDoubleValue("z-offset", 0.0));
|
setZoffset(scFileNode->getDoubleValue("z-offset", 0.0));
|
||||||
|
|
|
@ -426,6 +426,8 @@ void FGAICarrier::bind() {
|
||||||
props->setBoolValue("controls/crew", false);
|
props->setBoolValue("controls/crew", false);
|
||||||
props->setStringValue("navaids/tacan/channel-ID", TACAN_channel_id.c_str());
|
props->setStringValue("navaids/tacan/channel-ID", TACAN_channel_id.c_str());
|
||||||
props->setStringValue("sign", sign.c_str());
|
props->setStringValue("sign", sign.c_str());
|
||||||
|
props->setBoolValue("controls/lighting/deck-lights", false);
|
||||||
|
props->setDoubleValue("controls/lighting/flood-lights-red-norm", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -386,9 +386,8 @@ const FGAIBase *
|
||||||
FGAIManager::calcCollision(double alt, double lat, double lon, double fuse_range)
|
FGAIManager::calcCollision(double alt, double lat, double lon, double fuse_range)
|
||||||
{
|
{
|
||||||
// we specify tgt extent (ft) according to the AIObject type
|
// we specify tgt extent (ft) according to the AIObject type
|
||||||
double tgt_ht[] = {0, 50 ,100, 250, 0, 100, 0, 0, 50, 50};
|
double tgt_ht[] = {0, 50 ,100, 250, 0, 100, 0, 0, 50, 50, 50};
|
||||||
double tgt_length[] = {0, 100, 200, 750, 0, 50, 0, 0, 200, 100};
|
double tgt_length[] = {0, 100, 200, 750, 0, 50, 0, 0, 200, 100, 100};
|
||||||
|
|
||||||
ai_list_iterator ai_list_itr = ai_list.begin();
|
ai_list_iterator ai_list_itr = ai_list.begin();
|
||||||
ai_list_iterator end = ai_list.end();
|
ai_list_iterator end = ai_list.end();
|
||||||
|
|
||||||
|
|
|
@ -116,13 +116,13 @@ void FGSubmodelMgr::update(double dt)
|
||||||
_impact = (*sm_list_itr)->_getImpactData();
|
_impact = (*sm_list_itr)->_getImpactData();
|
||||||
_hit = (*sm_list_itr)->_getCollisionData();
|
_hit = (*sm_list_itr)->_getCollisionData();
|
||||||
int parent_subID = (*sm_list_itr)->_getSubID();
|
int parent_subID = (*sm_list_itr)->_getSubID();
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Submodel: Impact " << _impact << " hit! "
|
//SG_LOG(SG_GENERAL, SG_DEBUG, "Submodel: Impact " << _impact << " hit! "
|
||||||
<< _hit <<" parent_subID " << parent_subID);
|
// << _hit <<" parent_subID " << parent_subID);
|
||||||
if ( parent_subID == 0) // this entry in the list has no associated submodel
|
if ( parent_subID == 0) // this entry in the list has no associated submodel
|
||||||
continue; // so we can continue
|
continue; // so we can continue
|
||||||
|
|
||||||
if (_impact || _hit) {
|
if (_impact || _hit) {
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Submodel: Impact " << _impact << " hit! " << _hit );
|
//SG_LOG(SG_GENERAL, SG_DEBUG, "Submodel: Impact " << _impact << " hit! " << _hit );
|
||||||
|
|
||||||
submodel_iterator = submodels.begin();
|
submodel_iterator = submodels.begin();
|
||||||
|
|
||||||
|
@ -161,10 +161,10 @@ void FGSubmodelMgr::update(double dt)
|
||||||
i++;
|
i++;
|
||||||
in_range = true;
|
in_range = true;
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG,
|
/*SG_LOG(SG_GENERAL, SG_DEBUG,
|
||||||
"Submodels: " << (*submodel_iterator)->id
|
"Submodels: " << (*submodel_iterator)->id
|
||||||
<< " name " << (*submodel_iterator)->name
|
<< " name " << (*submodel_iterator)->name
|
||||||
<< " in range " << in_range);
|
<< " in range " << in_range);*/
|
||||||
|
|
||||||
if ((*submodel_iterator)->trigger_node != 0) {
|
if ((*submodel_iterator)->trigger_node != 0) {
|
||||||
_trigger_node = (*submodel_iterator)->trigger_node;
|
_trigger_node = (*submodel_iterator)->trigger_node;
|
||||||
|
@ -188,8 +188,8 @@ void FGSubmodelMgr::update(double dt)
|
||||||
in_range = true;
|
in_range = true;
|
||||||
|
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG,
|
//SG_LOG(SG_GENERAL, SG_DEBUG,
|
||||||
"Submodels: continuing: " << id << " name " << name );
|
// "Submodels: continuing: " << id << " name " << name );
|
||||||
++sm_list_itr;
|
++sm_list_itr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -207,8 +207,8 @@ void FGSubmodelMgr::update(double dt)
|
||||||
//cout << "own name " << own_lat << ", " << own_lon << " range " << range_nm << endl;
|
//cout << "own name " << own_lat << ", " << own_lon << " range " << range_nm << endl;
|
||||||
|
|
||||||
if (range_nm > 15) {
|
if (range_nm > 15) {
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG,
|
//SG_LOG(SG_GENERAL, SG_DEBUG,
|
||||||
"Submodels: skipping release, out of range: " << id);
|
// "Submodels: skipping release, out of range: " << id);
|
||||||
in_range = false;
|
in_range = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,11 +216,11 @@ void FGSubmodelMgr::update(double dt)
|
||||||
++sm_list_itr;
|
++sm_list_itr;
|
||||||
} // end while
|
} // end while
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG,
|
/*SG_LOG(SG_GENERAL, SG_DEBUG,
|
||||||
"Submodels end: " << (*submodel_iterator)->id
|
"Submodels end: " << (*submodel_iterator)->id
|
||||||
<< " name " << (*submodel_iterator)->name
|
<< " name " << (*submodel_iterator)->name
|
||||||
<< " count " << (*submodel_iterator)->count
|
<< " count " << (*submodel_iterator)->count
|
||||||
<< " in range " << in_range);
|
<< " in range " << in_range);*/
|
||||||
|
|
||||||
if ((*submodel_iterator)->count != 0 && in_range)
|
if ((*submodel_iterator)->count != 0 && in_range)
|
||||||
release(*submodel_iterator, dt);
|
release(*submodel_iterator, dt);
|
||||||
|
@ -286,6 +286,7 @@ bool FGSubmodelMgr::release(submodel *sm, double dt)
|
||||||
ballist->setFuseRange(sm->fuse_range);
|
ballist->setFuseRange(sm->fuse_range);
|
||||||
ballist->setSubmodel(sm->submodel.c_str());
|
ballist->setSubmodel(sm->submodel.c_str());
|
||||||
ballist->setSubID(sm->sub_id);
|
ballist->setSubID(sm->sub_id);
|
||||||
|
ballist->setForceStabilisation(sm->force_stabilised);
|
||||||
ballist->setExternalForce(sm->ext_force);
|
ballist->setExternalForce(sm->ext_force);
|
||||||
ballist->setForcePath(sm->force_path.c_str());
|
ballist->setForcePath(sm->force_path.c_str());
|
||||||
ai->attach(ballist);
|
ai->attach(ballist);
|
||||||
|
@ -600,6 +601,7 @@ void FGSubmodelMgr::setData(int id, string& path, bool serviceable)
|
||||||
sm->contents_node = fgGetNode(entry_node->getStringValue("contents", "none"), false);
|
sm->contents_node = fgGetNode(entry_node->getStringValue("contents", "none"), false);
|
||||||
sm->speed_node = fgGetNode(entry_node->getStringValue("speed-node", "none"), false);
|
sm->speed_node = fgGetNode(entry_node->getStringValue("speed-node", "none"), false);
|
||||||
sm->submodel = entry_node->getStringValue("submodel-path", "");
|
sm->submodel = entry_node->getStringValue("submodel-path", "");
|
||||||
|
sm->force_stabilised= entry_node->getBoolValue("force-stabilised", false);
|
||||||
sm->ext_force = entry_node->getBoolValue("external-force", false);
|
sm->ext_force = entry_node->getBoolValue("external-force", false);
|
||||||
sm->force_path = entry_node->getStringValue("force-path", "");
|
sm->force_path = entry_node->getStringValue("force-path", "");
|
||||||
//cout << "sm->contents_node " << sm->contents_node << endl;
|
//cout << "sm->contents_node " << sm->contents_node << endl;
|
||||||
|
@ -614,8 +616,6 @@ void FGSubmodelMgr::setData(int id, string& path, bool serviceable)
|
||||||
sm->trigger_node = 0;
|
sm->trigger_node = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Submodels: trigger " << sm->trigger_node->getBoolValue() );
|
|
||||||
|
|
||||||
if (sm->speed_node != 0)
|
if (sm->speed_node != 0)
|
||||||
sm->speed = sm->speed_node->getDoubleValue();
|
sm->speed = sm->speed_node->getDoubleValue();
|
||||||
|
|
||||||
|
@ -630,7 +630,6 @@ void FGSubmodelMgr::setData(int id, string& path, bool serviceable)
|
||||||
sm->prop->tie("repeat", SGRawValuePointer<bool>(&(sm->repeat)));
|
sm->prop->tie("repeat", SGRawValuePointer<bool>(&(sm->repeat)));
|
||||||
sm->prop->tie("id", SGRawValuePointer<int>(&(sm->id)));
|
sm->prop->tie("id", SGRawValuePointer<int>(&(sm->id)));
|
||||||
sm->prop->tie("sub-id", SGRawValuePointer<int>(&(sm->sub_id)));
|
sm->prop->tie("sub-id", SGRawValuePointer<int>(&(sm->sub_id)));
|
||||||
|
|
||||||
sm->prop->tie("serviceable", SGRawValuePointer<bool>(&(sm->serviceable)));
|
sm->prop->tie("serviceable", SGRawValuePointer<bool>(&(sm->serviceable)));
|
||||||
string name = sm->name;
|
string name = sm->name;
|
||||||
sm->prop->setStringValue("name", name.c_str());
|
sm->prop->setStringValue("name", name.c_str());
|
||||||
|
@ -765,10 +764,10 @@ void FGSubmodelMgr::loadSubmodels()
|
||||||
if (!submodel.empty()) {
|
if (!submodel.empty()) {
|
||||||
//int id = (*submodel_iterator)->id;
|
//int id = (*submodel_iterator)->id;
|
||||||
bool serviceable = true;
|
bool serviceable = true;
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "found path sub sub "
|
//SG_LOG(SG_GENERAL, SG_DEBUG, "found path sub sub "
|
||||||
<< submodel
|
// << submodel
|
||||||
<< " index " << index
|
// << " index " << index
|
||||||
<< "name " << (*submodel_iterator)->name);
|
// << "name " << (*submodel_iterator)->name);
|
||||||
|
|
||||||
(*submodel_iterator)->sub_id = index;
|
(*submodel_iterator)->sub_id = index;
|
||||||
setSubData(index, submodel, serviceable);
|
setSubData(index, submodel, serviceable);
|
||||||
|
@ -788,10 +787,10 @@ void FGSubmodelMgr::loadSubmodels()
|
||||||
|
|
||||||
while (submodel_iterator != submodels.end()) {
|
while (submodel_iterator != submodels.end()) {
|
||||||
int id = (*submodel_iterator)->id;
|
int id = (*submodel_iterator)->id;
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG,"after pushback "
|
//SG_LOG(SG_GENERAL, SG_DEBUG,"after pushback "
|
||||||
<< " id " << id
|
// << " id " << id
|
||||||
<< " name " << (*submodel_iterator)->name
|
// << " name " << (*submodel_iterator)->name
|
||||||
<< " sub id " << (*submodel_iterator)->sub_id);
|
// << " sub id " << (*submodel_iterator)->sub_id);
|
||||||
|
|
||||||
++submodel_iterator;
|
++submodel_iterator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ public:
|
||||||
double fuse_range;
|
double fuse_range;
|
||||||
string submodel;
|
string submodel;
|
||||||
int sub_id;
|
int sub_id;
|
||||||
|
bool force_stabilised;
|
||||||
bool ext_force;
|
bool ext_force;
|
||||||
string force_path;
|
string force_path;
|
||||||
} submodel;
|
} submodel;
|
||||||
|
|
|
@ -53,12 +53,15 @@ HeadingIndicatorFG::init ()
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + name;
|
||||||
|
|
||||||
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
|
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
||||||
_offset_node = node->getChild("offset-deg", 0, true);
|
_offset_node = node->getChild("offset-deg", 0, true);
|
||||||
_serviceable_node = node->getChild("serviceable", 0, true);
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
_error_node = node->getChild("heading-bug-error-deg", 0, true);
|
_error_node = node->getChild("heading-bug-error-deg", 0, true);
|
||||||
_nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
|
_nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
|
||||||
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
|
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
|
||||||
|
_off_node = node->getChild("off-flag", 0, true);
|
||||||
|
|
||||||
_last_heading_deg = (_heading_in_node->getDoubleValue() +
|
_last_heading_deg = (_heading_in_node->getDoubleValue() +
|
||||||
_offset_node->getDoubleValue());
|
_offset_node->getDoubleValue());
|
||||||
_electrical_node = fgGetNode("/systems/electrical/outputs/DG", true);
|
_electrical_node = fgGetNode("/systems/electrical/outputs/DG", true);
|
||||||
|
@ -96,37 +99,43 @@ HeadingIndicatorFG::update (double dt)
|
||||||
{
|
{
|
||||||
// Get the spin from the gyro
|
// Get the spin from the gyro
|
||||||
_gyro.set_power_norm(_electrical_node->getDoubleValue());
|
_gyro.set_power_norm(_electrical_node->getDoubleValue());
|
||||||
|
|
||||||
_gyro.update(dt);
|
_gyro.update(dt);
|
||||||
double spin = _gyro.get_spin_norm();
|
double spin = _gyro.get_spin_norm();
|
||||||
|
|
||||||
|
if ( _electrical_node->getDoubleValue() > 0 && spin >= 0.25) {
|
||||||
|
_off_node->setBoolValue(false);
|
||||||
|
} else {
|
||||||
|
_off_node->setBoolValue(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// No time-based precession for a flux gate compass
|
// No time-based precession for a flux gate compass
|
||||||
// We just use offset to get the magvar
|
// We just use offset to get the magvar
|
||||||
|
|
||||||
double offset = _offset_node->getDoubleValue();
|
double offset = _offset_node->getDoubleValue();
|
||||||
|
|
||||||
// TODO: movement-induced error
|
// TODO: movement-induced error
|
||||||
|
|
||||||
// Next, calculate the indicated heading,
|
// Next, calculate the indicated heading,
|
||||||
// introducing errors.
|
// introducing errors.
|
||||||
double factor = 100 * (spin * spin * spin * spin * spin * spin);
|
double factor = 0.1 / (spin * spin * spin * spin * spin * spin);
|
||||||
double heading = _heading_in_node->getDoubleValue();
|
double heading = _heading_in_node->getDoubleValue();
|
||||||
|
|
||||||
// Now, we have to get the current
|
// Now, we have to get the current
|
||||||
// heading and the last heading into
|
// heading and the last heading into
|
||||||
// the same range.
|
// the same range.
|
||||||
while ((heading - _last_heading_deg) > 180)
|
if ((heading - _last_heading_deg) > 180)
|
||||||
_last_heading_deg += 360;
|
_last_heading_deg += 360;
|
||||||
while ((heading - _last_heading_deg) < -180)
|
if ((heading - _last_heading_deg) < -180)
|
||||||
_last_heading_deg -= 360;
|
_last_heading_deg -= 360;
|
||||||
|
|
||||||
heading = fgGetLowPass(_last_heading_deg, heading, dt * factor);
|
heading = fgGetLowPass(_last_heading_deg, heading, dt * factor);
|
||||||
_last_heading_deg = heading;
|
_last_heading_deg = heading;
|
||||||
|
|
||||||
heading += offset;
|
heading += offset;
|
||||||
while (heading < 0)
|
|
||||||
|
if (heading < 0)
|
||||||
heading += 360;
|
heading += 360;
|
||||||
while (heading > 360)
|
if (heading > 360)
|
||||||
heading -= 360;
|
heading -= 360;
|
||||||
|
|
||||||
_heading_out_node->setDoubleValue(heading);
|
_heading_out_node->setDoubleValue(heading);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model an electicallym-powered fluxgate compass
|
* Model an electically-powered fluxgate compass
|
||||||
*
|
*
|
||||||
* Input properties:
|
* Input properties:
|
||||||
*
|
*
|
||||||
|
@ -61,6 +61,7 @@ private:
|
||||||
SGPropertyNode_ptr _electrical_node;
|
SGPropertyNode_ptr _electrical_node;
|
||||||
SGPropertyNode_ptr _error_node;
|
SGPropertyNode_ptr _error_node;
|
||||||
SGPropertyNode_ptr _nav1_error_node;
|
SGPropertyNode_ptr _nav1_error_node;
|
||||||
|
SGPropertyNode_ptr _off_node;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ MasterReferenceGyro::init ()
|
||||||
_indicated_hdg_rate = 0;
|
_indicated_hdg_rate = 0;
|
||||||
_indicated_roll_rate = 0;
|
_indicated_roll_rate = 0;
|
||||||
_indicated_pitch_rate = 0;
|
_indicated_pitch_rate = 0;
|
||||||
|
_erect_time = 0;
|
||||||
|
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + _name;
|
branch = "/instrumentation/" + _name;
|
||||||
|
@ -70,11 +71,13 @@ MasterReferenceGyro::init ()
|
||||||
_responsiveness_node = node->getChild("responsiveness", 0, true);
|
_responsiveness_node = node->getChild("responsiveness", 0, true);
|
||||||
_error_out_node = node->getChild("heading-bug-error-deg", 0, true);
|
_error_out_node = node->getChild("heading-bug-error-deg", 0, true);
|
||||||
_hdg_input_source_node = node->getChild("heading-source", 0, true);
|
_hdg_input_source_node = node->getChild("heading-source", 0, true);
|
||||||
|
_fast_erect_node = node->getChild("fast-erect", 0, true);
|
||||||
|
|
||||||
_electrical_node->setDoubleValue(0);
|
_electrical_node->setDoubleValue(0);
|
||||||
_responsiveness_node->setDoubleValue(0.75);
|
_responsiveness_node->setDoubleValue(0.75);
|
||||||
_off_node->setBoolValue(false);
|
_off_node->setBoolValue(false);
|
||||||
_hdg_input_source_node->setBoolValue(false);
|
_hdg_input_source_node->setBoolValue(false);
|
||||||
|
_fast_erect_node->setBoolValue(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -119,12 +122,11 @@ MasterReferenceGyro::update (double dt)
|
||||||
double spin = _gyro.get_spin_norm();
|
double spin = _gyro.get_spin_norm();
|
||||||
|
|
||||||
// set the "off-flag"
|
// set the "off-flag"
|
||||||
if ( _electrical_node->getDoubleValue() == 0 ) {
|
if ( _electrical_node->getDoubleValue() > 0 && spin >= 0.25) {
|
||||||
_off_node->setBoolValue(true);
|
|
||||||
} else if ( spin == 1 ) {
|
|
||||||
_off_node->setBoolValue(false);
|
_off_node->setBoolValue(false);
|
||||||
} else {
|
} else {
|
||||||
_off_node->setBoolValue(true);
|
_off_node->setBoolValue(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the input values
|
// Get the input values
|
||||||
|
@ -156,7 +158,8 @@ MasterReferenceGyro::update (double dt)
|
||||||
//but we need to filter the hdg and yaw_rate as well - yuk!
|
//but we need to filter the hdg and yaw_rate as well - yuk!
|
||||||
responsiveness = 0.1 / (spin * spin * spin * spin * spin * spin);
|
responsiveness = 0.1 / (spin * spin * spin * spin * spin * spin);
|
||||||
yaw_rate = fgGetLowPass( _last_yaw_rate , yaw_rate, responsiveness );
|
yaw_rate = fgGetLowPass( _last_yaw_rate , yaw_rate, responsiveness );
|
||||||
g = fgGetLowPass( _last_g , yaw_rate, 0.15 );
|
g = fgGetLowPass( _last_g , g, 0.015 );
|
||||||
|
|
||||||
|
|
||||||
// store the new values
|
// store the new values
|
||||||
_last_roll = roll;
|
_last_roll = roll;
|
||||||
|
@ -167,10 +170,22 @@ MasterReferenceGyro::update (double dt)
|
||||||
_last_yaw_rate = yaw_rate;
|
_last_yaw_rate = yaw_rate;
|
||||||
_last_g = g;
|
_last_g = g;
|
||||||
|
|
||||||
|
if (_erect_time > 0){
|
||||||
|
|
||||||
|
if ( !_fast_erect_node->getBoolValue() )
|
||||||
|
_erect_time -= dt;
|
||||||
|
else
|
||||||
|
_erect_time -= 2 * dt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//SG_LOG(SG_GENERAL, SG_ALERT,
|
||||||
|
// "g input " << g <<" _erect_time " << _erect_time << " spin " << spin);
|
||||||
|
|
||||||
//the gyro only erects inside limits
|
//the gyro only erects inside limits
|
||||||
if ( fabs ( yaw_rate ) <= 5
|
if ( fabs ( yaw_rate ) <= 5
|
||||||
&& (_g_in_node->getDoubleValue() <= 1.5
|
&& ( g <= 1.5 || g >= -0.5)
|
||||||
|| _g_in_node->getDoubleValue() >= -0.5) ) {
|
&& _erect_time <=0 ) {
|
||||||
indicated_roll = _last_roll;
|
indicated_roll = _last_roll;
|
||||||
indicated_pitch = _last_pitch;
|
indicated_pitch = _last_pitch;
|
||||||
indicated_hdg = _last_hdg;
|
indicated_hdg = _last_hdg;
|
||||||
|
@ -181,6 +196,10 @@ MasterReferenceGyro::update (double dt)
|
||||||
indicated_roll_rate = 0;
|
indicated_roll_rate = 0;
|
||||||
indicated_pitch_rate = 0;
|
indicated_pitch_rate = 0;
|
||||||
indicated_hdg_rate = 0;
|
indicated_hdg_rate = 0;
|
||||||
|
|
||||||
|
if (_erect_time <= 0 )
|
||||||
|
_erect_time = 34;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the difference between the indicated heading
|
// calculate the difference between the indicated heading
|
||||||
|
|
|
@ -65,6 +65,7 @@ private:
|
||||||
double _last_pitch_rate;
|
double _last_pitch_rate;
|
||||||
double _last_yaw_rate;
|
double _last_yaw_rate;
|
||||||
double _last_g;
|
double _last_g;
|
||||||
|
double _erect_time;
|
||||||
|
|
||||||
Gyro _gyro;
|
Gyro _gyro;
|
||||||
|
|
||||||
|
@ -94,6 +95,7 @@ private:
|
||||||
SGPropertyNode_ptr _pitch_rate_node;
|
SGPropertyNode_ptr _pitch_rate_node;
|
||||||
SGPropertyNode_ptr _responsiveness_node;
|
SGPropertyNode_ptr _responsiveness_node;
|
||||||
SGPropertyNode_ptr _hdg_input_source_node;
|
SGPropertyNode_ptr _hdg_input_source_node;
|
||||||
|
SGPropertyNode_ptr _fast_erect_node;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_MRG_HXX
|
#endif // __INSTRUMENTS_MRG_HXX
|
||||||
|
|
Loading…
Reference in a new issue