In the example from Ground SDK Hello Drone Tutorial - 7.7 it seems like the switch cases doesn’t cover when the drone is in the middle of taking off. I.e. if I press takeOff, the land button will become enabled right away instead of waiting until the drone is finish taking off. Is this the intended behavior? Is there a way to detect when the drone is still in the middle of taking off versus finished taking off?
private func managePilotingItfState(itf: ManualCopterPilotingItf) {
switch itf.state {
case ActivablePilotingItfState.unavailable:
// Piloting interface is unavailable.
takeOffLandBt.isEnabled = false
case ActivablePilotingItfState.idle:
// Piloting interface is idle.
takeOffLandBt.isEnabled = false
// Activate the interface.
_ = itf.activate()
case ActivablePilotingItfState.active:
// Piloting interface is active.
if itf.canTakeOff {
// Drone can takeOff.
takeOffLandBt.isEnabled = true
takeOffLandBt.setTitle("TakeOff", for: .normal)
} else if itf.canLand {
// Drone can land.
takeOffLandBt.isEnabled = true
takeOffLandBt.setTitle("Land", for: .normal)
} else {
// Disable the button.
takeOffLandBt.isEnabled = false
}
}
}