13
19
#include <Main/util.hxx>
22
AttitudeIndicator::AttitudeIndicator ( SGPropertyNode *node )
24
name("attitude-indicator"),
26
vacuum_system("/systems/vacuum")
29
for ( i = 0; i < node->nChildren(); ++i ) {
30
SGPropertyNode *child = node->getChild(i);
31
string cname = child->getName();
32
string cval = child->getStringValue();
33
if ( cname == "name" ) {
35
} else if ( cname == "number" ) {
36
num = (int) child->getDoubleValue();
37
} else if ( cname == "vacuum-system" ) {
40
SG_LOG( SG_INSTR, SG_WARN, "Error in attitude-indicator config logic" );
41
if ( name.length() ) {
42
SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
16
48
AttitudeIndicator::AttitudeIndicator ()
25
57
AttitudeIndicator::init ()
27
// TODO: allow index of pump and AI
60
branch = "/instrumentation/" + name;
61
vacuum_system += "/suction-inhg";
63
SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
29
65
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
30
66
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
31
_suction_node = fgGetNode("/systems/vacuum[0]/suction-inhg", true);
33
fgGetNode("/instrumentation/attitude-indicator/config/tumble-flag",
36
fgGetNode("/instrumentation/attitude-indicator/caged-flag", true);
38
fgGetNode("/instrumentation/attitude-indicator/tumble-norm", true);
40
fgGetNode("/instrumentation/attitude-indicator/internal-pitch-deg",
43
fgGetNode("/instrumentation/attitude-indicator/internal-roll-deg",
46
fgGetNode("/instrumentation/attitude-indicator/indicated-pitch-deg",
49
fgGetNode("/instrumentation/attitude-indicator/indicated-roll-deg",
67
_suction_node = fgGetNode(vacuum_system.c_str(), true);
68
SGPropertyNode *cnode = node->getChild("config", 0, true);
69
_tumble_flag_node = cnode->getChild("tumble-flag", 0, true);
70
_caged_node = node->getChild("caged-flag", 0, true);
71
_tumble_node = node->getChild("tumble-norm", 0, true);
72
_pitch_int_node = node->getChild("internal-pitch-deg", 0, true);
73
_roll_int_node = node->getChild("internal-roll-deg", 0, true);
74
_pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
75
_roll_out_node = node->getChild("indicated-roll-deg", 0, true);
54
79
AttitudeIndicator::bind ()
56
fgTie("/instrumentation/attitude-indicator/serviceable",
81
std::ostringstream temp;
84
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
86
fgTie((branch + "/serviceable").c_str(),
57
87
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
58
fgTie("/instrumentation/attitude-indicator/spin",
88
fgTie((branch + "/spin").c_str(),
59
89
&_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
63
93
AttitudeIndicator::unbind ()
65
fgUntie("/instrumentation/attitude-indicator/serviceable");
66
fgUntie("/instrumentation/attitude-indicator/spin");
95
std::ostringstream temp;
98
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
100
fgUntie((branch + "/serviceable").c_str());
101
fgUntie((branch + "/spin").c_str());