From 860406a2de620c15790ad1ebc0185adf72daedeb Mon Sep 17 00:00:00 2001 From: knmcguire Date: Wed, 27 Nov 2024 14:16:58 +0100 Subject: [PATCH 1/2] put try except and add warning --- crazyflie_sim/crazyflie_sim/crazyflie_sil.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/crazyflie_sim/crazyflie_sim/crazyflie_sil.py b/crazyflie_sim/crazyflie_sim/crazyflie_sil.py index dc3018ad0..f33887027 100644 --- a/crazyflie_sim/crazyflie_sim/crazyflie_sil.py +++ b/crazyflie_sim/crazyflie_sim/crazyflie_sil.py @@ -132,11 +132,20 @@ def goTo(self, goal, yaw, duration, relative=False, groupMask=0): # We need to update to the latest firmware that has go_to_from. raise ValueError('goTo from low-level modes not yet supported.') self.mode = CrazyflieSIL.MODE_HIGH_POLY - firm.plan_go_to( - self.planner, - relative, - firm.mkvec(*goal), - yaw, duration, self.time_func()) + try: + firm.plan_go_to( + self.planner, + relative, + False, + firm.mkvec(*goal), + yaw, duration, self.time_func()) + except TypeError: + print("Warning: Your Crazyflie firmware is outdated. Please update to the latest version.") + firm.plan_go_to( + self.planner, + relative, + firm.mkvec(*goal), + yaw, duration, self.time_func()) def uploadTrajectory(self, trajectoryId: int, From f7aba619c20c9cb9ed369b62efe56e972905ee72 Mon Sep 17 00:00:00 2001 From: knmcguire Date: Wed, 27 Nov 2024 14:59:33 +0100 Subject: [PATCH 2/2] flake8 fix --- crazyflie_sim/crazyflie_sim/crazyflie_sil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crazyflie_sim/crazyflie_sim/crazyflie_sil.py b/crazyflie_sim/crazyflie_sim/crazyflie_sil.py index f33887027..acd939d54 100644 --- a/crazyflie_sim/crazyflie_sim/crazyflie_sil.py +++ b/crazyflie_sim/crazyflie_sim/crazyflie_sil.py @@ -140,7 +140,9 @@ def goTo(self, goal, yaw, duration, relative=False, groupMask=0): firm.mkvec(*goal), yaw, duration, self.time_func()) except TypeError: - print("Warning: Your Crazyflie firmware is outdated. Please update to the latest version.") + message = ('Warning: Your Crazyflie firmware is outdated. ' + ' Please update to the latest version.') + print(message) firm.plan_go_to( self.planner, relative,