#include <robodim.h>
#include <map.h>
#include <robomath.h>
-#include <hokuyo.h>
-#include <sick.h>
-
#include <shape_detect.h>
#include "map_handling.h"
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
-void update_map_hokuyo(struct lidar_scan_type *s)
+void update_map_lidar(const struct lidar_params *l, struct lidar_scan_type *s)
{
double x, y;
struct robot_pos_type e;
- unsigned int i;
+ int i;
struct sharp_pos beam;
u_int16_t *data;
robot_get_est_pos(&e.x, &e.y, &e.phi);
- beam.x = SICK_CENTER_OFFSET_M;
+ beam.x = l->center_offset_m;
beam.y = 0;
data = s->data;
bool obstacle = true;
- for (i = 0; i < SICK_ARRAY_SIZE; i++) {
- beam.ang = SICK_INDEX_TO_RAD(i);
- if((beam.ang<(-SICK_RANGE_ANGLE_LEFT/180.0*M_PI))||((beam.ang>(SICK_RANGE_ANGLE_RIGHT/180.0*M_PI))))
+ for (i = 0; i < l->data_lenght; i++) {
+ beam.ang = index2rad(*l, i);
+
+ if ((beam.ang<(-l->range_angle_left/180.0*M_PI)) ||
+ ((beam.ang>(l->range_angle_right/180.0*M_PI)))) {
continue;
+ }
if(data[i] > 19 && data[i] < 2000) {
obst_coord(&e, &beam, data[i]/1000.0, &x, &y);