diff options
| author | vikle012 <viktor.leek@liu.se> | 2019-09-11 13:57:14 +0200 |
|---|---|---|
| committer | vikle012 <viktor.leek@liu.se> | 2019-09-11 13:57:14 +0200 |
| commit | e66efbbe8df2dd4e7de0a1e9bd129cf92e00f92f (patch) | |
| tree | 5ec35be0c219a2e6b017e12e450e76157b9de044 /Kod/bilbana/studentFunctions/run_simple_example.m | |
| download | tfyy51-e66efbbe8df2dd4e7de0a1e9bd129cf92e00f92f.tar.gz | |
Initializes repo.
Diffstat (limited to 'Kod/bilbana/studentFunctions/run_simple_example.m')
| -rw-r--r-- | Kod/bilbana/studentFunctions/run_simple_example.m | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Kod/bilbana/studentFunctions/run_simple_example.m b/Kod/bilbana/studentFunctions/run_simple_example.m new file mode 100644 index 0000000..45794f0 --- /dev/null +++ b/Kod/bilbana/studentFunctions/run_simple_example.m @@ -0,0 +1,41 @@ +%% ---------------- Do not touch ---------------- %
+disp('Startar bilbanan. Avsluta med q')
+hf=figure('position',[0 0 eps eps],'menubar','none');
+% ----------------------------------------------- %
+%% User input
+track_number = 1;
+car = init_car(track_number);
+
+%% Init race track
+initialize_counters(car.track_number)
+config_IOs
+start_race(car.track_number)
+
+%% Start cars
+start_control = 29; % 29 works for the white castrol car marked with number 82
+car = update_control(start_control, car);
+
+%% Running loop
+while 1
+
+ % ---------------- Do not touch ---------------- %
+ % Check if user has pressed q
+ if strcmp(get(hf,'currentcharacter'),'q')
+ close(hf)
+ break
+ end
+ % force the event queue to flush
+ figure(hf)
+ drawnow
+ % ---------------------------------------------- %
+
+ car = car_controller(car);
+
+ pause(0.1) % Pause 0.1 s
+end
+
+terminate(1)
+terminate(2)
+
+% run file to plot results
+plot_results();
\ No newline at end of file |
