From 79d59f0b28e28e1f9cc06e6ff1d0a9379bff3811 Mon Sep 17 00:00:00 2001 From: Arthur Golubtsov Date: Fri, 25 Oct 2019 07:06:17 +0100 Subject: [PATCH] Client: Fix bug in move start callback --- Drone/client_config.ini | 16 ++++++++-------- Drone/copter_client.py | 17 ++++++++--------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Drone/client_config.ini b/Drone/client_config.ini index 3053175..45585ce 100644 --- a/Drone/client_config.ini +++ b/Drone/client_config.ini @@ -1,4 +1,3 @@ - [SERVER] port = 25000 broadcast_port = 8181 @@ -23,11 +22,11 @@ y_ratio = 1.0 z_ratio = 1.0 [COPTERS] -frame_id = map -takeoff_height = 2.0 -takeoff_time = 8.0 +frame_id = floor +takeoff_height = 1.0 +takeoff_time = 5.0 safe_takeoff = False -reach_first_point_time = 8.0 +reach_first_point_time = 5.0 land_time = 3.0 x0_common = 0 y0_common = 0 @@ -37,7 +36,7 @@ z0_common = 0 parent = aruco_map x = 0.0 y = 0.0 -z = 6.5 +z = 3.55 roll = 180 pitch = 0 yaw = -90 @@ -45,8 +44,9 @@ yaw = -90 [PRIVATE] id = /hostname restart_dhcpcd = True -use_leds = True +use_leds = False led_pin = 21 x0 = 0 y0 = 0 -z0 = 0 \ No newline at end of file +z0 = 0 + diff --git a/Drone/copter_client.py b/Drone/copter_client.py index cd2f113..e60a136 100644 --- a/Drone/copter_client.py +++ b/Drone/copter_client.py @@ -329,21 +329,20 @@ def _command_test(*args, **kwargs): def _command_move_start_to_current_position(*args, **kwargs): # Load animation frames = animation.load_animation(os.path.abspath("animation.csv"), - x0=client.active_client.X0 + client.active_client.X0_COMMON, - y0=client.active_client.Y0 + client.active_client.Y0_COMMON, - z0=client.active_client.Z0 + client.active_client.Z0_COMMON, x_ratio=client.active_client.X_RATIO, y_ratio=client.active_client.Y_RATIO, z_ratio=client.active_client.Z_RATIO, ) # Correct start and land frames in animation - corrected_frames, start_action, start_delay = animation.correct_animation(frames, - check_takeoff=client.active_client.TAKEOFF_CHECK, - check_land=client.active_client.LAND_CHECK, - ) - x_start = corrected_frames[0]['x'] - y_start = corrected_frames[0]['y'] + # corrected_frames, start_action, start_delay = animation.correct_animation(frames, + # check_takeoff=client.active_client.TAKEOFF_CHECK, + # check_land=client.active_client.LAND_CHECK, + # ) + x_start = frames[0]['x'] + y_start = frames[0]['y'] + print("x_start = {}, y_start = {}".format(x_start, y_start)) telem = FlightLib.get_telemetry(client.active_client.FRAME_ID) + print("x_telem = {}, y_telem = {}".format(telem.x, telem.y)) client.active_client.config.set('PRIVATE', 'x0', telem.x - x_start) client.active_client.config.set('PRIVATE', 'y0', telem.y - y_start) client.active_client.rewrite_config()