diff --git a/ov_eval/src/calc/ResultTrajectory.cpp b/ov_eval/src/calc/ResultTrajectory.cpp index a6090f51b..718f3e426 100644 --- a/ov_eval/src/calc/ResultTrajectory.cpp +++ b/ov_eval/src/calc/ResultTrajectory.cpp @@ -110,6 +110,36 @@ void ResultTrajectory::calculate_ate(Statistics &error_ori, Statistics &error_po } +void ResultTrajectory::calculate_ate_2d(Statistics &error_ori, Statistics &error_pos) { + + // Clear any old data + error_ori.clear(); + error_pos.clear(); + + // Calculate the position and orientation error at every timestep + for(size_t i=0; i &segment_lengths, std::map> &error_rpe) { diff --git a/ov_eval/src/calc/ResultTrajectory.h b/ov_eval/src/calc/ResultTrajectory.h index 8eaf1209b..34068e5d0 100644 --- a/ov_eval/src/calc/ResultTrajectory.h +++ b/ov_eval/src/calc/ResultTrajectory.h @@ -82,6 +82,20 @@ namespace ov_eval { */ void calculate_ate(Statistics &error_ori, Statistics &error_pos); + /** + * @brief Computes the Absolute Trajectory Error (ATE) for this trajectory in the 2d x-y plane. + * + * This will first do our alignment of the two trajectories. + * We just grab the yaw component of the orientation and the xy plane error. + * Then at each point the error will be calculated and normed as follows: + * \f{align*}{ + * e_{ATE} &= \sqrt{ \frac{1}{K} \sum_{k=1}^{K} ||\mathbf{x}_{k,i} \boxminus \hat{\mathbf{x}}^+_{k,i}||^2_{2} } + * \f} + * + * @param error_ori Error values for the orientation (yaw error) + * @param error_pos Error values for the position (xy error) + */ + void calculate_ate_2d(Statistics &error_ori, Statistics &error_pos); /** * @brief Computes the Relative Pose Error (RPE) for this trajectory diff --git a/ov_eval/src/error_dataset.cpp b/ov_eval/src/error_dataset.cpp index 6fe71f571..fce16596f 100644 --- a/ov_eval/src/error_dataset.cpp +++ b/ov_eval/src/error_dataset.cpp @@ -117,11 +117,13 @@ int main(int argc, char **argv) { // Errors for this specific dataset (i.e. our averages over the total runs) ov_eval::Statistics ate_dataset_ori, ate_dataset_pos; + ov_eval::Statistics ate_2d_dataset_ori, ate_2d_dataset_pos; std::map> rpe_dataset; for(const auto& len : segments) { rpe_dataset.insert({len,{ov_eval::Statistics(),ov_eval::Statistics()}}); } std::map> rmse_dataset; + std::map> rmse_2d_dataset; std::map> nees_dataset; // Loop though the different runs for this dataset @@ -147,6 +149,17 @@ int main(int argc, char **argv) { assert(error_ori.timestamps.at(j)==error_pos.timestamps.at(j)); } + // Calculate ATE 2D error for this dataset + ov_eval::Statistics error_ori_2d, error_pos_2d; + traj.calculate_ate_2d(error_ori_2d, error_pos_2d); + ate_2d_dataset_ori.values.push_back(error_ori_2d.rmse); + ate_2d_dataset_pos.values.push_back(error_pos_2d.rmse); + for(size_t j=0; j - \ No newline at end of file +