From 3fac51919108abd139511089fe21e1fc37ddce76 Mon Sep 17 00:00:00 2001 From: Matej Karasek Date: Tue, 23 Apr 2024 10:05:01 +0200 Subject: [PATCH] adding linear goto and spiral --- cflib/crazyflie/high_level_commander.py | 33 ++++++++++++++++++++++--- examples/swarm/synchronizedSequence.py | 7 ++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/cflib/crazyflie/high_level_commander.py b/cflib/crazyflie/high_level_commander.py index 7966193e3..134c7c3b6 100644 --- a/cflib/crazyflie/high_level_commander.py +++ b/cflib/crazyflie/high_level_commander.py @@ -46,6 +46,7 @@ class HighLevelCommander(): COMMAND_DEFINE_TRAJECTORY = 6 COMMAND_TAKEOFF_2 = 7 COMMAND_LAND_2 = 8 + COMMAND_SPIRAL = 11 ALL_GROUPS = 0 @@ -96,7 +97,7 @@ def takeoff(self, absolute_height_m, duration_s, group_mask=ALL_GROUPS, duration_s)) def land(self, absolute_height_m, duration_s, group_mask=ALL_GROUPS, - yaw=0.0): + yaw=None): """ vertical land from current x-y position to given height @@ -131,7 +132,7 @@ def stop(self, group_mask=ALL_GROUPS): self.COMMAND_STOP, group_mask)) - def go_to(self, x, y, z, yaw, duration_s, relative=False, + def go_to(self, x, y, z, yaw, duration_s, relative=False, linear=False, group_mask=ALL_GROUPS): """ Go to an absolute or relative position @@ -142,15 +143,41 @@ def go_to(self, x, y, z, yaw, duration_s, relative=False, :param yaw: Yaw (radians) :param duration_s: Time it should take to reach the position (s) :param relative: True if x, y, z is relative to the current position + :param linear: True to use linear interpolation instead of a smooth polynomial :param group_mask: Mask for which CFs this should apply to """ - self._send_packet(struct.pack('