- // 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.
-
- // spin increases up to 25% every second
- // if suction is available and the gauge
- // is serviceable.
- 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 > 1.0)
- _spin = 1.0;
- else if (_spin < 0.0)
- _spin = 0.0;
+ // Get the spin from the gyro
+ _gyro.set_power_norm(_suction_node->getDoubleValue()/5.0);
+ _gyro.update(dt);
+ double spin = _gyro.get_spin_norm();