Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

Committer:
cittecla
Date:
Tue Apr 11 19:43:39 2017 +0000
Revision:
46:8b52c7b34d34
Parent:
39:92723f7ea54f
Child:
52:56399c2f13cd
new mapping, draw to map and position_calculation functions

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