00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00032
#ifndef RMAP_H
00033
#define RMAP_H
00034
00035
#ifdef __cplusplus
00036
extern "C"
00037 {
00038
#endif
00039
00040
#include "slap.h"
00041
00043 #define RMAP_MAX_RANGES 401
00044
00045
00047 typedef struct
00048
{
00050 double time;
00051
00053 int index;
00054
00057 pose2_t init;
00058
00060 pose2_t pose;
00061
00063 pose2_t delta;
00064
00066 double ranges[
RMAP_MAX_RANGES];
00067
00069 int num_hits;
00070
vector2_t hits[
RMAP_MAX_RANGES];
00071
00072 }
rmap_scan_t;
00073
00074
00077 typedef struct rmap_item
00078 {
00080 rmap_scan_t *
scan;
00081
00083 vector2_t local;
00084
00086 vector2_t global;
00087
00089 struct rmap_item *
next;
00090
00091 }
rmap_item_t;
00092
00093
00095 typedef struct
00096
{
00098 rmap_item_t *first, *last;
00099
00100 }
rmap_cell_t;
00101
00102
00104 typedef struct
00105
{
00107 rmap_scan_t *scan_a, *scan_b;
00108
00110 vector2_t local_a, local_b;
00111
00113 double dist;
00114
00115 }
rmap_constraint_t;
00116
00117
00119 typedef struct
00120
{
00122 int num_ranges;
00123
00125 double range_max;
00126
00128 double range_start;
00129
00131 double range_step;
00132
00134 double max_dist;
00135
00137 int range_interval;
00138
00140 int key_interval;
00141
00143 int num_scans, max_scans;
00144
rmap_scan_t *scans;
00145
00147 int num_key_scans;
00148
00150 double grid_res;
00151
int grid_sx, grid_sy, grid_size;
00152
00154 rmap_cell_t *grid;
00155
00157 int num_items, max_items, items_size;
00158
rmap_item_t *items;
00159
00161 int num_cons, max_cons;
00162
rmap_constraint_t *cons;
00163
00165 int match_count;
00166
double relax_err;
00167
00168 }
rmap_t;
00169
00170
00172
rmap_t *
rmap_alloc(
int num_ranges,
double range_max,
00173
double range_start,
double range_step,
00174
double grid_width,
double grid_height);
00175
00177
void rmap_free(
rmap_t *
self);
00178
00180
void rmap_add(
rmap_t *
self,
double dtime,
pose2_t pose,
int num_ranges,
double *ranges);
00181
00183
void rmap_match(
rmap_t *
self);
00184
00187
void rmap_match_prepare(
rmap_t *
self,
rmap_scan_t *scan);
00188
00191
void rmap_match_scan(
rmap_t *
self,
rmap_scan_t *scan_a);
00192
00195
void rmap_relax(
rmap_t *
self,
int num_cycles);
00196
00198
void rmap_interpolate(
rmap_t *
self);
00199
00201
void rmap_draw_map(
rmap_t *
self);
00202
00204
void rmap_draw_cons(
rmap_t *
self);
00205
00206
00207
#ifdef __cplusplus
00208
}
00209
#endif
00210
00211
#endif