From fa7b4bf990ac16b58b06f9fbf1356a76f60d4c96 Mon Sep 17 00:00:00 2001 From: Albin Date: Thu, 7 Nov 2019 16:47:09 +0100 Subject: Nu funkar inget --- Kod/bilbana/yc4/main.m | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'Kod/bilbana/yc4/main.m') diff --git a/Kod/bilbana/yc4/main.m b/Kod/bilbana/yc4/main.m index fca9819..33b6944 100644 --- a/Kod/bilbana/yc4/main.m +++ b/Kod/bilbana/yc4/main.m @@ -107,30 +107,30 @@ while 1 car1.position = get_position(aprox_v, car1.position, t); end if car1.new_check_point == true - % beep; - if car1.lap ~= 0 - car1.seg_times(car1.lap, car1.segment) = toc(car1.seg_tic); - end - if car1.segment < 9 + if car1.new_lap == false + if car1.lap ~= 0 + car1.seg_times(car1.lap, car1.segment) = toc(car1.seg_tic); + end car1.segment = car1.segment + 1; - end - car1.seg_tic = tic; - %approximation = car1.position; % Måste vara innan nästa rad - %car1.position = car1.seg_len(car1.segment); - % Jämför get_position med indata - %approximation = approximation - car1.position; - %car1.approximation(car1.lap, car1.segment) = approximation; - if car1.lap > 2 %Säkerhetsmarginal (Bör vara 1?) - disp(car1); - [car1.position, seg_plus] = ... - choose_position(car1.position,car1.segment, 1); - %car1.position = x(1); - car1.segment = car1.segment + seg_plus; - else - car1.position = car1.seg_len(car1.segment); + car1.seg_tic = tic; + %approximation = car1.position; % Måste vara innan nästa rad + %car1.position = car1.seg_len(car1.segment); + % Jämför get_position med indata + %approximation = approximation - car1.position; + %car1.approximation(car1.lap, car1.segment) = approximation; + if car1.lap > 2 %Säkerhetsmarginal (Bör vara 1?) + disp(car1); + [car1.position, seg_plus] = ... + choose_position(car1.position,car1.segment, 1); + %car1.position = x(1); + car1.segment = car1.segment + seg_plus; + else + car1.position = car1.seg_len(car1.segment); + end end end if car1.new_lap == true + disp('----------NEW LAP!----------') if car1.lap == 0 % dont save time for first lap car1.segment = 1; -- cgit v1.2.1