Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send continuous zero setpoints until landing in ramp examples #529

Merged
merged 2 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions examples/motors/multiramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
12 changes: 8 additions & 4 deletions examples/motors/ramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down