![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
test morning
Dependencies: ISR_Mini-explorer mbed
Fork of roboticLab_withclass_3_July by
Map.hpp@14:696187e74411, 2017-07-12 (annotated)
- Committer:
- Ludwigfr
- Date:
- Wed Jul 12 18:08:07 2017 +0000
- Revision:
- 14:696187e74411
- Parent:
- 5:19f24c363418
lol
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ludwigfr | 0:9f7ee7ed13e4 | 1 | #ifndef MAP_HPP |
Ludwigfr | 0:9f7ee7ed13e4 | 2 | #define MAP_HPP |
Ludwigfr | 0:9f7ee7ed13e4 | 3 | |
Ludwigfr | 0:9f7ee7ed13e4 | 4 | #include<math.h> |
Ludwigfr | 0:9f7ee7ed13e4 | 5 | |
Ludwigfr | 0:9f7ee7ed13e4 | 6 | /* |
Ludwigfr | 0:9f7ee7ed13e4 | 7 | Robot coordinate system: World coordinate system: |
Ludwigfr | 0:9f7ee7ed13e4 | 8 | ^ ^ |
Ludwigfr | 0:9f7ee7ed13e4 | 9 | |x |y |
Ludwigfr | 0:9f7ee7ed13e4 | 10 | <--R O--> |
Ludwigfr | 0:9f7ee7ed13e4 | 11 | y x |
Ludwigfr | 0:9f7ee7ed13e4 | 12 | |
Ludwigfr | 0:9f7ee7ed13e4 | 13 | Screen coordinate system |
Ludwigfr | 0:9f7ee7ed13e4 | 14 | x |
Ludwigfr | 0:9f7ee7ed13e4 | 15 | O---> |
Ludwigfr | 0:9f7ee7ed13e4 | 16 | y| |
Ludwigfr | 0:9f7ee7ed13e4 | 17 | v |
Ludwigfr | 0:9f7ee7ed13e4 | 18 | |
Ludwigfr | 0:9f7ee7ed13e4 | 19 | how the float[2] arrays stock the position |
Ludwigfr | 0:9f7ee7ed13e4 | 20 | Start at 0,0 end top right |
Ludwigfr | 0:9f7ee7ed13e4 | 21 | ^ |
Ludwigfr | 0:9f7ee7ed13e4 | 22 | |heightIndice |
Ludwigfr | 0:9f7ee7ed13e4 | 23 | | |
Ludwigfr | 0:9f7ee7ed13e4 | 24 | _____> |
Ludwigfr | 0:9f7ee7ed13e4 | 25 | widthIndice |
Ludwigfr | 0:9f7ee7ed13e4 | 26 | */ |
Ludwigfr | 0:9f7ee7ed13e4 | 27 | |
Ludwigfr | 0:9f7ee7ed13e4 | 28 | |
Ludwigfr | 0:9f7ee7ed13e4 | 29 | class Map { |
Ludwigfr | 0:9f7ee7ed13e4 | 30 | |
Ludwigfr | 0:9f7ee7ed13e4 | 31 | public: |
Ludwigfr | 0:9f7ee7ed13e4 | 32 | float widthRealMap; |
Ludwigfr | 0:9f7ee7ed13e4 | 33 | float heightRealMap; |
Ludwigfr | 0:9f7ee7ed13e4 | 34 | int nbCellWidth; |
Ludwigfr | 0:9f7ee7ed13e4 | 35 | int nbCellHeight; |
Ludwigfr | 0:9f7ee7ed13e4 | 36 | float sizeCellWidth; |
Ludwigfr | 0:9f7ee7ed13e4 | 37 | float sizeCellHeight; |
Ludwigfr | 0:9f7ee7ed13e4 | 38 | float** cellsLogValues; |
Ludwigfr | 0:9f7ee7ed13e4 | 39 | float** initialLogValues; |
Ludwigfr | 0:9f7ee7ed13e4 | 40 | |
Ludwigfr | 0:9f7ee7ed13e4 | 41 | Map(float widthRealMap, float heightRealMap, int nbCellWidth, int nbCellHeight); |
Ludwigfr | 0:9f7ee7ed13e4 | 42 | |
Ludwigfr | 0:9f7ee7ed13e4 | 43 | float cell_width_coordinate_to_world(int i); |
Ludwigfr | 0:9f7ee7ed13e4 | 44 | |
Ludwigfr | 0:9f7ee7ed13e4 | 45 | float cell_height_coordinate_to_world(int j); |
Ludwigfr | 0:9f7ee7ed13e4 | 46 | |
Ludwigfr | 0:9f7ee7ed13e4 | 47 | float get_proba_cell(int widthIndice, int heightIndice); |
Ludwigfr | 0:9f7ee7ed13e4 | 48 | |
Ludwigfr | 3:37345c109dfc | 49 | void fill_map_with_empty(); |
Ludwigfr | 3:37345c109dfc | 50 | |
Ludwigfr | 3:37345c109dfc | 51 | void fill_initialLogValuesLab4(); |
Ludwigfr | 3:37345c109dfc | 52 | |
Ludwigfr | 5:19f24c363418 | 53 | void fill_map_with_kalman_knowledge(); |
Ludwigfr | 5:19f24c363418 | 54 | |
Ludwigfr | 3:37345c109dfc | 55 | |
Ludwigfr | 0:9f7ee7ed13e4 | 56 | |
Ludwigfr | 0:9f7ee7ed13e4 | 57 | //Updates map value |
Ludwigfr | 0:9f7ee7ed13e4 | 58 | void update_cell_value(int widthIndice,int heightIndice ,float proba); |
Ludwigfr | 0:9f7ee7ed13e4 | 59 | |
Ludwigfr | 0:9f7ee7ed13e4 | 60 | //returns the probability [0,1] that the cell is occupied from the log valAue lt |
Ludwigfr | 0:9f7ee7ed13e4 | 61 | float log_to_proba(float lt); |
Ludwigfr | 0:9f7ee7ed13e4 | 62 | |
Ludwigfr | 0:9f7ee7ed13e4 | 63 | //returns the log value that the cell is occupied from the probability value [0,1] |
Ludwigfr | 0:9f7ee7ed13e4 | 64 | float proba_to_log(float p); |
Ludwigfr | 0:9f7ee7ed13e4 | 65 | |
Ludwigfr | 0:9f7ee7ed13e4 | 66 | private: |
Ludwigfr | 0:9f7ee7ed13e4 | 67 | |
Ludwigfr | 0:9f7ee7ed13e4 | 68 | //fill initialLogValues with the values we already know (here the bordurs) |
Ludwigfr | 0:9f7ee7ed13e4 | 69 | void fill_initialLogValues(); |
Ludwigfr | 0:9f7ee7ed13e4 | 70 | |
Ludwigfr | 0:9f7ee7ed13e4 | 71 | /* |
Ludwigfr | 0:9f7ee7ed13e4 | 72 | |
Ludwigfr | 0:9f7ee7ed13e4 | 73 | float robot_x_coordinate_in_world(float robot_x, float robot_y); |
Ludwigfr | 0:9f7ee7ed13e4 | 74 | |
Ludwigfr | 0:9f7ee7ed13e4 | 75 | float robot_y_coordinate_in_world(float robot_x, float robot_y); |
Ludwigfr | 0:9f7ee7ed13e4 | 76 | |
Ludwigfr | 0:9f7ee7ed13e4 | 77 | void print_final_map(); |
Ludwigfr | 0:9f7ee7ed13e4 | 78 | |
Ludwigfr | 0:9f7ee7ed13e4 | 79 | void print_final_map_with_robot_position(float robot_x,float robot_y); |
Ludwigfr | 0:9f7ee7ed13e4 | 80 | |
Ludwigfr | 0:9f7ee7ed13e4 | 81 | void print_final_map_with_robot_position_and_target(float robot_x,float robot_y,float targetXWolrd, float targetYWorld); |
Ludwigfr | 0:9f7ee7ed13e4 | 82 | */ |
Ludwigfr | 0:9f7ee7ed13e4 | 83 | }; |
Ludwigfr | 0:9f7ee7ed13e4 | 84 | |
Ludwigfr | 0:9f7ee7ed13e4 | 85 | #endif |
Ludwigfr | 0:9f7ee7ed13e4 | 86 |