#ifndef _MAP_HANDLING_H
#define _MAP_HANDLING_H
+#include <cmath>
+#include <robot.h>
#include <robodim.h>
+#include <map.h>
+#include <robomath.h>
+#include <hokuyo.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <shape_detect.h>
-void * thread_obstacle_forgeting(void * arg);
-/*void update_map(struct sharps_type *s);*/
-void update_map_hokuyo(struct hokuyo_scan_type *s);
+const double OBS_SIZE_M = 0.2; /**< Expected size of detected obstacle */
+const double IGNORE_CLOSER_THAN_M = 0.2; /**< Do not mark any obstacle closer than this to center of the robot (avoid path planning deadlock) */
+const double IGNORE_FURTHER_THAN_M = 0.5; /**< Ignore data from sharp if further than this */
+const int OBS_FORGET_PERIOD = 100; /**< The period of thread_obstacle_forgeting [ms] */
+const int OBS_FORGET_SEC = 1; /**< Time to completely forget detected obstacle. */
+const double OBS_OFFSET = 0.6;
-#ifdef __cplusplus
-}
-#endif
+class MapHandling{
+
+ map *sh_map;
+ void obstacle_detected_at(double x, double y, bool real_obstacle);
+ void figure_detected_at(double x, double y, const bool state);
+ void obst_coord(struct robot_pos_type *e, const sharp_pos *s, double v, double &x, double &y);
+ void get_checkerboard(std::vector<Shape_detect::Point> &team);
+ float point_distance(Shape_detect::Point a, Shape_detect::Point b) {
+ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
+ }
+
+ public:
+ void update_map_hokuyo(struct hokuyo_scan_type *s);
+ map* get_map() {
+ return sh_map;
+ }
+ void set_map(map *map_shared) {
+ sh_map = map_shared;
+ }
+};
+extern MapHandling map_handle;
+void * thread_obstacle_forgeting(void * arg);
#endif