blob: dfca55f227fabf4d86291e36cbd1cef70161e2b0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
function [car, gateway_passed] = update_position(car_in)
car = car_in;
[lap_car, chk_pnt, time] = get_car_position(car.track_number);
if lap_car == true
% New lap
% Update position on track
car.position = 1;
% Add lap to lap counter
car.lap = car.lap + 1;
% Update gw passed
gateway_passed = true;
% Make sound
beep;
elseif chk_pnt == true && car.position ~= 0
% CP passed
% Update position
car.position = car.position + 1;
% update gw passed
gateway_passed = true;
% Make sound
beep;
else
gateway_passed = false;
end
end
|