From 541a64a3ca5810e844029cacc61cccb5c5d9b367 Mon Sep 17 00:00:00 2001 From: Arthur Golubtsov Date: Thu, 21 May 2020 00:11:07 +0300 Subject: [PATCH] Drone: Begin code organisation for GPS support --- Drone/config/spec/configspec_client.ini | 6 +++++- Drone/copter_client.py | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Drone/config/spec/configspec_client.ini b/Drone/config/spec/configspec_client.ini index 6f881b9..a6d56d5 100644 --- a/Drone/config/spec/configspec_client.ini +++ b/Drone/config/spec/configspec_client.ini @@ -49,7 +49,6 @@ land_timeout = float(default=10.0, min=0) common_offset = float_list(default=list(0, 0, 0), min=3, max=3) [FLOOR FRAME] -enabled = boolean(default=False) parent = string(default=map) # Frame translation (x, y, z) # __list__ x y z @@ -58,6 +57,11 @@ translation = float_list(default=list(0.0, 0.0, 0.0), min=3, max=3) # __list__ roll pitch yaw rotation = float_list(default=list(0.0, 0.0, 0.0), min=3, max=3) +[GPS FRAME] +lat = float(default=0) +lon = float(default=0) +yaw = float(default=0) + [ANIMATION] takeoff_detection = boolean(default=True) land_detection = boolean(default=True) diff --git a/Drone/copter_client.py b/Drone/copter_client.py index 799f965..4349565 100644 --- a/Drone/copter_client.py +++ b/Drone/copter_client.py @@ -99,10 +99,9 @@ class CopterClient(client.Client): LedLib.init_led(self.config.led_pin) task_manager_instance.start() # TODO move to self if self.config.copter_frame_id == "floor": - if self.config.floor_frame_enabled: - self.start_floor_frame_broadcast() - else: - rospy.logerr("Can't make floor frame!") + self.start_floor_frame_broadcast() + elif self.config.copter_frame_id == "gps": + self.start_gps_frame_broadcast() start_subscriber() telemetry.start_loop() @@ -120,6 +119,8 @@ class CopterClient(client.Client): trans.child_frame_id = self.config.copter_frame_id static_bloadcaster.sendTransform(trans) + def start_gps_frame_broadcast(self): + return def restart_service(name): os.system("systemctl restart {}".format(name))