Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

Committer:
cittecla
Date:
Tue Apr 18 15:38:15 2017 +0000
Revision:
57:1a395b6928ee
Parent:
52:56399c2f13cd
Child:
60:b57577b0072f
update start_up

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cittecla 12:91c2e07d2b5b 1 /**
cittecla 12:91c2e07d2b5b 2 * Positioning function library
cittecla 12:91c2e07d2b5b 3 * Handels position of the Robot on the map
cittecla 12:91c2e07d2b5b 4 **/
cittecla 33:8a98f8b9d859 5
cittecla 33:8a98f8b9d859 6
cittecla 38:3526c36e4c73 7 #include "Positioning.h"
cittecla 33:8a98f8b9d859 8 position current_pos;
cittecla 46:8b52c7b34d34 9 float current_heading;
cittecla 52:56399c2f13cd 10 position next_pos;
cittecla 12:91c2e07d2b5b 11
cittecla 34:40d8d29b44b8 12 position get_current_pos()
cittecla 33:8a98f8b9d859 13 {
cittecla 33:8a98f8b9d859 14 return current_pos;
cittecla 33:8a98f8b9d859 15 }
cittecla 38:3526c36e4c73 16
cittecla 52:56399c2f13cd 17 position get_next_pos()
cittecla 52:56399c2f13cd 18 {
cittecla 52:56399c2f13cd 19 return next_pos;
cittecla 52:56399c2f13cd 20 }
cittecla 52:56399c2f13cd 21
cittecla 46:8b52c7b34d34 22 float get_current_heading()
cittecla 46:8b52c7b34d34 23 {
cittecla 46:8b52c7b34d34 24 return current_heading;
cittecla 46:8b52c7b34d34 25 }
cittecla 46:8b52c7b34d34 26
cittecla 38:3526c36e4c73 27
cittecla 39:92723f7ea54f 28 int positioning()
cittecla 39:92723f7ea54f 29 {
cittecla 39:92723f7ea54f 30
cittecla 39:92723f7ea54f 31 return 0;
cittecla 39:92723f7ea54f 32 }
cittecla 38:3526c36e4c73 33
cittecla 38:3526c36e4c73 34
cittecla 34:40d8d29b44b8 35 /*
cittecla 33:8a98f8b9d859 36 void initial_positioning()
cittecla 33:8a98f8b9d859 37 {
cittecla 33:8a98f8b9d859 38 float last_dist_r = 1.0f;
cittecla 33:8a98f8b9d859 39 float last_dist_f = 1.0f;
cittecla 33:8a98f8b9d859 40
cittecla 33:8a98f8b9d859 41 int deg_r = 0;
cittecla 33:8a98f8b9d859 42 int deg_l = 0;
cittecla 33:8a98f8b9d859 43
cittecla 33:8a98f8b9d859 44 turn_straight_right();
cittecla 33:8a98f8b9d859 45 turn_straight_left();
cittecla 12:91c2e07d2b5b 46
cittecla 33:8a98f8b9d859 47 while(last_dist_r > sensors[r]) {
cittecla 33:8a98f8b9d859 48 turn_sensor_right(1); //turn sensor + 1 deg
cittecla 33:8a98f8b9d859 49 wait(0.1f)
cittecla 33:8a98f8b9d859 50 deg_r += 1;
cittecla 33:8a98f8b9d859 51 last_dist_r = sensors[r];
cittecla 33:8a98f8b9d859 52 }
cittecla 33:8a98f8b9d859 53
cittecla 33:8a98f8b9d859 54 while(last_dist_l > sensors[l]) {
cittecla 33:8a98f8b9d859 55 turn_sensor_left(-1); //turn sensor - 1 deg
cittecla 33:8a98f8b9d859 56 wait(0.1f)
cittecla 33:8a98f8b9d859 57 deg_l += 1;
cittecla 33:8a98f8b9d859 58 last_dist_l = sensors[l];
cittecla 33:8a98f8b9d859 59 }
cittecla 33:8a98f8b9d859 60
cittecla 33:8a98f8b9d859 61 int deg_l_2=0;
cittecla 33:8a98f8b9d859 62 turn_straight_left();
cittecla 33:8a98f8b9d859 63 last_dist_l = 0;
cittecla 33:8a98f8b9d859 64
cittecla 33:8a98f8b9d859 65 while(last_dist_l < sensors[l]) {
cittecla 33:8a98f8b9d859 66 turn_sensor_left(1); //turn sensor +1 deg (positiv = uhrzeigersinn)
cittecla 33:8a98f8b9d859 67 wait(0.1f)
cittecla 33:8a98f8b9d859 68 deg_l_2 += 1;
cittecla 33:8a98f8b9d859 69 last_dist_l = sensors[l];
cittecla 33:8a98f8b9d859 70 }
cittecla 39:92723f7ea54f 71
cittecla 33:8a98f8b9d859 72 turn_straight_right();
cittecla 33:8a98f8b9d859 73 turn_straight_left();
cittecla 39:92723f7ea54f 74
cittecla 33:8a98f8b9d859 75 wait(0.2f);
cittecla 39:92723f7ea54f 76
cittecla 14:9e2ce5880fb0 77 }
cittecla 34:40d8d29b44b8 78 */