[1373] Add hasRecoveryDevice to FlighConfiguration

This commit is contained in:
Peter Tsongalis 2022-06-12 12:31:44 -07:00
parent e97d5c53d4
commit 87b225b38b

View File

@ -547,7 +547,25 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
updateMotors();
updateActiveInstances();
}
/**
* Return true if a rocket has a configured Recovery Device
*/
public boolean hasRecoveryDevice() {
Rocket rkt = this.getRocket();
RocketComponent nextComponent = rkt.getNextComponent();
while(nextComponent != null) {
if(nextComponent instanceof RecoveryDevice) {
return true;
}
nextComponent = nextComponent.getNextComponent();
}
return false;
}
/////////////// Helper methods ///////////////
/**