#include <robodim_eb2008.h>
#include <map.h>
#include <robomath.h>
+#include <hokuyo.h>
/*******************************************************************************
* Parameters of Obstacle detection
}
}
+void update_map_hokuyo(struct hokuyo_scan_type *s)
+{
+ double x, y;
+ //Pos p;
+ struct est_pos_type e;
+ int i, j;
+ struct sharp_pos beam;
+ u_int16_t *data;
+
+ ROBOT_LOCK(est_pos);
+ e = robot.est_pos;
+ ROBOT_UNLOCK(est_pos);
+
+ beam.x = HOKUYO_CENTER_OFFSET_M;
+ beam.y = 0;
+
+ data = (u_int16_t*)&(s->data1);
+
+ for (i = 0; i < HOKUYO_CLUSTER_CNT; i++) {
+ if(data[i] > 19) {
+ printf("mapa robot: %d %d %d\n", robot.hokuyo.data1, robot.hokuyo.data2,robot.hokuyo.data3);
+ printf("mapa: %d %d\n", i, data[i]);
+ beam.ang = HOKUYO_CLUSTER_TO_RAD(i);
+ printf("mapa uhel: %f\n",beam.ang);
+ obst_coord(&e, &beam, data[i]/1000.0, &x, &y);
+ obstacle_detected_at(x, y, true);
+ obst_coord(&e, &beam, (data[i]/1000.0)+0.3, &x, &y);
+ obstacle_detected_at(x, y, false);
+ }
+
+ }
+}
+
/**
* Decrease map.detected_obstacle by val with saturation on zero. It
* also clears #MAP_FLAG_DET_OBST if value reaches zero.