// to be configured.
_serviceable_node =
fgGetNode("/instrumentation/attitude-indicator/serviceable", true);
+ _spin_node = fgGetNode("/instrumentation/attitude-indicator/spin", true);
_pitch_in_node = fgGetNode("/orientation/pitch-deg", true);
_roll_in_node = fgGetNode("/orientation/roll-deg", true);
_suction_node = fgGetNode("/systems/vacuum[0]/suction-inhg", true);
// First, calculate the bogo-spin from 0 to 1.
// All numbers are made up.
- _spin -= 0.005 * dt; // spin decays every 0.5% every second.
+ double spin = _spin_node->getDoubleValue();
+ spin -= 0.005 * dt; // spin decays every 0.5% every second.
// spin increases up to 25% every second
// if suction is available and the gauge
if (_serviceable_node->getBoolValue()) {
double suction = _suction_node->getDoubleValue();
double step = 0.25 * (suction / 5.0) * dt;
- if ((_spin + step) <= (suction / 5.0))
- _spin += step;
+ if ((spin + step) <= (suction / 5.0))
+ spin += step;
}
- if (_spin > 1.0)
- _spin = 1.0;
- else if (_spin < 0.0)
- _spin = 0.0;
+ if (spin > 1.0)
+ spin = 1.0;
+ else if (spin < 0.0)
+ spin = 0.0;
+ _spin_node->setDoubleValue(spin);
// Next, calculate the indicated roll
// and pitch, introducing errors.
- double factor = 1.0 - ((1.0 - _spin) * (1.0 - _spin));
+ double factor = 1.0 - ((1.0 - spin) * (1.0 - spin));
double roll = _roll_in_node->getDoubleValue();
double pitch = _pitch_in_node->getDoubleValue();
roll = 35 + (factor * (roll - 35));
* Input properties:
*
* /instrumentation/attitude-indicator/serviceable
+ * /instrumentation/attitude-indicator/spin
* /orientation/pitch-deg
* /orientation/roll-deg
* /systems/vacuum[0]/suction-inhg
private:
- double _spin;
-
SGPropertyNode_ptr _serviceable_node;
+ SGPropertyNode_ptr _spin_node;
SGPropertyNode_ptr _pitch_in_node;
SGPropertyNode_ptr _roll_in_node;
SGPropertyNode_ptr _suction_node;
{
_serviceable_node =
fgGetNode("/instrumentation/heading-indicator/serviceable", true);
+ _spin_node =
+ fgGetNode("/instrumentation/heading-indicator/spin", true);
_offset_node =
fgGetNode("/instrumentation/heading-indicator/offset-deg", true);
_heading_in_node = fgGetNode("/orientation/heading-deg", true);
// First, calculate the bogo-spin from 0 to 1.
// All numbers are made up.
- _spin -= 0.005 * dt; // spin decays every 0.5% every second.
+ double spin = _spin_node->getDoubleValue();
+ spin -= 0.005 * dt; // spin decays every 0.5% every second.
// spin increases up to 25% every second
// if suction is available and the gauge
if (_serviceable_node->getBoolValue()) {
double suction = _suction_node->getDoubleValue();
double step = 0.25 * (suction / 5.0) * dt;
- if ((_spin + step) <= (suction / 5.0))
- _spin += step;
+ if ((spin + step) <= (suction / 5.0))
+ spin += step;
}
- if (_spin > 1.0)
- _spin = 1.0;
- else if (_spin < 0.0)
- _spin = 0.0;
+ if (spin > 1.0)
+ spin = 1.0;
+ else if (spin < 0.0)
+ spin = 0.0;
+ _spin_node->setDoubleValue(spin);
// Next, calculate time-based precession
double offset = _offset_node->getDoubleValue();
// Next, calculate the indicated heading,
// introducing errors.
- double factor = 0.01 / (_spin * _spin * _spin * _spin * _spin * _spin);
+ double factor = 0.01 / (spin * spin * spin * spin * spin * spin);
double heading = _heading_in_node->getDoubleValue();
heading = fgGetLowPass(_last_heading_deg, heading, dt/factor);
_last_heading_deg = heading;
* Input properties:
*
* /instrumentation/heading-indicator/serviceable
+ * /instrumentation/heading-indicator/spin
* /instrumentation/heading-indicator/offset-deg
* /orientation/heading-deg
* /systems/vacuum[0]/suction-inhg
private:
- double _spin;
double _last_heading_deg;
SGPropertyNode_ptr _serviceable_node;
+ SGPropertyNode_ptr _spin_node;
SGPropertyNode_ptr _offset_node;
SGPropertyNode_ptr _heading_in_node;
SGPropertyNode_ptr _suction_node;