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 11:50:02 2017 +0000
Revision:
52:56399c2f13cd
Parent:
46:8b52c7b34d34
Child:
57:1a395b6928ee
movement update;

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