Correctly identify when time is past end of thrustcurve so thrust is 0 in getAverageThrust

This has been lurking -- we're not actually supposed to be calling getAverageThrustThrust when we're past the end of the thrustcurve (there's a test for whether the motor is active before calling it), but another bug in the parallel staging code exposed it.
This commit is contained in:
JoePfeiffer 2022-03-04 17:52:44 -07:00
parent 939a07e9e0
commit d2f364f086

View File

@ -338,11 +338,11 @@ public class ThrustCurveMotor implements Motor, Comparable<ThrustCurveMotor>, Se
int timeIndex = 0;
while( timeIndex < time.length-2 && startTime > time[timeIndex+1] ) {
while( timeIndex < time.length-1 && startTime > time[timeIndex+1] ) {
timeIndex++;
}
if ( timeIndex == time.length ) {
if ( timeIndex == time.length-1 ) {
return 0.0;
}