with class
Dependencies: ISR_Mini-explorer mbed
Fork of VirtualForces by
Map.hpp
00001 #ifndef MAP_HPP 00002 #define MAP_HPP 00003 00004 #include<math.h> 00005 00006 /* 00007 Robot coordinate system: World coordinate system: 00008 ^ ^ 00009 |x |y 00010 <--R O--> 00011 y x 00012 00013 Screen coordinate system 00014 x 00015 O---> 00016 y| 00017 v 00018 00019 how the float[2] arrays stock the position 00020 Start at 0,0 end top right 00021 ^ 00022 |heightIndice 00023 | 00024 _____> 00025 widthIndice 00026 */ 00027 00028 00029 class Map { 00030 00031 public: 00032 float widthRealMap; 00033 float heightRealMap; 00034 int nbCellWidth; 00035 int nbCellHeight; 00036 float sizeCellWidth; 00037 float sizeCellHeight; 00038 float** cellsLogValues; 00039 float** initialLogValues; 00040 00041 Map(float widthRealMap, float heightRealMap, int nbCellWidth, int nbCellHeight); 00042 00043 float cell_width_coordinate_to_world(int i); 00044 00045 float cell_height_coordinate_to_world(int j); 00046 00047 float get_proba_cell(int widthIndice, int heightIndice); 00048 00049 void fill_map_with_initial(); 00050 00051 //Updates map value 00052 void update_cell_value(int widthIndice,int heightIndice ,float proba); 00053 00054 //returns the probability [0,1] that the cell is occupied from the log valAue lt 00055 float log_to_proba(float lt); 00056 00057 //returns the log value that the cell is occupied from the probability value [0,1] 00058 float proba_to_log(float p); 00059 00060 private: 00061 00062 //fill initialLogValues with the values we already know (here the bordurs) 00063 void fill_initialLogValues(); 00064 00065 /* 00066 00067 float robot_x_coordinate_in_world(float robot_x, float robot_y); 00068 00069 float robot_y_coordinate_in_world(float robot_x, float robot_y); 00070 00071 void print_final_map(); 00072 00073 void print_final_map_with_robot_position(float robot_x,float robot_y); 00074 00075 void print_final_map_with_robot_position_and_target(float robot_x,float robot_y,float targetXWolrd, float targetYWorld); 00076 */ 00077 }; 00078 00079 #endif 00080
Generated on Sat Jul 16 2022 11:20:12 by 1.7.2