diff options
| author | Albin <albwa833@student.liu.se> | 2019-11-15 10:59:09 +0100 |
|---|---|---|
| committer | Albin <albwa833@student.liu.se> | 2019-11-15 10:59:09 +0100 |
| commit | 3d7ef8b70a702512a0a1055b1aa2df536eada26f (patch) | |
| tree | 3ef72c4defe461451352cfb4174f8238e1c10a36 /Kod | |
| parent | 0f95b8db3209e3cf802bf7f1af807faa9688d343 (diff) | |
| download | tfyy51-3d7ef8b70a702512a0a1055b1aa2df536eada26f.tar.gz | |
Fix #58 och tog bort onödig lista
Diffstat (limited to 'Kod')
| -rw-r--r-- | Kod/bilbana/yc4/choose_position.m | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/Kod/bilbana/yc4/choose_position.m b/Kod/bilbana/yc4/choose_position.m index d6db2ca..cd18f85 100644 --- a/Kod/bilbana/yc4/choose_position.m +++ b/Kod/bilbana/yc4/choose_position.m @@ -6,8 +6,6 @@ function [new_position, seg_plus] = choose_position(position,segment, track) % justeras för att kompensera efter missad givare. track_len = [0 2.53 3.05 4.73 7.68 8.98 10.93 14.96 17.57; 0 2.53 3.05 4.92 7.60 8.84 10.65 14.68 17.76]; -set_pos = [0 2.53 3.05 4.73 7.68 8.98 10.93 14.96 17.57; - 0 2.53 3.05 4.92 7.60 8.84 10.65 14.68 17.76]; pos_c = position; %% Vilken givare ligger närmast pos_c? near = []; @@ -23,19 +21,8 @@ for i = 1:length(track_len) end disp(near); %% Beräkning av passerad givare -if near(1) == segment - new_position = set_pos( track, segment); - seg_plus = 0; - disp('In right segment'); -else - if near(2) < 0.7 % Behöver bli smartare. Typ jämföra andra normal miss med denna miss - seg_plus = max(0, near(1) - segment); - new_position = set_pos(track, segment + seg_plus); - else - new_position = set_pos(track, segment); % ineff borde kombineras - seg_plus = 0; - disp('In right segment ich'); - end -end +seg_plus = max(0, near(1) - segment) +new_position = track_len(track, segment + seg_plus); end + |
