Roy Vegard Ovesen:
- finish cleanup/optimization of instrumentation system (started by mfranz) - improve configuration of special properties by addressing them directly
This commit is contained in:
parent
880e4908ac
commit
b9e4775a7a
36 changed files with 187 additions and 584 deletions
|
@ -17,10 +17,10 @@
|
||||||
|
|
||||||
AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
|
AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
|
||||||
:
|
:
|
||||||
name(node->getStringValue("name", "airspeed-indicator")),
|
_name(node->getStringValue("name", "airspeed-indicator")),
|
||||||
num(node->getIntValue("number", 0)),
|
_num(node->getIntValue("number", 0)),
|
||||||
pitot_port(node->getStringValue("pitot-port", "/systems/pitot")),
|
_total_pressure(node->getStringValue("total-pressure", "/systems/pitot/total-pressure-inhg")),
|
||||||
static_port(node->getStringValue("static-port", "/systems/static"))
|
_static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,14 +32,12 @@ void
|
||||||
AirspeedIndicator::init ()
|
AirspeedIndicator::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
pitot_port += "/total-pressure-inhg";
|
|
||||||
static_port += "/pressure-inhg";
|
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
_serviceable_node = node->getChild("serviceable", 0, true);
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
_total_pressure_node = fgGetNode(pitot_port.c_str(), true);
|
_total_pressure_node = fgGetNode(_total_pressure.c_str(), true);
|
||||||
_static_pressure_node = fgGetNode(static_port.c_str(), true);
|
_static_pressure_node = fgGetNode(_static_pressure.c_str(), true);
|
||||||
_density_node = fgGetNode("/environment/density-slugft3", true);
|
_density_node = fgGetNode("/environment/density-slugft3", true);
|
||||||
_speed_node = node->getChild("indicated-speed-kt", 0, true);
|
_speed_node = node->getChild("indicated-speed-kt", 0, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ class AirspeedIndicator : public SGSubsystem
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AirspeedIndicator ( SGPropertyNode *node );
|
AirspeedIndicator ( SGPropertyNode *node );
|
||||||
AirspeedIndicator ( int i);
|
|
||||||
virtual ~AirspeedIndicator ();
|
virtual ~AirspeedIndicator ();
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
|
@ -43,10 +42,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
unsigned int num;
|
unsigned int _num;
|
||||||
string pitot_port;
|
string _total_pressure;
|
||||||
string static_port;
|
string _static_pressure;
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _total_pressure_node;
|
SGPropertyNode_ptr _total_pressure_node;
|
||||||
SGPropertyNode_ptr _static_pressure_node;
|
SGPropertyNode_ptr _static_pressure_node;
|
||||||
|
|
|
@ -46,40 +46,14 @@ static double altitude_data[][2] = {
|
||||||
|
|
||||||
|
|
||||||
Altimeter::Altimeter ( SGPropertyNode *node )
|
Altimeter::Altimeter ( SGPropertyNode *node )
|
||||||
: name("altimeter"),
|
: _name(node->getStringValue("name", "altimeter")),
|
||||||
num(0),
|
_num(node->getIntValue("number", 0)),
|
||||||
static_port("/systems/static"),
|
_static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")),
|
||||||
_altitude_table(new SGInterpTable)
|
_altitude_table(new SGInterpTable)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; altitude_data[i][0] != -1; i++)
|
for (i = 0; altitude_data[i][0] != -1; i++)
|
||||||
_altitude_table->addEntry(altitude_data[i][0], altitude_data[i][1]);
|
_altitude_table->addEntry(altitude_data[i][0], altitude_data[i][1]);
|
||||||
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else if ( cname == "static-port" ) {
|
|
||||||
static_port = cval;
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in altimeter config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Altimeter::Altimeter ()
|
|
||||||
: _altitude_table(new SGInterpTable)
|
|
||||||
{
|
|
||||||
|
|
||||||
for (int i = 0; altitude_data[i][0] != -1; i++)
|
|
||||||
_altitude_table->addEntry(altitude_data[i][0], altitude_data[i][1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Altimeter::~Altimeter ()
|
Altimeter::~Altimeter ()
|
||||||
|
@ -91,14 +65,13 @@ void
|
||||||
Altimeter::init ()
|
Altimeter::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
static_port += "/pressure-inhg";
|
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
|
|
||||||
_serviceable_node = node->getChild("serviceable", 0, true);
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
_setting_node = node->getChild("setting-inhg", 0, true);
|
_setting_node = node->getChild("setting-inhg", 0, true);
|
||||||
_pressure_node = fgGetNode(static_port.c_str(), true);
|
_pressure_node = fgGetNode(_static_pressure.c_str(), true);
|
||||||
_altitude_node = node->getChild("indicated-altitude-ft", 0, true);
|
_altitude_node = node->getChild("indicated-altitude-ft", 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,13 @@ class SGInterpTable;
|
||||||
*
|
*
|
||||||
* Input properties:
|
* Input properties:
|
||||||
*
|
*
|
||||||
* /instrumentation/"name"/serviceable
|
* /instrumentation/<name>/serviceable
|
||||||
* /instrumentation/"name"/setting-inhg
|
* /instrumentation/<name>/setting-inhg
|
||||||
* "static_port"/pressure-inhg
|
* <static_pressure>
|
||||||
*
|
*
|
||||||
* Output properties:
|
* Output properties:
|
||||||
*
|
*
|
||||||
* /instrumentation/"name"/indicated-altitude-ft
|
* /instrumentation/<name>/indicated-altitude-ft
|
||||||
*/
|
*/
|
||||||
class Altimeter : public SGSubsystem
|
class Altimeter : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,6 @@ class Altimeter : public SGSubsystem
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Altimeter (SGPropertyNode *node);
|
Altimeter (SGPropertyNode *node);
|
||||||
Altimeter ();
|
|
||||||
virtual ~Altimeter ();
|
virtual ~Altimeter ();
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
|
@ -45,9 +44,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
string static_port;
|
string _static_pressure;
|
||||||
|
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _setting_node;
|
SGPropertyNode_ptr _setting_node;
|
||||||
|
|
|
@ -21,31 +21,9 @@
|
||||||
|
|
||||||
AttitudeIndicator::AttitudeIndicator ( SGPropertyNode *node )
|
AttitudeIndicator::AttitudeIndicator ( SGPropertyNode *node )
|
||||||
:
|
:
|
||||||
name("attitude-indicator"),
|
_name(node->getStringValue("name", "attitude-indicator")),
|
||||||
num(0),
|
_num(node->getIntValue("number", 0)),
|
||||||
vacuum_system("/systems/vacuum")
|
_suction(node->getStringValue("suction", "/systems/vacuum/suction-inhg"))
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = (int) child->getDoubleValue();
|
|
||||||
} else if ( cname == "vacuum-system" ) {
|
|
||||||
vacuum_system = cval;
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in attitude-indicator config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AttitudeIndicator::AttitudeIndicator ()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,14 +35,13 @@ void
|
||||||
AttitudeIndicator::init ()
|
AttitudeIndicator::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
vacuum_system += "/suction-inhg";
|
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
|
|
||||||
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
|
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
|
||||||
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
|
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
|
||||||
_suction_node = fgGetNode(vacuum_system.c_str(), true);
|
_suction_node = fgGetNode(_suction.c_str(), true);
|
||||||
SGPropertyNode *cnode = node->getChild("config", 0, true);
|
SGPropertyNode *cnode = node->getChild("config", 0, true);
|
||||||
_tumble_flag_node = cnode->getChild("tumble-flag", 0, true);
|
_tumble_flag_node = cnode->getChild("tumble-flag", 0, true);
|
||||||
_caged_node = node->getChild("caged-flag", 0, true);
|
_caged_node = node->getChild("caged-flag", 0, true);
|
||||||
|
@ -80,8 +57,8 @@ AttitudeIndicator::bind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
|
|
||||||
fgTie((branch + "/serviceable").c_str(),
|
fgTie((branch + "/serviceable").c_str(),
|
||||||
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
|
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
|
||||||
|
@ -94,8 +71,8 @@ AttitudeIndicator::unbind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
|
|
||||||
fgUntie((branch + "/serviceable").c_str());
|
fgUntie((branch + "/serviceable").c_str());
|
||||||
fgUntie((branch + "/spin").c_str());
|
fgUntie((branch + "/spin").c_str());
|
||||||
|
|
|
@ -42,7 +42,6 @@ class AttitudeIndicator : public SGSubsystem
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AttitudeIndicator ( SGPropertyNode *node );
|
AttitudeIndicator ( SGPropertyNode *node );
|
||||||
AttitudeIndicator ();
|
|
||||||
virtual ~AttitudeIndicator ();
|
virtual ~AttitudeIndicator ();
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
|
@ -52,9 +51,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
string vacuum_system;
|
string _suction;
|
||||||
|
|
||||||
Gyro _gyro;
|
Gyro _gyro;
|
||||||
|
|
||||||
|
|
|
@ -48,35 +48,8 @@ DME::DME ( SGPropertyNode *node )
|
||||||
_transmitter_elevation_ft(0),
|
_transmitter_elevation_ft(0),
|
||||||
_transmitter_range_nm(0),
|
_transmitter_range_nm(0),
|
||||||
_transmitter_bias(0.0),
|
_transmitter_bias(0.0),
|
||||||
name("dme"),
|
_name(node->getStringValue("name", "dme")),
|
||||||
num(0)
|
_num(node->getIntValue("number", 0))
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in dme config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DME::DME ()
|
|
||||||
: _last_distance_nm(0),
|
|
||||||
_last_frequency_mhz(-1),
|
|
||||||
_time_before_search_sec(0),
|
|
||||||
_transmitter_valid(false),
|
|
||||||
_transmitter_elevation_ft(0),
|
|
||||||
_transmitter_range_nm(0),
|
|
||||||
_transmitter_bias(0.0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,9 +61,9 @@ void
|
||||||
DME::init ()
|
DME::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
|
|
||||||
_longitude_node = fgGetNode("/position/longitude-deg", true);
|
_longitude_node = fgGetNode("/position/longitude-deg", true);
|
||||||
_latitude_node = fgGetNode("/position/latitude-deg", true);
|
_latitude_node = fgGetNode("/position/latitude-deg", true);
|
||||||
|
@ -113,7 +86,7 @@ DME::update (double delta_time_sec)
|
||||||
const char * source = _source_node->getStringValue();
|
const char * source = _source_node->getStringValue();
|
||||||
if (source[0] == '\0') {
|
if (source[0] == '\0') {
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name + "/frequencies/selected-mhz";
|
branch = "/instrumentation/" + _name + "/frequencies/selected-mhz";
|
||||||
_source_node->setStringValue(branch.c_str());
|
_source_node->setStringValue(branch.c_str());
|
||||||
source = _source_node->getStringValue();
|
source = _source_node->getStringValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ class DME : public SGSubsystem
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DME ( SGPropertyNode *node );
|
DME ( SGPropertyNode *node );
|
||||||
DME ();
|
|
||||||
virtual ~DME ();
|
virtual ~DME ();
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
|
@ -76,8 +75,8 @@ private:
|
||||||
double _transmitter_range_nm;
|
double _transmitter_range_nm;
|
||||||
double _transmitter_bias;
|
double _transmitter_bias;
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -60,35 +60,17 @@ int round (double value, int nearest=1)
|
||||||
return ((int) (value/nearest + 0.5)) * nearest;
|
return ((int) (value/nearest + 0.5)) * nearest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Encoder::Encoder(SGPropertyNode *node)
|
Encoder::Encoder(SGPropertyNode *node)
|
||||||
:
|
:
|
||||||
name("encoder"),
|
_name(node->getStringValue("name", "encoder")),
|
||||||
num(0),
|
_num(node->getIntValue("number", 0)),
|
||||||
staticPort("/systems/static"),
|
_static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")),
|
||||||
altitudeTable(new SGInterpTable)
|
altitudeTable(new SGInterpTable)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; altitude_data[i][0] != -1; i++ )
|
for ( i = 0; altitude_data[i][0] != -1; i++ )
|
||||||
altitudeTable->addEntry(altitude_data[i][0], altitude_data[i][1]);
|
altitudeTable->addEntry(altitude_data[i][0], altitude_data[i][1]);
|
||||||
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else if ( cname == "static-port" ) {
|
|
||||||
staticPort = cval;
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN,
|
|
||||||
"Error in encoder config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,12 +83,11 @@ Encoder::~Encoder()
|
||||||
void Encoder::init()
|
void Encoder::init()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
staticPort += "/pressure-inhg";
|
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
// Inputs
|
// Inputs
|
||||||
staticPressureNode = fgGetNode(staticPort.c_str(), true);
|
staticPressureNode = fgGetNode(_static_pressure.c_str(), true);
|
||||||
busPowerNode = fgGetNode("/systems/electrical/outputs/encoder", true);
|
busPowerNode = fgGetNode("/systems/electrical/outputs/encoder", true);
|
||||||
serviceableNode = node->getChild("serviceable", 0, true);
|
serviceableNode = node->getChild("serviceable", 0, true);
|
||||||
// Outputs
|
// Outputs
|
||||||
|
|
|
@ -51,9 +51,9 @@ private:
|
||||||
SGPropertyNode_ptr modeCAltitudeNode;
|
SGPropertyNode_ptr modeCAltitudeNode;
|
||||||
|
|
||||||
// Internal
|
// Internal
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
string staticPort;
|
string _static_pressure;
|
||||||
|
|
||||||
SGInterpTable* altitudeTable;
|
SGInterpTable* altitudeTable;
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,41 +41,9 @@ GPS::GPS ( SGPropertyNode *node)
|
||||||
_wp1_altitude_m(0),
|
_wp1_altitude_m(0),
|
||||||
_alt_dist_ratio(0),
|
_alt_dist_ratio(0),
|
||||||
_distance_m(0),
|
_distance_m(0),
|
||||||
_course_deg(0)
|
_course_deg(0),
|
||||||
{
|
_name(node->getStringValue("name", "gps")),
|
||||||
int i;
|
_num(node->getIntValue("number", 0))
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in gps config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GPS::GPS ()
|
|
||||||
: _last_valid(false),
|
|
||||||
_last_longitude_deg(0),
|
|
||||||
_last_latitude_deg(0),
|
|
||||||
_last_altitude_m(0),
|
|
||||||
_last_speed_kts(0),
|
|
||||||
_wp0_latitude_deg(0),
|
|
||||||
_wp0_longitude_deg(0),
|
|
||||||
_wp0_altitude_m(0),
|
|
||||||
_wp1_latitude_deg(0),
|
|
||||||
_wp1_longitude_deg(0),
|
|
||||||
_wp1_altitude_m(0),
|
|
||||||
_alt_dist_ratio(0),
|
|
||||||
_distance_m(0),
|
|
||||||
_course_deg(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +58,9 @@ GPS::init ()
|
||||||
route->clear();
|
route->clear();
|
||||||
|
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
|
|
||||||
_longitude_node = fgGetNode("/position/longitude-deg", true);
|
_longitude_node = fgGetNode("/position/longitude-deg", true);
|
||||||
_latitude_node = fgGetNode("/position/latitude-deg", true);
|
_latitude_node = fgGetNode("/position/latitude-deg", true);
|
||||||
|
|
|
@ -166,14 +166,14 @@ private:
|
||||||
double _distance_m;
|
double _distance_m;
|
||||||
double _course_deg;
|
double _course_deg;
|
||||||
|
|
||||||
double bias_length;
|
double _bias_length;
|
||||||
double bias_angle;
|
double _bias_angle;
|
||||||
double azimuth_error;
|
double _azimuth_error;
|
||||||
double range_error;
|
double _range_error;
|
||||||
double elapsed_time;
|
double _elapsed_time;
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,31 +15,9 @@
|
||||||
|
|
||||||
HeadingIndicator::HeadingIndicator ( SGPropertyNode *node )
|
HeadingIndicator::HeadingIndicator ( SGPropertyNode *node )
|
||||||
:
|
:
|
||||||
name("heading-indicator"),
|
_name(node->getStringValue("name", "heading-indicator")),
|
||||||
num(0),
|
_num(node->getIntValue("number", 0)),
|
||||||
vacuum_system("/systems/vacuum")
|
_suction(node->getStringValue("suction", "/systems/vacuum/suction-inhg"))
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else if ( cname == "vacuum-system" ) {
|
|
||||||
vacuum_system = cval;
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in heading-indicator config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HeadingIndicator::HeadingIndicator ()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,13 +29,12 @@ void
|
||||||
HeadingIndicator::init ()
|
HeadingIndicator::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
vacuum_system += "/suction-inhg";
|
|
||||||
|
|
||||||
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);
|
||||||
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
|
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
|
||||||
_suction_node = fgGetNode(vacuum_system.c_str(), true);
|
_suction_node = fgGetNode(_suction.c_str(), true);
|
||||||
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
|
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
|
||||||
_last_heading_deg = (_heading_in_node->getDoubleValue() +
|
_last_heading_deg = (_heading_in_node->getDoubleValue() +
|
||||||
_offset_node->getDoubleValue());
|
_offset_node->getDoubleValue());
|
||||||
|
@ -68,8 +45,8 @@ HeadingIndicator::bind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
|
|
||||||
fgTie((branch + "/serviceable").c_str(),
|
fgTie((branch + "/serviceable").c_str(),
|
||||||
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
|
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
|
||||||
|
@ -82,8 +59,8 @@ HeadingIndicator::unbind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
|
|
||||||
fgUntie((branch + "/serviceable").c_str());
|
fgUntie((branch + "/serviceable").c_str());
|
||||||
fgUntie((branch + "/spin").c_str());
|
fgUntie((branch + "/spin").c_str());
|
||||||
|
|
|
@ -51,9 +51,9 @@ private:
|
||||||
Gyro _gyro;
|
Gyro _gyro;
|
||||||
double _last_heading_deg;
|
double _last_heading_deg;
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
string vacuum_system;
|
string _suction;
|
||||||
|
|
||||||
SGPropertyNode_ptr _offset_node;
|
SGPropertyNode_ptr _offset_node;
|
||||||
SGPropertyNode_ptr _heading_in_node;
|
SGPropertyNode_ptr _heading_in_node;
|
||||||
|
|
|
@ -21,30 +21,8 @@
|
||||||
MagCompass::MagCompass ( SGPropertyNode *node )
|
MagCompass::MagCompass ( SGPropertyNode *node )
|
||||||
: _error_deg(0.0),
|
: _error_deg(0.0),
|
||||||
_rate_degps(0.0),
|
_rate_degps(0.0),
|
||||||
name("magnetic-compass"),
|
_name(node->getStringValue("name", "magnetic-compass")),
|
||||||
num(0)
|
_num(node->getIntValue("number", 0))
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in magnetic-compass config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MagCompass::MagCompass ()
|
|
||||||
: _error_deg(0.0),
|
|
||||||
_rate_degps(0.0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,26 +34,18 @@ void
|
||||||
MagCompass::init ()
|
MagCompass::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
_serviceable_node = node->getChild("serviceable", 0, true);
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
_roll_node =
|
_roll_node = fgGetNode("/orientation/roll-deg", true);
|
||||||
fgGetNode("/orientation/roll-deg", true);
|
_pitch_node = fgGetNode("/orientation/pitch-deg", true);
|
||||||
_pitch_node =
|
_heading_node = fgGetNode("/orientation/heading-magnetic-deg", true);
|
||||||
fgGetNode("/orientation/pitch-deg", true);
|
_beta_node = fgGetNode("/orientation/side-slip-deg", true);
|
||||||
_heading_node =
|
_dip_node = fgGetNode("/environment/magnetic-dip-deg", true);
|
||||||
fgGetNode("/orientation/heading-magnetic-deg", true);
|
_x_accel_node = fgGetNode("/accelerations/pilot/x-accel-fps_sec", true);
|
||||||
_beta_node =
|
_y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
|
||||||
fgGetNode("/orientation/side-slip-deg", true);
|
_z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
|
||||||
_dip_node =
|
|
||||||
fgGetNode("/environment/magnetic-dip-deg", true);
|
|
||||||
_x_accel_node =
|
|
||||||
fgGetNode("/accelerations/pilot/x-accel-fps_sec", true);
|
|
||||||
_y_accel_node =
|
|
||||||
fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
|
|
||||||
_z_accel_node =
|
|
||||||
fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
|
|
||||||
_out_node = node->getChild("indicated-heading-deg", 0, true);
|
_out_node = node->getChild("indicated-heading-deg", 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ private:
|
||||||
double _error_deg;
|
double _error_deg;
|
||||||
double _rate_degps;
|
double _rate_degps;
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
|
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _roll_node;
|
SGPropertyNode_ptr _roll_node;
|
||||||
|
|
|
@ -20,28 +20,8 @@
|
||||||
|
|
||||||
|
|
||||||
MasterReferenceGyro::MasterReferenceGyro ( SGPropertyNode *node ) :
|
MasterReferenceGyro::MasterReferenceGyro ( SGPropertyNode *node ) :
|
||||||
name("master-reference-gyro"),
|
_name(node->getStringValue("name", "master-reference-gyro")),
|
||||||
num(0)
|
_num(node->getIntValue("number", 0))
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = (int) child->getDoubleValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in mrg config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MasterReferenceGyro::MasterReferenceGyro ()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +43,7 @@ MasterReferenceGyro::init ()
|
||||||
_indicated_pitch_rate = 0;
|
_indicated_pitch_rate = 0;
|
||||||
|
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
|
|
||||||
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
|
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
|
||||||
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
|
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
|
||||||
|
@ -74,7 +54,7 @@ MasterReferenceGyro::init ()
|
||||||
_g_in_node = fgGetNode("/accelerations/pilot-g-damped", true);
|
_g_in_node = fgGetNode("/accelerations/pilot-g-damped", true);
|
||||||
_electrical_node = fgGetNode("/systems/electrical/outputs/MRG", true);
|
_electrical_node = fgGetNode("/systems/electrical/outputs/MRG", true);
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
_off_node = node->getChild("off-flag", 0, true);
|
_off_node = node->getChild("off-flag", 0, true);
|
||||||
_pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
|
_pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
|
||||||
_roll_out_node = node->getChild("indicated-roll-deg", 0, true);
|
_roll_out_node = node->getChild("indicated-roll-deg", 0, true);
|
||||||
|
@ -95,8 +75,8 @@ MasterReferenceGyro::bind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
|
|
||||||
fgTie((branch + "/serviceable").c_str(),
|
fgTie((branch + "/serviceable").c_str(),
|
||||||
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
|
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
|
||||||
|
@ -109,8 +89,8 @@ MasterReferenceGyro::unbind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
|
|
||||||
fgUntie((branch + "/serviceable").c_str());
|
fgUntie((branch + "/serviceable").c_str());
|
||||||
fgUntie((branch + "/spin").c_str());
|
fgUntie((branch + "/spin").c_str());
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* /instrumentation/"name"/tumble-norm
|
* /instrumentation/"name"/tumble-norm
|
||||||
* /orientation/pitch-deg
|
* /orientation/pitch-deg
|
||||||
* /orientation/roll-deg
|
* /orientation/roll-deg
|
||||||
* "vacuum-system"/suction-inhg
|
|
||||||
*
|
*
|
||||||
* Output properties:
|
* Output properties:
|
||||||
*
|
*
|
||||||
|
@ -50,8 +49,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
|
|
||||||
double _last_roll;
|
double _last_roll;
|
||||||
double _last_pitch;
|
double _last_pitch;
|
||||||
|
|
|
@ -100,8 +100,8 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
||||||
last_x(0.0),
|
last_x(0.0),
|
||||||
last_loc_dist(0.0),
|
last_loc_dist(0.0),
|
||||||
last_xtrack_error(0.0),
|
last_xtrack_error(0.0),
|
||||||
name("nav"),
|
_name(node->getStringValue("name", "nav")),
|
||||||
num(0),
|
_num(node->getIntValue("number", 0)),
|
||||||
_time_before_search_sec(-1.0)
|
_time_before_search_sec(-1.0)
|
||||||
{
|
{
|
||||||
SGPath path( globals->get_fg_root() );
|
SGPath path( globals->get_fg_root() );
|
||||||
|
@ -115,25 +115,6 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
||||||
term_tbl = new SGInterpTable( term.str() );
|
term_tbl = new SGInterpTable( term.str() );
|
||||||
low_tbl = new SGInterpTable( low.str() );
|
low_tbl = new SGInterpTable( low.str() );
|
||||||
high_tbl = new SGInterpTable( high.str() );
|
high_tbl = new SGInterpTable( high.str() );
|
||||||
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN,
|
|
||||||
"Error in nav radio config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,12 +133,12 @@ FGNavRadio::init ()
|
||||||
morse.init();
|
morse.init();
|
||||||
|
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
|
|
||||||
bus_power_node =
|
bus_power_node =
|
||||||
fgGetNode(("/systems/electrical/outputs/" + name).c_str(), true);
|
fgGetNode(("/systems/electrical/outputs/" + _name).c_str(), true);
|
||||||
|
|
||||||
// inputs
|
// inputs
|
||||||
is_valid_node = node->getChild("data-is-valid", 0, true);
|
is_valid_node = node->getChild("data-is-valid", 0, true);
|
||||||
|
@ -222,9 +203,9 @@ FGNavRadio::init ()
|
||||||
gps_from_flag_node = fgGetNode("/instrumentation/gps/from-flag", true);
|
gps_from_flag_node = fgGetNode("/instrumentation/gps/from-flag", true);
|
||||||
|
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
temp << name << "nav-ident" << num;
|
temp << _name << "nav-ident" << _num;
|
||||||
nav_fx_name = temp.str();
|
nav_fx_name = temp.str();
|
||||||
temp << name << "dme-ident" << num;
|
temp << _name << "dme-ident" << _num;
|
||||||
dme_fx_name = temp.str();
|
dme_fx_name = temp.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,8 +214,8 @@ FGNavRadio::bind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,8 +224,8 @@ FGNavRadio::unbind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -142,8 +142,8 @@ class FGNavRadio : public SGSubsystem
|
||||||
double last_loc_dist;
|
double last_loc_dist;
|
||||||
double last_xtrack_error;
|
double last_xtrack_error;
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
|
|
||||||
// internal periodic station search timer
|
// internal periodic station search timer
|
||||||
double _time_before_search_sec;
|
double _time_before_search_sec;
|
||||||
|
|
|
@ -10,28 +10,8 @@
|
||||||
|
|
||||||
SlipSkidBall::SlipSkidBall ( SGPropertyNode *node)
|
SlipSkidBall::SlipSkidBall ( SGPropertyNode *node)
|
||||||
:
|
:
|
||||||
name("slip-skid-ball"),
|
_name(node->getStringValue("name", "slip-skid-ball")),
|
||||||
num(0)
|
_num(node->getIntValue("number", 0))
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in slip-skid-ball config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SlipSkidBall::SlipSkidBall ()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +23,9 @@ void
|
||||||
SlipSkidBall::init ()
|
SlipSkidBall::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
_serviceable_node = node->getChild("serviceable", 0, true);
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
_y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
|
_y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
|
||||||
_z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
|
_z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
|
|
||||||
#include "gyro.hxx"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model a slip-skid ball.
|
* Model a slip-skid ball.
|
||||||
|
@ -36,7 +34,6 @@ class SlipSkidBall : public SGSubsystem
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SlipSkidBall ( SGPropertyNode *node );
|
SlipSkidBall ( SGPropertyNode *node );
|
||||||
SlipSkidBall ();
|
|
||||||
virtual ~SlipSkidBall ();
|
virtual ~SlipSkidBall ();
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
|
@ -44,11 +41,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Gyro _gyro;
|
|
||||||
double _last_pos;
|
double _last_pos;
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
|
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _y_accel_node;
|
SGPropertyNode_ptr _y_accel_node;
|
||||||
|
|
|
@ -26,29 +26,11 @@
|
||||||
|
|
||||||
Transponder::Transponder(SGPropertyNode *node)
|
Transponder::Transponder(SGPropertyNode *node)
|
||||||
:
|
:
|
||||||
name("transponder"),
|
_name(node->getStringValue("name", "transponder")),
|
||||||
num(0),
|
_num(node->getIntValue("number", 0)),
|
||||||
encoder("/instrumentation/encoder")
|
_mode_c_altitude(node->getStringValue("mode-c-altitude",
|
||||||
|
"/instrumentation/encoder/mode-c-alt-ft"))
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else if ( cname == "encoder" ) {
|
|
||||||
encoder = cval;
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN,
|
|
||||||
"Error in transponder config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,12 +42,11 @@ Transponder::~Transponder()
|
||||||
void Transponder::init()
|
void Transponder::init()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
encoder += "/mode-c-alt-ft";
|
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
// Inputs
|
// Inputs
|
||||||
pressureAltitudeNode = fgGetNode(encoder.c_str(), true);
|
pressureAltitudeNode = fgGetNode(_mode_c_altitude.c_str(), true);
|
||||||
busPowerNode = fgGetNode("/systems/electrical/outputs/transponder", true);
|
busPowerNode = fgGetNode("/systems/electrical/outputs/transponder", true);
|
||||||
serviceableNode = node->getChild("serviceable", 0, true);
|
serviceableNode = node->getChild("serviceable", 0, true);
|
||||||
// Outputs
|
// Outputs
|
||||||
|
|
|
@ -50,9 +50,9 @@ private:
|
||||||
SGPropertyNode_ptr flightLevelNode;
|
SGPropertyNode_ptr flightLevelNode;
|
||||||
|
|
||||||
// Internal
|
// Internal
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
string encoder;
|
string _mode_c_altitude;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRANSPONDER_HXX
|
#endif // TRANSPONDER_HXX
|
||||||
|
|
|
@ -20,29 +20,8 @@
|
||||||
|
|
||||||
TurnIndicator::TurnIndicator ( SGPropertyNode *node) :
|
TurnIndicator::TurnIndicator ( SGPropertyNode *node) :
|
||||||
_last_rate(0),
|
_last_rate(0),
|
||||||
name("turn-indicator"),
|
_name(node->getStringValue("name", "turn-indicator")),
|
||||||
num(0)
|
_num(node->getIntValue("number", 0))
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in turn-indicator config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TurnIndicator::TurnIndicator () :
|
|
||||||
_last_rate(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +33,9 @@ void
|
||||||
TurnIndicator::init ()
|
TurnIndicator::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
_roll_rate_node = fgGetNode("/orientation/roll-rate-degps", true);
|
_roll_rate_node = fgGetNode("/orientation/roll-rate-degps", true);
|
||||||
_yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", true);
|
_yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", true);
|
||||||
_electric_current_node =
|
_electric_current_node =
|
||||||
|
@ -69,8 +48,8 @@ TurnIndicator::bind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
|
|
||||||
fgTie((branch + "/serviceable").c_str(),
|
fgTie((branch + "/serviceable").c_str(),
|
||||||
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
|
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
|
||||||
|
@ -83,8 +62,8 @@ TurnIndicator::unbind ()
|
||||||
{
|
{
|
||||||
std::ostringstream temp;
|
std::ostringstream temp;
|
||||||
string branch;
|
string branch;
|
||||||
temp << num;
|
temp << _num;
|
||||||
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
|
branch = "/instrumentation/" + _name + "[" + temp.str() + "]";
|
||||||
|
|
||||||
fgUntie((branch + "/serviceable").c_str());
|
fgUntie((branch + "/serviceable").c_str());
|
||||||
fgUntie((branch + "/serviceable").c_str());
|
fgUntie((branch + "/serviceable").c_str());
|
||||||
|
|
|
@ -41,7 +41,6 @@ class TurnIndicator : public SGSubsystem
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TurnIndicator ( SGPropertyNode *node );
|
TurnIndicator ( SGPropertyNode *node );
|
||||||
TurnIndicator ();
|
|
||||||
virtual ~TurnIndicator ();
|
virtual ~TurnIndicator ();
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
|
@ -54,8 +53,8 @@ private:
|
||||||
Gyro _gyro;
|
Gyro _gyro;
|
||||||
double _last_rate;
|
double _last_rate;
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
|
|
||||||
SGPropertyNode_ptr _roll_rate_node;
|
SGPropertyNode_ptr _roll_rate_node;
|
||||||
SGPropertyNode_ptr _yaw_rate_node;
|
SGPropertyNode_ptr _yaw_rate_node;
|
||||||
|
|
|
@ -12,32 +12,9 @@
|
||||||
|
|
||||||
VerticalSpeedIndicator::VerticalSpeedIndicator ( SGPropertyNode *node )
|
VerticalSpeedIndicator::VerticalSpeedIndicator ( SGPropertyNode *node )
|
||||||
: _internal_pressure_inhg(29.92),
|
: _internal_pressure_inhg(29.92),
|
||||||
name("vertical-speed-indicator"),
|
_name(node->getStringValue("name", "vertical-speed-indicator")),
|
||||||
num(0),
|
_num(node->getIntValue("number", 0)),
|
||||||
static_port("/systems/static")
|
_static_pressure(node->getStringValue("static-pressure", "/Systems/static/pressure-inhg"))
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else if ( cname == "static-port" ) {
|
|
||||||
static_port = cval;
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in vertical-speed-indicator config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VerticalSpeedIndicator::VerticalSpeedIndicator ()
|
|
||||||
: _internal_pressure_inhg(29.92)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,12 +26,11 @@ void
|
||||||
VerticalSpeedIndicator::init ()
|
VerticalSpeedIndicator::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
static_port += "/pressure-inhg";
|
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
_serviceable_node = node->getChild("serviceable", 0, true);
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
_pressure_node = fgGetNode(static_port.c_str(), true);
|
_pressure_node = fgGetNode(_static_pressure.c_str(), true);
|
||||||
_speed_node = node->getChild("indicated-speed-fpm", 0, true);
|
_speed_node = node->getChild("indicated-speed-fpm", 0, true);
|
||||||
|
|
||||||
// Initialize at ambient pressure
|
// Initialize at ambient pressure
|
||||||
|
|
|
@ -33,7 +33,6 @@ class VerticalSpeedIndicator : public SGSubsystem
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VerticalSpeedIndicator ( SGPropertyNode *node );
|
VerticalSpeedIndicator ( SGPropertyNode *node );
|
||||||
VerticalSpeedIndicator ();
|
|
||||||
virtual ~VerticalSpeedIndicator ();
|
virtual ~VerticalSpeedIndicator ();
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
|
@ -43,9 +42,9 @@ private:
|
||||||
|
|
||||||
double _internal_pressure_inhg;
|
double _internal_pressure_inhg;
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
string static_port;
|
string _static_pressure;
|
||||||
|
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _pressure_node;
|
SGPropertyNode_ptr _pressure_node;
|
||||||
|
|
|
@ -41,33 +41,13 @@
|
||||||
static const char *odgauge_name = "Aircraft/Instruments/Textures/od_wxradar.rgb";
|
static const char *odgauge_name = "Aircraft/Instruments/Textures/od_wxradar.rgb";
|
||||||
|
|
||||||
wxRadarBg::wxRadarBg ( SGPropertyNode *node) :
|
wxRadarBg::wxRadarBg ( SGPropertyNode *node) :
|
||||||
name("wxRadar"),
|
_name(node->getStringValue("name", "wxRadar")),
|
||||||
num(0),
|
_num(node->getIntValue("number", 0)),
|
||||||
resultTexture( 0 ),
|
resultTexture( 0 ),
|
||||||
wxEcho( 0 ),
|
wxEcho( 0 ),
|
||||||
last_switchKnob( "off" ),
|
last_switchKnob( "off" ),
|
||||||
sim_init_done ( false ),
|
sim_init_done ( false ),
|
||||||
odg( 0 )
|
odg( 0 )
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Error in wxRadar config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRadarBg::wxRadarBg ()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,9 +59,9 @@ void
|
||||||
wxRadarBg::init ()
|
wxRadarBg::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name;
|
branch = "/instrumentation/" + _name;
|
||||||
|
|
||||||
_Instrument = fgGetNode(branch.c_str(), num, true );
|
_Instrument = fgGetNode(branch.c_str(), _num, true );
|
||||||
_serviceable_node = _Instrument->getChild("serviceable", 0, true);
|
_serviceable_node = _Instrument->getChild("serviceable", 0, true);
|
||||||
resultTexture = FGTextureManager::createTexture( odgauge_name );
|
resultTexture = FGTextureManager::createTexture( odgauge_name );
|
||||||
SGPath tpath(globals->get_fg_root());
|
SGPath tpath(globals->get_fg_root());
|
||||||
|
|
|
@ -46,8 +46,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
|
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _Instrument;
|
SGPropertyNode_ptr _Instrument;
|
||||||
|
|
|
@ -13,31 +13,9 @@
|
||||||
|
|
||||||
PitotSystem::PitotSystem ( SGPropertyNode *node )
|
PitotSystem::PitotSystem ( SGPropertyNode *node )
|
||||||
:
|
:
|
||||||
num(0),
|
_name(node->getStringValue("name", "pitot")),
|
||||||
name("pitot")
|
_num(node->getIntValue("number", 0))
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_SYSTEMS, SG_WARN, "Error in systems config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PitotSystem::PitotSystem ( int i )
|
|
||||||
{
|
|
||||||
num = i;
|
|
||||||
name = "pitot";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PitotSystem::~PitotSystem ()
|
PitotSystem::~PitotSystem ()
|
||||||
|
@ -48,9 +26,9 @@ void
|
||||||
PitotSystem::init ()
|
PitotSystem::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/systems/" + name;
|
branch = "/systems/" + _name;
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
_serviceable_node = node->getChild("serviceable", 0, true);
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
_pressure_node = fgGetNode("/environment/pressure-inhg", true);
|
_pressure_node = fgGetNode("/environment/pressure-inhg", true);
|
||||||
_density_node = fgGetNode("/environment/density-slugft3", true);
|
_density_node = fgGetNode("/environment/density-slugft3", true);
|
||||||
|
|
|
@ -43,7 +43,6 @@ class PitotSystem : public SGSubsystem
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PitotSystem ( SGPropertyNode *node );
|
PitotSystem ( SGPropertyNode *node );
|
||||||
PitotSystem ( int i );
|
|
||||||
virtual ~PitotSystem ();
|
virtual ~PitotSystem ();
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
|
@ -53,8 +52,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int num;
|
string _name;
|
||||||
string name;
|
int _num;
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _pressure_node;
|
SGPropertyNode_ptr _pressure_node;
|
||||||
SGPropertyNode_ptr _density_node;
|
SGPropertyNode_ptr _density_node;
|
||||||
|
|
|
@ -10,31 +10,9 @@
|
||||||
|
|
||||||
StaticSystem::StaticSystem ( SGPropertyNode *node )
|
StaticSystem::StaticSystem ( SGPropertyNode *node )
|
||||||
:
|
:
|
||||||
name("static"),
|
_name(node->getStringValue("name", "static")),
|
||||||
num(0)
|
_num(node->getIntValue("number", 0))
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
|
||||||
SGPropertyNode *child = node->getChild(i);
|
|
||||||
string cname = child->getName();
|
|
||||||
string cval = child->getStringValue();
|
|
||||||
if ( cname == "name" ) {
|
|
||||||
name = cval;
|
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else {
|
|
||||||
SG_LOG( SG_SYSTEMS, SG_WARN, "Error in systems config logic" );
|
|
||||||
if ( name.length() ) {
|
|
||||||
SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StaticSystem::StaticSystem ( int i )
|
|
||||||
{
|
|
||||||
name = "static";
|
|
||||||
num = i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticSystem::~StaticSystem ()
|
StaticSystem::~StaticSystem ()
|
||||||
|
@ -45,9 +23,9 @@ void
|
||||||
StaticSystem::init ()
|
StaticSystem::init ()
|
||||||
{
|
{
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/systems/" + name;
|
branch = "/systems/" + _name;
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
_serviceable_node = node->getChild("serviceable", 0, true);
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
_pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
|
_pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
|
||||||
_pressure_out_node = node->getChild("pressure-inhg", 0, true);
|
_pressure_out_node = node->getChild("pressure-inhg", 0, true);
|
||||||
|
|
|
@ -46,8 +46,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _pressure_in_node;
|
SGPropertyNode_ptr _pressure_in_node;
|
||||||
SGPropertyNode_ptr _pressure_out_node;
|
SGPropertyNode_ptr _pressure_out_node;
|
||||||
|
|
|
@ -13,42 +13,27 @@
|
||||||
|
|
||||||
VacuumSystem::VacuumSystem ( SGPropertyNode *node )
|
VacuumSystem::VacuumSystem ( SGPropertyNode *node )
|
||||||
:
|
:
|
||||||
name("vacuum"),
|
_name(node->getStringValue("name", "vacuum")),
|
||||||
num(0),
|
_num(node->getIntValue("number", 0)),
|
||||||
scale(1.0)
|
_scale(node->getDoubleValue("scale", 1.0))
|
||||||
|
|
||||||
{
|
{
|
||||||
rpms.clear();
|
_rpms.clear();
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
for ( i = 0; i < node->nChildren(); ++i ) {
|
||||||
SGPropertyNode *child = node->getChild(i);
|
SGPropertyNode *child = node->getChild(i);
|
||||||
string cname = child->getName();
|
string cname = child->getName();
|
||||||
string cval = child->getStringValue();
|
string cval = child->getStringValue();
|
||||||
if ( cname == "name" ) {
|
if ( cname == "rpm" ) {
|
||||||
name = cval;
|
_rpms.push_back(cval);
|
||||||
} else if ( cname == "number" ) {
|
|
||||||
num = child->getIntValue();
|
|
||||||
} else if ( cname == "rpm" ) {
|
|
||||||
rpms.push_back(cval);
|
|
||||||
} else if ( cname == "scale" ) {
|
|
||||||
scale = child->getDoubleValue();
|
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_SYSTEMS, SG_WARN, "Error in vacuum config logic" );
|
SG_LOG( SG_SYSTEMS, SG_WARN, "Error in vacuum config logic" );
|
||||||
if ( name.length() ) {
|
if ( _name.length() ) {
|
||||||
SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
|
SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << _name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VacuumSystem::VacuumSystem( int i )
|
|
||||||
{
|
|
||||||
name = "vacuum";
|
|
||||||
num = i;
|
|
||||||
rpms.clear();
|
|
||||||
scale = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
VacuumSystem::~VacuumSystem ()
|
VacuumSystem::~VacuumSystem ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -58,12 +43,12 @@ VacuumSystem::init()
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/systems/" + name;
|
branch = "/systems/" + _name;
|
||||||
|
|
||||||
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
||||||
_serviceable_node = node->getChild("serviceable", 0, true);
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
||||||
for ( i = 0; i < rpms.size(); i++ ) {
|
for ( i = 0; i < _rpms.size(); i++ ) {
|
||||||
SGPropertyNode_ptr _rpm_node = fgGetNode(rpms[i].c_str(), true);
|
SGPropertyNode_ptr _rpm_node = fgGetNode(_rpms[i].c_str(), true);
|
||||||
_rpm_nodes.push_back( _rpm_node );
|
_rpm_nodes.push_back( _rpm_node );
|
||||||
}
|
}
|
||||||
_pressure_node = fgGetNode("/environment/pressure-inhg", true);
|
_pressure_node = fgGetNode("/environment/pressure-inhg", true);
|
||||||
|
@ -94,7 +79,7 @@ VacuumSystem::update (double dt)
|
||||||
// select the source with the max rpm
|
// select the source with the max rpm
|
||||||
double rpm = 0.0;
|
double rpm = 0.0;
|
||||||
for ( i = 0; i < _rpm_nodes.size(); i++ ) {
|
for ( i = 0; i < _rpm_nodes.size(); i++ ) {
|
||||||
double tmp = _rpm_nodes[i]->getDoubleValue() * scale;
|
double tmp = _rpm_nodes[i]->getDoubleValue() * _scale;
|
||||||
if ( tmp > rpm ) {
|
if ( tmp > rpm ) {
|
||||||
rpm = tmp;
|
rpm = tmp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,10 +49,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string name;
|
string _name;
|
||||||
int num;
|
int _num;
|
||||||
string_list rpms;
|
string_list _rpms;
|
||||||
double scale;
|
double _scale;
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
vector<SGPropertyNode_ptr> _rpm_nodes;
|
vector<SGPropertyNode_ptr> _rpm_nodes;
|
||||||
SGPropertyNode_ptr _pressure_node;
|
SGPropertyNode_ptr _pressure_node;
|
||||||
|
|
Loading…
Reference in a new issue