summaryrefslogtreecommitdiffstats
path: root/Kod/bilbana/yc4/get_seg_constant.m
diff options
context:
space:
mode:
Diffstat (limited to 'Kod/bilbana/yc4/get_seg_constant.m')
-rw-r--r--Kod/bilbana/yc4/get_seg_constant.m15
1 files changed, 10 insertions, 5 deletions
diff --git a/Kod/bilbana/yc4/get_seg_constant.m b/Kod/bilbana/yc4/get_seg_constant.m
index 38e0bf0..2b481fa 100644
--- a/Kod/bilbana/yc4/get_seg_constant.m
+++ b/Kod/bilbana/yc4/get_seg_constant.m
@@ -1,13 +1,18 @@
-function [out] = get_seg_constant(position, track)
-%GET_SEG_CONSTANT Summary of this function goes here
-% Detailed explanation goes here
+function [out] = get_seg_constant(position, lap_constants, track)
+%GET_SEG_CONSTANT Avgör vilken seg_constat som ska användas utifån
+%nuvarande position.
+%{
+position - Position i meter från start
+lap_constants - De seg_constants som ska användas detta varv
+track - den bana/bil som beräkningarna ska göras för
+%}
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];
for i = 1:length(track_len)
if position > track_len(track, i)
- seg_constant = track_len(track, i);
+ seg_constant_num = track_len(track, i);
end
end
-out = seg_constant;
+out = lap_constants(seg_constant_num);
end