with class

Dependencies:   ISR_Mini-explorer mbed

Fork of VirtualForces by Georgios Tsamis

Committer:
Ludwigfr
Date:
Fri Jun 09 14:30:21 2017 +0000
Revision:
34:c208497dd079
Parent:
33:814bcd7d3cfe
Child:
35:68f9edbb3cff
okay it compiles

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 34:c208497dd079 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 33:814bcd7d3cfe 57
Ludwigfr 33:814bcd7d3cfe 58 //fill initialLogValues with the values we already know (here the bordurs)
Ludwigfr 33:814bcd7d3cfe 59 void fill_initialLogValues();
Ludwigfr 33:814bcd7d3cfe 60
Ludwigfr 33:814bcd7d3cfe 61 float robot_x_coordinate_in_world(float robot_x, float robot_y);
Ludwigfr 33:814bcd7d3cfe 62
Ludwigfr 33:814bcd7d3cfe 63 float robot_y_coordinate_in_world(float robot_x, float robot_y);
Ludwigfr 34:c208497dd079 64
Ludwigfr 34:c208497dd079 65 /*
Ludwigfr 34:c208497dd079 66 void print_final_map();
Ludwigfr 33:814bcd7d3cfe 67
Ludwigfr 34:c208497dd079 68 void print_final_map_with_robot_position(float robot_x,float robot_y);
Ludwigfr 33:814bcd7d3cfe 69
Ludwigfr 34:c208497dd079 70 void print_final_map_with_robot_position_and_target(float robot_x,float robot_y,float targetXWolrd, float targetYWorld);
Ludwigfr 34:c208497dd079 71 */
Ludwigfr 33:814bcd7d3cfe 72 };
Ludwigfr 33:814bcd7d3cfe 73
Ludwigfr 33:814bcd7d3cfe 74 #endif
Ludwigfr 33:814bcd7d3cfe 75