45 Statistics error_ori[3], error_pos[3], error_vel[3], error_bg[3], error_ba[3];
49 for (
size_t i = 0; i <
est_state.size(); i++) {
52 if ((
est_state.at(i)(0) - start_time) > max_time)
63 for (
int j = 0; j < 3; j++) {
65 error_ori[j].
values.push_back(ori_err(j));
71 Eigen::Vector3d pos_err =
gt_state.at(i).block(5, 0, 3, 1) -
est_state.at(i).block(5, 0, 3, 1);
72 for (
int j = 0; j < 3; j++) {
74 error_pos[j].
values.push_back(pos_err(j));
80 Eigen::Vector3d vel_err =
gt_state.at(i).block(8, 0, 3, 1) -
est_state.at(i).block(8, 0, 3, 1);
81 for (
int j = 0; j < 3; j++) {
83 error_vel[j].
values.push_back(vel_err(j));
89 Eigen::Vector3d bg_err =
gt_state.at(i).block(11, 0, 3, 1) -
est_state.at(i).block(11, 0, 3, 1);
90 for (
int j = 0; j < 3; j++) {
92 error_bg[j].
values.push_back(bg_err(j));
98 Eigen::Vector3d ba_err =
gt_state.at(i).block(14, 0, 3, 1) -
est_state.at(i).block(14, 0, 3, 1);
99 for (
int j = 0; j < 3; j++) {
101 error_ba[j].
values.push_back(ba_err(j));
111 #ifndef HAVE_PYTHONLIBS 119 plot_3errors(error_ori[0], error_ori[1], error_ori[2],
"blue",
"red");
136 plot_3errors(error_pos[0], error_pos[1], error_pos[2],
"blue",
"red");
153 plot_3errors(error_vel[0], error_vel[1], error_vel[2],
"blue",
"red");
170 plot_3errors(error_bg[0], error_bg[1], error_bg[2],
"blue",
"red");
187 plot_3errors(error_ba[0], error_ba[1], error_ba[2],
"blue",
"red");
209 for (
size_t i = 0; i <
est_state.size(); i++) {
212 if ((
est_state.at(i)(0) - start_time) > max_time)
235 #ifndef HAVE_PYTHONLIBS 246 for (
size_t i = 0; i < error_time.
timestamps.size(); i++) {
251 std::map<std::string, std::string> params_value, params_bound;
252 params_value.insert({
"label",
"error"});
253 params_value.insert({
"linestyle",
"-"});
254 params_value.insert({
"color",
"blue"});
255 params_bound.insert({
"label",
"3 sigma bound"});
256 params_bound.insert({
"linestyle",
"--"});
257 params_bound.insert({
"color",
"red"});
263 for (
size_t i = 0; i < error_time.
timestamps.size(); i++) {
289 std::vector<std::vector<Statistics>> error_cam_k, error_cam_d;
290 for (
int i = 0; i < (int)
est_state.at(0)(18); i++) {
291 std::vector<Statistics> temp1, temp2;
292 for (
int j = 0; j < 4; j++) {
296 error_cam_k.push_back(temp1);
297 error_cam_d.push_back(temp2);
302 for (
size_t i = 0; i <
est_state.size(); i++) {
305 if ((
est_state.at(i)(0) - start_time) > max_time)
318 for (
int n = 0; n < (int)
est_state.at(0)(18); n++) {
319 for (
int j = 0; j < 4; j++) {
320 error_cam_k.at(n).at(j).timestamps.push_back(
est_state.at(i)(0));
321 error_cam_k.at(n).at(j).values.push_back(
est_state.at(i)(19 + 15 * n + j) -
gt_state.at(i)(19 + 15 * n + j));
322 error_cam_k.at(n).at(j).values_bound.push_back(3 *
state_cov.at(i)(18 + 14 * n + j));
323 error_cam_d.at(n).at(j).timestamps.push_back(
est_state.at(i)(0));
324 error_cam_d.at(n).at(j).values.push_back(
est_state.at(i)(19 + 4 + 15 * n + j) -
gt_state.at(i)(19 + 4 + 15 * n + j));
325 error_cam_d.at(n).at(j).values_bound.push_back(3 *
state_cov.at(i)(18 + 4 + 14 * n + j));
334 #ifndef HAVE_PYTHONLIBS 340 std::vector<std::string> colors = {
"blue",
"red",
"black",
"green",
"cyan",
"magenta"};
341 assert(error_cam_k.size() <= colors.size());
345 for (
int n = 0; n < (int)
est_state.at(0)(18); n++) {
346 std::string estcolor = ((int)
est_state.at(0)(18) == 1) ?
"blue" : colors.at(n);
347 std::string stdcolor = ((int)
est_state.at(0)(18) == 1) ?
"red" : colors.at(n);
348 plot_4errors(error_cam_k.at(n)[0], error_cam_k.at(n)[1], error_cam_k.at(n)[2], error_cam_k.at(n)[3], colors.at(n), stdcolor);
367 for (
int n = 0; n < (int)
est_state.at(0)(18); n++) {
368 std::string estcolor = ((int)
est_state.at(0)(18) == 1) ?
"blue" : colors.at(n);
369 std::string stdcolor = ((int)
est_state.at(0)(18) == 1) ?
"red" : colors.at(n);
370 plot_4errors(error_cam_d.at(n)[0], error_cam_d.at(n)[1], error_cam_d.at(n)[2], error_cam_d.at(n)[3], estcolor, stdcolor);
399 std::vector<std::vector<Statistics>> error_cam_ori, error_cam_pos;
400 for (
int i = 0; i < (int)
est_state.at(0)(18); i++) {
401 std::vector<Statistics> temp1, temp2;
402 for (
int j = 0; j < 3; j++) {
406 error_cam_ori.push_back(temp1);
407 error_cam_pos.push_back(temp2);
412 for (
size_t i = 0; i <
est_state.size(); i++) {
415 if ((
est_state.at(i)(0) - start_time) > max_time)
428 for (
int n = 0; n < (int)
est_state.at(0)(18); n++) {
435 for (
int j = 0; j < 3; j++) {
436 error_cam_ori.at(n).at(j).timestamps.push_back(
est_state.at(i)(0));
437 error_cam_ori.at(n).at(j).values.push_back(ori_err(j));
438 error_cam_ori.at(n).at(j).values_bound.push_back(3 * 180.0 / M_PI *
state_cov.at(i)(26 + 14 * n + j));
439 error_cam_pos.at(n).at(j).timestamps.push_back(
est_state.at(i)(0));
440 error_cam_pos.at(n).at(j).values.push_back(
est_state.at(i)(27 + 4 + 15 * n + j) -
gt_state.at(i)(27 + 4 + 15 * n + j));
441 error_cam_pos.at(n).at(j).values_bound.push_back(3 *
state_cov.at(i)(26 + 3 + 14 * n + j));
450 #ifndef HAVE_PYTHONLIBS 456 std::vector<std::string> colors = {
"blue",
"red",
"black",
"green",
"cyan",
"magenta"};
457 assert(error_cam_ori.size() <= colors.size());
461 for (
int n = 0; n < (int)
est_state.at(0)(18); n++) {
462 std::string estcolor = ((int)
est_state.at(0)(18) == 1) ?
"blue" : colors.at(n);
463 std::string stdcolor = ((int)
est_state.at(0)(18) == 1) ?
"red" : colors.at(n);
464 plot_3errors(error_cam_ori.at(n)[0], error_cam_ori.at(n)[1], error_cam_ori.at(n)[2], colors.at(n), stdcolor);
481 for (
int n = 0; n < (int)
est_state.at(0)(18); n++) {
482 std::string estcolor = ((int)
est_state.at(0)(18) == 1) ?
"blue" : colors.at(n);
483 std::string stdcolor = ((int)
est_state.at(0)(18) == 1) ?
"red" : colors.at(n);
484 plot_3errors(error_cam_pos.at(n)[0], error_cam_pos.at(n)[1], error_cam_pos.at(n)[2], estcolor, stdcolor);
512 int imu_model = (int)
est_state.at(0)(1 + 16 + 1 + 1 + 15 * num_cam);
513 int dw_id = 1 + 16 + 1 + 1 + 15 * num_cam + 1;
514 int dw_cov_id = 1 + 15 + 1 + 1 + 14 * num_cam + 1;
515 int da_id = dw_id + 6;
516 int da_cov_id = dw_cov_id + 6;
517 int tg_id = da_id + 6;
518 int tg_cov_id = da_cov_id + 6;
519 int wtoI_id = tg_id + 9;
520 int wtoI_cov_id = tg_cov_id + 9;
521 int atoI_id = wtoI_id + 4;
522 int atoI_cov_id = wtoI_cov_id + 3;
525 std::vector<Statistics> error_dw, error_da, error_tg, error_wtoI, error_atoI;
526 for (
int j = 0; j < 6; j++) {
530 for (
int j = 0; j < 9; j++) {
533 for (
int j = 0; j < 3; j++) {
540 for (
size_t i = 0; i <
est_state.size(); i++) {
543 if ((
est_state.at(i)(0) - start_time) > max_time)
556 for (
int j = 0; j < 6; j++) {
557 error_dw.at(j).timestamps.push_back(
est_state.at(i)(0));
558 error_dw.at(j).values.push_back(
est_state.at(i)(dw_id + j) -
gt_state.at(i)(dw_id + j));
559 error_dw.at(j).values_bound.push_back(3 *
state_cov.at(i)(dw_cov_id + j));
560 error_da.at(j).timestamps.push_back(
est_state.at(i)(0));
561 error_da.at(j).values.push_back(
est_state.at(i)(da_id + j) -
gt_state.at(i)(da_id + j));
562 error_da.at(j).values_bound.push_back(3 *
state_cov.at(i)(da_cov_id + j));
564 for (
int j = 0; j < 9; j++) {
565 error_tg.at(j).timestamps.push_back(
est_state.at(i)(0));
566 error_tg.at(j).values.push_back(
est_state.at(i)(tg_id + j) -
gt_state.at(i)(tg_id + j));
567 error_tg.at(j).values_bound.push_back(3 *
state_cov.at(i)(tg_cov_id + j));
577 for (
int j = 0; j < 3; j++) {
578 error_wtoI.at(j).timestamps.push_back(
est_state.at(i)(0));
579 error_wtoI.at(j).values.push_back(ori_wtoI(j));
580 error_wtoI.at(j).values_bound.push_back(3 * 180.0 / M_PI *
state_cov.at(i)(wtoI_cov_id + j));
581 error_atoI.at(j).timestamps.push_back(
est_state.at(i)(0));
582 error_atoI.at(j).values.push_back(ori_atoI(j));
583 error_atoI.at(j).values_bound.push_back(3 * 180.0 / M_PI *
state_cov.at(i)(atoI_cov_id + j));
591 #ifndef HAVE_PYTHONLIBS 597 std::vector<std::string> colors = {
"blue",
"red",
"black",
"green",
"cyan",
"magenta"};
598 std::string estcolor = ((int)
est_state.at(0)(18) == 1) ?
"blue" : colors.at(0);
599 std::string stdcolor = ((int)
est_state.at(0)(18) == 1) ?
"red" : colors.at(1);
603 plot_6errors(error_dw[0], error_dw[3], error_dw[1], error_dw[4], error_dw[2], error_dw[5], colors.at(0), stdcolor);
630 plot_6errors(error_da[0], error_da[3], error_da[1], error_da[4], error_da[2], error_da[5], colors.at(0), stdcolor);
658 plot_9errors(error_tg[0], error_tg[3], error_tg[6], error_tg[1], error_tg[4], error_tg[7], error_tg[2], error_tg[5], error_tg[8],
659 colors.at(0), stdcolor);
693 if (imu_model == 0) {
698 plot_3errors(error_wtoI[0], error_wtoI[1], error_wtoI[2], colors.at(0), stdcolor);
717 plot_3errors(error_atoI[0], error_atoI[1], error_atoI[2], colors.at(0), stdcolor);
Statistics object for a given set scalar time series values.
void plot_imu_intrinsics(bool doplotting, double max_time=INFINITY)
Will plot the imu intrinsic errors.
void plot_state(bool doplotting, double max_time=INFINITY)
Will plot the state error and its three sigma bounds.
std::vector< Eigen::VectorXd > gt_state
std::vector< double > values
Values (e.g. error or nees at a given time)
void figure_size(size_t w, size_t h)
bool plot(const std::vector< Numeric > &x, const std::vector< Numeric > &y, const std::map< std::string, std::string > &keywords)
void plot_timeoff(bool doplotting, double max_time=INFINITY)
Will plot the state imu camera offset and its sigma bound.
std::vector< Eigen::VectorXd > est_state
void plot_cam_extrinsics(bool doplotting, double max_time=INFINITY)
Will plot the camera calibration extrinsic transform.
Evaluation and recording utilities.
void calculate()
Will calculate all values from our vectors of information.
void plot_cam_instrinsics(bool doplotting, double max_time=INFINITY)
Will plot the camera calibration intrinsics.
ResultSimulation(std::string path_est, std::string path_std, std::string path_gt)
Default constructor that will load our data from file.
void show(const bool block=true)
std::vector< Eigen::VectorXd > state_cov
Eigen::Matrix< double, 3, 1 > log_so3(const Eigen::Matrix< double, 3, 3 > &R)
std::vector< double > values_bound
Bound of these values (e.g. our expected covariance bound)
#define PRINT_WARNING(x...)
#define PRINT_ERROR(x...)
void xlim(Numeric left, Numeric right)
static void load_simulation(std::string path, std::vector< Eigen::VectorXd > &values)
Load an arbitrary sized row of space separated values, used for our simulation.
void xlabel(const std::string &str, const std::map< std::string, std::string > &keywords={})
void subplot(long nrows, long ncols, long plot_number)
void title(const std::string &titlestr, const std::map< std::string, std::string > &keywords={})
void ylabel(const std::string &str, const std::map< std::string, std::string > &keywords={})
Eigen::Matrix< double, 3, 3 > quat_2_Rot(const Eigen::Matrix< double, 4, 1 > &q)
#define PRINT_DEBUG(x...)
std::vector< double > timestamps
Timestamp when these values occured at.