2 #include <gsl/gsl_math.h> 6 #include "../csm/csm_all.h" 8 int main(
int argc,
const char * argv[]) {
12 const char*input_filename;
13 const char*output_filename;
14 double diff[3] = {0, 0, 0};
16 double laser[3] ={0,0,0};
18 double omega[2] ={0,0};
26 options_string(ops,
"out", &output_filename,
"stdout",
"output file");
29 options_double(ops,
"l_theta", &(laser[2]), 0.0,
"laser theta (rad)");
33 options_double(ops,
"omega_vel", &(omega_vel), 0.0,
"omega x vel");
36 options_double(ops,
"vel_omega", &(vel_omega), 0.0,
"vel x omega");
40 fprintf(stderr,
" Corrects bias in odometry.\n");
48 if(!input_stream || !output_stream)
return -1;
52 sm_error(
"Cannot read first scan.\n");
58 double old_odometry[3];
65 double guess[3], old_guess[3];
70 if(fabs(guess[2]) > 1e-7)
71 guess[2] = old_guess[2] * omega[1] + omega_vel * guess[0] + omega[0];
73 if(fabs(guess[0]) > 1e-7)
74 guess[0] = old_guess[0] * vel[1] + vel_omega * guess[2] + vel[0];
76 fprintf(stderr,
"odo: %f %f %f Corr: %f rad \t%f m \n", guess[0], guess[1], guess[2], guess[2]-old_guess[2], guess[0]-old_guess[0]);
81 fprintf(stderr,
"ref odo: %s ref est: %s \n",
84 fprintf(stderr,
"sens odo: %s sens est: %s \n",
93 laser_ref = laser_sens;
void sm_set_program_name(const char *name)
void ld_write_as_json(LDP ld, FILE *stream)
void copy_d(const double *from, int n, double *to)
const char * friendly_pose(const double *pose)
void options_double(struct option *, const char *name, double *p, double def_value, const char *desc)
FILE * open_file_for_writing(const char *filename)
LDP ld_read_smart(FILE *)
struct option * options_allocate(int n)
FILE * open_file_for_reading(const char *filename)
void oplus_d(const double x1[3], const double x2[3], double res[3])
void options_print_help(struct option *options, FILE *f)
void options_string(struct option *, const char *name, const char **p, const char *def_balue, const char *desc)
void pose_diff_d(const double pose2[3], const double pose1[3], double res[3])
void sm_error(const char *msg,...)
int main(int argc, const char *argv[])
int options_parse_args(struct option *ops, int argc, const char *argv[])