diff --git a/examples/motors/multiramp.py b/examples/motors/multiramp.py index df77fec51..8c3e9340f 100644 --- a/examples/motors/multiramp.py +++ b/examples/motors/multiramp.py @@ -101,10 +101,14 @@ def _ramp_motors(self): if thrust >= 25000: thrust_mult = -1 thrust += thrust_step * thrust_mult - self._cf.commander.send_setpoint(0, 0, 0, 0) - # Make sure that the last packet leaves before the link is closed - # since the message queue is not flushed before closing - time.sleep(0.1) + for _ in range(30): + # Continuously send the zero setpoint until the drone is recognized as landed + # to prevent the supervisor from intervening due to missing regular setpoints + self._cf.commander.send_setpoint(0, 0, 0, 0) + time.sleep(0.1) + # Sleeping before closing the link makes sure the last + # packet leaves before the link is closed, since the + # message queue is not flushed before closing self._cf.close_link() diff --git a/examples/motors/ramp.py b/examples/motors/ramp.py index a91d87bac..b0f78831f 100644 --- a/examples/motors/ramp.py +++ b/examples/motors/ramp.py @@ -99,10 +99,14 @@ def _ramp_motors(self): if thrust >= 25000: thrust_mult = -1 thrust += thrust_step * thrust_mult - self._cf.commander.send_setpoint(0, 0, 0, 0) - # Make sure that the last packet leaves before the link is closed - # since the message queue is not flushed before closing - time.sleep(1) + for _ in range(30): + # Continuously send the zero setpoint until the drone is recognized as landed + # to prevent the supervisor from intervening due to missing regular setpoints + self._cf.commander.send_setpoint(0, 0, 0, 0) + time.sleep(0.1) + # Sleeping before closing the link makes sure the last + # packet leaves before the link is closed, since the + # message queue is not flushed before closing self._cf.close_link()