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 16:19:18 2017 +0000
Revision:
60:b57577b0072f
Parent:
57:1a395b6928ee
Child:
62:c2fcf3b349e9
work has been done on init

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 60:b57577b0072f 28 void positioning()
cittecla 39:92723f7ea54f 29 {
cittecla 60:b57577b0072f 30 printf("positioning...\r\n");
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 */