29#define SEARCH_MAP_DEBUG 0
31#if (defined SITL) && SEARCH_MAP_DEBUG
32#define DEBUG_PRINT printf
34#define DEBUG_PRINT(...) {}
44 map->
grid[i][
j] = 0.f;
47 DEBUG_PRINT(
"map init at %f %f | res %f\n", pos.
x, pos.
y, res);
62 map->
grid[i][
j] = 0.f;
94 if (map->
grid[i][
j] > max) {
95 max = map->
grid[i][
j];
109 Bound(threshold, 0.f, 1.f);
114 if (
val >= threshold) {
118 quality += map->
grid[i][
j];
129 DEBUG_PRINT(
" -> offset %d, sum %f, res %f, bx %f, by %f, cx %f, cy %f, mx %f, my %f\n",
offset, sum, map->
res,
bx,
by, map->
center.
x, map->
center.
y, mx, my);
130 DEBUG_PRINT(
" -> pos %.4f %.4f, quality=%.2f\n", pos->
x, pos->
y, quality);
#define ENU_OF_TO_NED(_po, _pi)
struct EnuCoor_f * waypoint_get_enu_f(uint8_t wp_id)
Get ENU coordinates (float)
void waypoint_set_enu(uint8_t wp_id, struct EnuCoor_f *enu)
Set local ENU waypoint coordinates.
vector in East North Up coordinates Units: meters
vector in North East Down coordinates Units: meters
void search_map_init_from_wp(struct search_map_t *map, uint8_t wp_id, float res)
init map from waypoint
void search_map_reset(struct search_map_t *map)
reset map
void search_map_update_wp(struct search_map_t *map, float threshold, uint8_t wp_id)
update waypoint position from map
float search_map_get_barycenter(struct search_map_t *map, float threshold, struct NedCoor_f *pos)
get weighted center of the data, expected to be the search position
void search_map_init(struct search_map_t *map, struct NedCoor_f pos, float res)
init map
bool search_map_update(struct search_map_t *map, float data, struct NedCoor_f pos)
update map with new data
Library for generic map to store and search from sensor data.
float res
map resolution in m/cell
struct NedCoor_f center
center of the map
float grid[SEARCH_MAP_SIZE][SEARCH_MAP_SIZE]
data
static const float offset[]
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.