From fe544c6468464732bb64106f696bd6ffedade085 Mon Sep 17 00:00:00 2001 From: Albin Date: Thu, 7 Nov 2019 15:03:03 +0100 Subject: =?UTF-8?q?N=C3=A4stan=20fungerande=20primitiv=20hantering=20av=20?= =?UTF-8?q?missade=20givare?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kod/bilbana/yc4/main.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Kod/bilbana/yc4/main.m') diff --git a/Kod/bilbana/yc4/main.m b/Kod/bilbana/yc4/main.m index 950a9f8..0ff21c8 100644 --- a/Kod/bilbana/yc4/main.m +++ b/Kod/bilbana/yc4/main.m @@ -111,7 +111,9 @@ while 1 if car1.lap ~= 0 car1.seg_times(car1.lap, car1.segment) = toc(car1.seg_tic); end - car1.segment = car1.segment + 1; + if car1.segment < 9 + 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); @@ -119,9 +121,10 @@ while 1 %approximation = approximation - car1.position; %car1.approximation(car1.lap, car1.segment) = approximation; if car1.lap > 2 %Säkerhetsmarginal (Bör vara 1?) - x = choose_position(car1.position,car1.segment, 1); - car1.position = x(1); - car1.segment = car1.segment + x(2); + 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 -- cgit v1.2.1