Client: Fix bug in move start callback

This commit is contained in:
Arthur Golubtsov
2019-10-25 07:06:17 +01:00
parent 5d97ca26a8
commit 79d59f0b28
2 changed files with 16 additions and 17 deletions

View File

@@ -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
z0 = 0

View File

@@ -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()