with class

Dependencies:   ISR_Mini-explorer mbed

Fork of VirtualForces by Georgios Tsamis

Committer:
Ludwigfr
Date:
Sun Jun 11 22:53:59 2017 +0000
Revision:
36:b59d56d0b3b4
Parent:
35:68f9edbb3cff
Child:
39:890439b495e3
moved some fct to private

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Ludwigfr 33:814bcd7d3cfe 1 #ifndef MAP_HPP
Ludwigfr 33:814bcd7d3cfe 2 #define MAP_HPP
Ludwigfr 33:814bcd7d3cfe 3
Ludwigfr 34:c208497dd079 4 #include<math.h>
Ludwigfr 33:814bcd7d3cfe 5
Ludwigfr 34:c208497dd079 6 /*
Ludwigfr 33:814bcd7d3cfe 7 Robot coordinate system: World coordinate system:
Ludwigfr 33:814bcd7d3cfe 8 ^ ^
Ludwigfr 33:814bcd7d3cfe 9 |x |y
Ludwigfr 33:814bcd7d3cfe 10 <--R O-->
Ludwigfr 33:814bcd7d3cfe 11 y x
Ludwigfr 33:814bcd7d3cfe 12
Ludwigfr 33:814bcd7d3cfe 13 Screen coordinate system
Ludwigfr 33:814bcd7d3cfe 14 x
Ludwigfr 33:814bcd7d3cfe 15 O--->
Ludwigfr 33:814bcd7d3cfe 16 y|
Ludwigfr 33:814bcd7d3cfe 17 v
Ludwigfr 33:814bcd7d3cfe 18
Ludwigfr 33:814bcd7d3cfe 19 how the float[2] arrays stock the position
Ludwigfr 33:814bcd7d3cfe 20 Start at 0,0 end top right
Ludwigfr 33:814bcd7d3cfe 21 ^
Ludwigfr 33:814bcd7d3cfe 22 |heightIndice
Ludwigfr 33:814bcd7d3cfe 23 |
Ludwigfr 33:814bcd7d3cfe 24 _____>
Ludwigfr 33:814bcd7d3cfe 25 widthIndice
Ludwigfr 33:814bcd7d3cfe 26 */
Ludwigfr 33:814bcd7d3cfe 27
Ludwigfr 33:814bcd7d3cfe 28
Ludwigfr 33:814bcd7d3cfe 29 class Map {
Ludwigfr 33:814bcd7d3cfe 30
Ludwigfr 33:814bcd7d3cfe 31 public:
Ludwigfr 33:814bcd7d3cfe 32 float widthRealMap;
Ludwigfr 34:c208497dd079 33 float heightRealMap;
Ludwigfr 33:814bcd7d3cfe 34 int nbCellWidth;
Ludwigfr 33:814bcd7d3cfe 35 int nbCellHeight;
Ludwigfr 33:814bcd7d3cfe 36 float sizeCellWidth;
Ludwigfr 33:814bcd7d3cfe 37 float sizeCellHeight;
Ludwigfr 33:814bcd7d3cfe 38 float** cellsLogValues;
Ludwigfr 33:814bcd7d3cfe 39 float** initialLogValues;
Ludwigfr 33:814bcd7d3cfe 40
Ludwigfr 34:c208497dd079 41 Map(float widthRealMap, float heightRealMap, int nbCellWidth, int nbCellHeight);
Ludwigfr 34:c208497dd079 42
Ludwigfr 34:c208497dd079 43 float cell_width_coordinate_to_world(int i);
Ludwigfr 33:814bcd7d3cfe 44
Ludwigfr 34:c208497dd079 45 float cell_height_coordinate_to_world(int j);
Ludwigfr 34:c208497dd079 46
Ludwigfr 34:c208497dd079 47 float get_proba_cell(int widthIndice, int heightIndice);
Ludwigfr 34:c208497dd079 48
Ludwigfr 34:c208497dd079 49 //Updates map value
Ludwigfr 34:c208497dd079 50 void update_cell_value(int widthIndice,int heightIndice ,float proba);
Ludwigfr 36:b59d56d0b3b4 51
Ludwigfr 33:814bcd7d3cfe 52 //returns the probability [0,1] that the cell is occupied from the log valAue lt
Ludwigfr 33:814bcd7d3cfe 53 float log_to_proba(float lt);
Ludwigfr 33:814bcd7d3cfe 54
Ludwigfr 33:814bcd7d3cfe 55 //returns the log value that the cell is occupied from the probability value [0,1]
Ludwigfr 33:814bcd7d3cfe 56 float proba_to_log(float p);
Ludwigfr 35:68f9edbb3cff 57
Ludwigfr 36:b59d56d0b3b4 58 private:
Ludwigfr 36:b59d56d0b3b4 59
Ludwigfr 36:b59d56d0b3b4 60 //fill initialLogValues with the values we already know (here the bordurs)
Ludwigfr 36:b59d56d0b3b4 61 void fill_initialLogValues();
Ludwigfr 36:b59d56d0b3b4 62
Ludwigfr 35:68f9edbb3cff 63 /*
Ludwigfr 35:68f9edbb3cff 64
Ludwigfr 33:814bcd7d3cfe 65 float robot_x_coordinate_in_world(float robot_x, float robot_y);
Ludwigfr 33:814bcd7d3cfe 66
Ludwigfr 33:814bcd7d3cfe 67 float robot_y_coordinate_in_world(float robot_x, float robot_y);
Ludwigfr 34:c208497dd079 68
Ludwigfr 34:c208497dd079 69 void print_final_map();
Ludwigfr 33:814bcd7d3cfe 70
Ludwigfr 34:c208497dd079 71 void print_final_map_with_robot_position(float robot_x,float robot_y);
Ludwigfr 33:814bcd7d3cfe 72
Ludwigfr 34:c208497dd079 73 void print_final_map_with_robot_position_and_target(float robot_x,float robot_y,float targetXWolrd, float targetYWorld);
Ludwigfr 34:c208497dd079 74 */
Ludwigfr 33:814bcd7d3cfe 75 };
Ludwigfr 33:814bcd7d3cfe 76
Ludwigfr 33:814bcd7d3cfe 77 #endif
Ludwigfr 33:814bcd7d3cfe 78