If the gyro becomes unserviceable, stop spinning immediately.
This commit is contained in:
parent
113b1192c4
commit
d56bc5c9df
1 changed files with 2 additions and 0 deletions
|
@ -26,6 +26,8 @@ Gyro::update (double delta_time_sec)
|
|||
double step = 0.25 * _power_norm * delta_time_sec;
|
||||
if ((_spin_norm + step) <= _power_norm)
|
||||
_spin_norm += step;
|
||||
} else {
|
||||
_spin_norm = 0; // stop right away if the gyro breaks
|
||||
}
|
||||
|
||||
// clamp the spin to 0.0:1.0
|
||||
|
|
Loading…
Reference in a new issue