From d73825ebef4ebd334f79f1bab36e8703db118730 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 22 Oct 2017 19:39:16 +0200 Subject: [PATCH] Add 3d plot to position test --- src/tests/system-tests/position_test.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index bf85b6b50..64401bb00 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -582,13 +582,18 @@ void StaticPositionSystemTest::print_results(const std::vector & east, auto it_min_east = std::min_element(std::begin(east), std::end(east)); auto it_max_north = std::max_element(std::begin(north), std::end(north)); auto it_min_north = std::min_element(std::begin(north), std::end(north)); + auto it_max_up = std::max_element(std::begin(up), std::end(up)); + auto it_min_up = std::min_element(std::begin(up), std::end(up)); auto east_range = std::max(*it_max_east, std::abs(*it_min_east)); auto north_range = std::max(*it_max_north, std::abs(*it_min_north)); + auto up_range = std::max(*it_max_up, std::abs(*it_min_up)); double range = std::max(east_range, north_range) * 1.1; + double range_3d = std::max(std::max(east_range, north_range), up_range) * 1.1; double two_drms = 2 * sqrt(sigma_E_2_precision + sigma_N_2_precision); + double ninty_sas = 0.833 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision); try { boost::filesystem::path p(gnuplot_executable); @@ -613,6 +618,25 @@ void StaticPositionSystemTest::print_results(const std::vector & east, g1.savetops("Position_test_2D"); g1.showonscreen(); // window output + + Gnuplot g2("points"); + g2.set_title("3D precision"); + g2.set_xlabel("East [m]"); + g2.set_ylabel("North [m]"); + g2.set_zlabel("Up [m]"); + g2.cmd("set size ratio -1"); + g2.cmd("set xrange [-" + std::to_string(range_3d) + ":" + std::to_string(range_3d) + "]"); + g2.cmd("set yrange [-" + std::to_string(range_3d) + ":" + std::to_string(range_3d) + "]"); + g2.cmd("set zrange [-" + std::to_string(range_3d) + ":" + std::to_string(range_3d) + "]"); + g2.cmd("set view equal xyz"); + + g2.cmd("set style fill transparent solid 0.30 border\n set parametric\n set urange [0:2.0*pi]\n set vrange [-pi/2:pi/2]\n r = " + + std::to_string(ninty_sas) + + "\n fx(v,u) = r*cos(v)*cos(u)\n fy(v,u) = r*cos(v)*sin(u)\n fz(v) = r*sin(v) \n splot fx(v,u),fy(v,u),fz(v) title \"90\%-SAS\" lt rgb \"gray\"\n"); + g2.plot_xyz(east, north, up, "3D Position Fixes"); + + g2.savetops("Position_test_3D"); + g2.showonscreen(); // window output } catch (GnuplotException ge) {