* Parameters of Obstacle detection
*******************************************************************************/
-#define OBS_SIZE_M 0.05 /**< Expected size of detected obstacle */
#define IGNORE_CLOSER_THAN_M 0.2 /**< Do not mark any obstacle closer than this to center of the robot (avoid path planning deadlock) */
#define IGNORE_FURTHER_THAN_M 0.5 /**< Ignore data from sharp if further than this */
#define OBS_FORGET_PERIOD 200 /**< The period of thread_obstacle_forgeting [ms] */
if (real_obstacle) {
/* The obstacle was detected here */
map->cells[ycell][xcell].flags |= MAP_FLAG_DET_OBST;
- map->cells[ycell][xcell].flags |= MAP_FLAG_WALL;
map->cells[ycell][xcell].detected_obstacle |= MAP_NEW_OBSTACLE;
}
* cell between them, the path will be recalculated. @see
* #OBS_CSPACE. */
-#if 0
/* Mark "protected" area around the obstacle */
robot_get_est_pos(&est_pos.x, &est_pos.y, &est_pos.phi);
- int obst_size_cell = (int)ceil(OBS_SIZE_M/MAP_CELL_SIZE_M);
- for (i=(xcell-obst_size_cell); i <= xcell+obst_size_cell; i++) {
- for (j=(ycell- obst_size_cell); j <=ycell + obst_size_cell; j++) {
+ int safety_area = (int)ceil(ROBOT_DIAGONAL_RADIUS_M/MAP_CELL_SIZE_M);
+
+ for (i=(xcell-safety_area); i <= xcell+safety_area; i++) {
+ for (j=(ycell- safety_area); j <=ycell + safety_area; j++) {
if (!ShmapIsCellInMap(i, j)) continue;
+
ShmapCell2Point(i, j, &xx, &yy);
- if ((distance(xx, yy, est_pos.x, est_pos.y) > IGNORE_CLOSER_THAN_M) &&
- (distance(xx, yy, x, y) < OBS_SIZE_M)) { /* We expect cirtular area around obstacle */
+ if (distance(xx, yy, x, y) < ROBOT_DIAGONAL_RADIUS_M) {
map->cells[j][i].detected_obstacle = MAP_NEW_OBSTACLE;
}
}
}
-#endif
}
/**
* A thread running the trajectory recalc
if((beam.ang<(-70.0/180.0*M_PI))||((beam.ang>(70.0/180.0*M_PI))))
continue;
- if(data[i] > 19 && data[i] < 2000) {
+ if(data[i] > 19 && data[i] < 4000) {
obst_coord(&e, &beam, data[i]/1000.0, &x, &y);
obstacle_detected_at(x, y, true);
+ obstacle_detected_at(x, y, false);
}
}
}