Skip to content

Commit db51fc2

Browse files
authored
Merge pull request #529 from bitcraze/rik/ramp_supervisor_fix
Send continuous zero setpoints until landing in ramp examples
2 parents 2c75274 + 5fb3f59 commit db51fc2

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

examples/motors/multiramp.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,14 @@ def _ramp_motors(self):
101101
if thrust >= 25000:
102102
thrust_mult = -1
103103
thrust += thrust_step * thrust_mult
104-
self._cf.commander.send_setpoint(0, 0, 0, 0)
105-
# Make sure that the last packet leaves before the link is closed
106-
# since the message queue is not flushed before closing
107-
time.sleep(0.1)
104+
for _ in range(30):
105+
# Continuously send the zero setpoint until the drone is recognized as landed
106+
# to prevent the supervisor from intervening due to missing regular setpoints
107+
self._cf.commander.send_setpoint(0, 0, 0, 0)
108+
time.sleep(0.1)
109+
# Sleeping before closing the link makes sure the last
110+
# packet leaves before the link is closed, since the
111+
# message queue is not flushed before closing
108112
self._cf.close_link()
109113

110114

examples/motors/ramp.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ def _ramp_motors(self):
9999
if thrust >= 25000:
100100
thrust_mult = -1
101101
thrust += thrust_step * thrust_mult
102-
self._cf.commander.send_setpoint(0, 0, 0, 0)
103-
# Make sure that the last packet leaves before the link is closed
104-
# since the message queue is not flushed before closing
105-
time.sleep(1)
102+
for _ in range(30):
103+
# Continuously send the zero setpoint until the drone is recognized as landed
104+
# to prevent the supervisor from intervening due to missing regular setpoints
105+
self._cf.commander.send_setpoint(0, 0, 0, 0)
106+
time.sleep(0.1)
107+
# Sleeping before closing the link makes sure the last
108+
# packet leaves before the link is closed, since the
109+
# message queue is not flushed before closing
106110
self._cf.close_link()
107111

108112

0 commit comments

Comments
 (0)