Go to the documentation of this file.
2 #include <gsl/gsl_rng.h>
3 #include <gsl/gsl_randist.h>
4 #include <gsl/gsl_math.h>
8 #include "../csm/csm_all.h"
26 "This program prepares the data for one of the experiments. \n\n"
27 "The input is any sensor log (Carmen or JSON format) \n"
28 "The output are two files that contain laser_ref and laser_sens\n"
29 "(you have to match the i-th scan in the first file with the i-th\n"
30 " in the second).\n\n"
31 "The two files contain exactly the same date but for the 'odometry' field\n"
32 "The odometry error is uniform in the intervals given.\n";
34 int main(
int argc,
const char ** argv) {
42 options_double(
ops,
"max_xy_error", &
p.max_xy_error, 10.0,
"Maximum error for x,y (m)");
43 options_double(
ops,
"max_theta_error_deg", &
p.max_theta_error_deg, 10.0,
"Maximum error for orientation (deg)");
44 options_int (
ops,
"seed", &
p.seed, 0,
"Seed for random number generator (if 0, use GSL_RNG_SEED env. variable).");
46 options_int(
ops,
"num_per_scan", &
p.num_per_scan, 10,
"Number of trials for each scan.");
62 gsl_rng *
rng = gsl_rng_alloc (gsl_rng_ranlxs0);
64 gsl_rng_set(
rng, (
unsigned int)
p.seed);
75 if(!strcmp(
p.file_output1,
p.file_output2)) {
87 sm_error(
"Invalid laser data (#%d in file)\n", count);
91 for(
int n=0; n <
p.num_per_scan; n++) {
102 ld->
odometry[0] = 2*(gsl_rng_uniform(
rng)-0.5) *
p.max_xy_error;
103 ld->
odometry[1] = 2*(gsl_rng_uniform(
rng)-0.5) *
p.max_xy_error;
int ld_valid_fields(LDP ld)
const char * file_output1
const char * file_output2
FILE * open_file_for_writing(const char *filename)
void options_double(struct option *, const char *name, double *p, double def_value, const char *desc)
void sm_set_program_name(const char *name)
struct option * options_allocate(int n)
void options_int(struct option *, const char *name, int *p, int def_value, const char *desc)
double max_theta_error_deg
FILE * open_file_for_reading(const char *filename)
void options_print_help(struct option *options, FILE *f)
void sm_error(const char *msg,...)
int main(int argc, const char **argv)
LDP ld_read_smart(FILE *)
void options_string(struct option *, const char *name, const char **p, const char *def_balue, const char *desc)
int options_parse_args(struct option *ops, int argc, const char *argv[])
void ld_write_as_json(LDP ld, FILE *stream)
void sm_debug_write(int flag)
void options_banner(const char *message)
csm
Author(s): Andrea Censi
autogenerated on Wed Aug 17 2022 02:50:33