Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

Committer:
cittecla
Date:
Tue Apr 04 15:28:26 2017 +0000
Revision:
39:92723f7ea54f
Parent:
38:3526c36e4c73
Child:
46:8b52c7b34d34
Default function implementation complete.; State Machine working properly.; Compiled succesfully

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 12:91c2e07d2b5b 9
cittecla 34:40d8d29b44b8 10 position get_current_pos()
cittecla 33:8a98f8b9d859 11 {
cittecla 33:8a98f8b9d859 12 return current_pos;
cittecla 33:8a98f8b9d859 13 }
cittecla 38:3526c36e4c73 14
cittecla 39:92723f7ea54f 15 int start_positioning()
cittecla 39:92723f7ea54f 16 {
cittecla 39:92723f7ea54f 17
cittecla 38:3526c36e4c73 18 return 0;
cittecla 39:92723f7ea54f 19 }
cittecla 38:3526c36e4c73 20
cittecla 39:92723f7ea54f 21 int positioning()
cittecla 39:92723f7ea54f 22 {
cittecla 39:92723f7ea54f 23
cittecla 39:92723f7ea54f 24 return 0;
cittecla 39:92723f7ea54f 25 }
cittecla 38:3526c36e4c73 26
cittecla 38:3526c36e4c73 27
cittecla 34:40d8d29b44b8 28 /*
cittecla 33:8a98f8b9d859 29 void initial_positioning()
cittecla 33:8a98f8b9d859 30 {
cittecla 33:8a98f8b9d859 31 float last_dist_r = 1.0f;
cittecla 33:8a98f8b9d859 32 float last_dist_f = 1.0f;
cittecla 33:8a98f8b9d859 33
cittecla 33:8a98f8b9d859 34 int deg_r = 0;
cittecla 33:8a98f8b9d859 35 int deg_l = 0;
cittecla 33:8a98f8b9d859 36
cittecla 33:8a98f8b9d859 37 turn_straight_right();
cittecla 33:8a98f8b9d859 38 turn_straight_left();
cittecla 12:91c2e07d2b5b 39
cittecla 33:8a98f8b9d859 40 while(last_dist_r > sensors[r]) {
cittecla 33:8a98f8b9d859 41 turn_sensor_right(1); //turn sensor + 1 deg
cittecla 33:8a98f8b9d859 42 wait(0.1f)
cittecla 33:8a98f8b9d859 43 deg_r += 1;
cittecla 33:8a98f8b9d859 44 last_dist_r = sensors[r];
cittecla 33:8a98f8b9d859 45 }
cittecla 33:8a98f8b9d859 46
cittecla 33:8a98f8b9d859 47 while(last_dist_l > sensors[l]) {
cittecla 33:8a98f8b9d859 48 turn_sensor_left(-1); //turn sensor - 1 deg
cittecla 33:8a98f8b9d859 49 wait(0.1f)
cittecla 33:8a98f8b9d859 50 deg_l += 1;
cittecla 33:8a98f8b9d859 51 last_dist_l = sensors[l];
cittecla 33:8a98f8b9d859 52 }
cittecla 33:8a98f8b9d859 53
cittecla 33:8a98f8b9d859 54 int deg_l_2=0;
cittecla 33:8a98f8b9d859 55 turn_straight_left();
cittecla 33:8a98f8b9d859 56 last_dist_l = 0;
cittecla 33:8a98f8b9d859 57
cittecla 33:8a98f8b9d859 58 while(last_dist_l < sensors[l]) {
cittecla 33:8a98f8b9d859 59 turn_sensor_left(1); //turn sensor +1 deg (positiv = uhrzeigersinn)
cittecla 33:8a98f8b9d859 60 wait(0.1f)
cittecla 33:8a98f8b9d859 61 deg_l_2 += 1;
cittecla 33:8a98f8b9d859 62 last_dist_l = sensors[l];
cittecla 33:8a98f8b9d859 63 }
cittecla 39:92723f7ea54f 64
cittecla 33:8a98f8b9d859 65 turn_straight_right();
cittecla 33:8a98f8b9d859 66 turn_straight_left();
cittecla 39:92723f7ea54f 67
cittecla 33:8a98f8b9d859 68 wait(0.2f);
cittecla 39:92723f7ea54f 69
cittecla 14:9e2ce5880fb0 70 }
cittecla 34:40d8d29b44b8 71 */