pmap.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00056
#ifndef PMAP_H
00057
#define PMAP_H
00058
00059
#ifdef __cplusplus
00060
extern "C"
00061 {
00062
#endif
00063
00064
#include "gsl/gsl_rng.h"
00065
#include "slap.h"
00066
00067
00069 #define PMAP_MAX_RANGES 401
00070
00071
00073 typedef struct
00074
{
00076 int dx, dy;
00077
00079 double dist;
00080
00081 }
pmap_nbor_t;
00082
00083
00085 typedef struct
00086
{
00088 double time;
00089
00091 double ranges[
PMAP_MAX_RANGES];
00092
00093 }
pmap_scan_t;
00094
00095
00097 typedef struct
00098
{
00100 double w;
00101
00103 double err;
00104
00106 pose2_t pose;
00107
00109 vector2_t *global_points;
00110
00112 pose2_t *poses;
00113
00115 signed char *cells;
00116
00117 }
pmap_sample_t;
00118
00119
00120
00122 typedef struct
00123
{
00125 int num_ranges;
00126
00128 double range_max;
00129
00131 double range_start;
00132
00134 double range_step;
00135
00137 double grid_res;
00138
int grid_sx, grid_sy;
00139
00141 int traj_size, grid_size;
00142
00144 matrix44_t action_model;
00145
00147 double max_err;
00148
00150 int resample_interval;
00151
00153 double resample_s;
00154
00156 int num_nbors;
00157
pmap_nbor_t *nbors;
00158
00160 int scan_count;
00161
00163 int step_count;
00164
00166 int step_max_count;
00167
00169 pmap_scan_t *scans;
00170
00172 int samples_len, sample_set;
00173
00175 pmap_sample_t *samples;
00176
00178 int best_sample;
00179
00181 pose2_t initial_pose;
00182
00184 pose2_t odom_pose;
00185
double odom_dist, odom_turn;
00186
00188 double update_dist, update_turn;
00189
00191 int resample_count;
00192
00194 gsl_rng *rng;
00195
00196 }
pmap_t;
00197
00198
00209
pmap_t *
pmap_alloc(
int num_ranges,
double range_max,
00210
double range_start,
double range_step,
int samples_len,
00211
double grid_width,
double grid_height,
double grid_scale);
00212
00214
void pmap_free(
pmap_t *
self);
00215
00218
void pmap_init_nbors(
pmap_t *
self);
00219
00222
void pmap_set_pose(
pmap_t *
self,
pose2_t pose);
00223
00225
void pmap_update(
pmap_t *
self,
double dtime,
pose2_t odom_pose,
int num_ranges,
double *ranges);
00226
00229
void pmap_apply_action(
pmap_t *
self,
pose2_t delta);
00230
00233
void pmap_add_scan(
pmap_t *
self,
double dtime,
double *ranges);
00234
00237
void pmap_add_scan_sample(
pmap_t *
self,
int sample_index,
double *ranges);
00238
00241
void pmap_apply_sensor(
pmap_t *
self,
double *ranges);
00242
00245
void pmap_apply_sensor_sample(
pmap_t *
self,
int sample_index,
double *ranges);
00246
00249
double pmap_entropy(
pmap_t *
self,
int scan_count);
00250
00253
void pmap_resample(
pmap_t *
self,
int scan_count);
00254
00256
void pmap_draw_scan(
pmap_t *
self,
double *ranges);
00257
00259
void pmap_draw_samples(
pmap_t *
self);
00260
00262
void pmap_draw_sample(
pmap_t *
self,
int sample_index);
00263
00266
void pmap_draw_map(
pmap_t *
self,
double scale);
00267
00270
void pmap_draw_sample_map(
pmap_t *
self,
double scale,
int sample_index);
00271
00273 #define PMAP_GET_SAMPLE(self, i) (self->samples + self->sample_set * self->samples_len + (i))
00274
00276 #define PMAP_GRIDX(self, x) ((int) floor((x) / self->grid_res) + self->grid_sx / 2)
00277
#define PMAP_GRIDY(self, y) ((int) floor((y) / self->grid_res) + self->grid_sy / 2)
00278
#define PMAP_GRID_VALID(self, x, y) ((x) >= 0 && (x) < self->grid_sx && (y) >= 0 && (y) < self->grid_sy)
00279
#define PMAP_GRID_INDEX(self, x, y) ((x) + (y) * self->grid_sx)
00280
00281
00282
#ifdef __cplusplus
00283
}
00284
#endif
00285
00286
#endif
Generated on Tue Dec 14 14:37:39 2004 for Simple map utilities by 1.3.8