with class

Dependencies:   ISR_Mini-explorer mbed

Fork of VirtualForces by Georgios Tsamis

Committer:
Ludwigfr
Date:
Fri Jun 16 10:40:53 2017 +0000
Revision:
39:890439b495e3
Parent:
36:b59d56d0b3b4
last version with the 4th lab;

Who changed what in which revision?

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