From 17d68d2326c34284651296fe0b0ac97b30bd8034 Mon Sep 17 00:00:00 2001 From: JulienThevenoz Date: Fri, 2 Feb 2024 13:40:17 +0100 Subject: [PATCH] why did unittest tell the github action it passed when fig8 failed ? --- .github/workflows/systemtests_sim.yml | 2 +- systemtests/plotter_class.py | 15 ++------------- systemtests/test_flights.py | 2 +- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/systemtests_sim.yml b/.github/workflows/systemtests_sim.yml index ac3530cda..e30cd8fc7 100644 --- a/.github/workflows/systemtests_sim.yml +++ b/.github/workflows/systemtests_sim.yml @@ -57,7 +57,7 @@ jobs: export PYTHONPATH="${PYTHONPATH}:/home/github/actions-runner/_work/crazyswarm2/crazyswarm2/crazyflie-firmware/build/" export ROS_LOCALHOST_ONLY=1 export ROS_DOMAIN_ID=99 - python3 src/crazyswarm2/systemtests/test_flights.py --sim + python3 src/crazyswarm2/systemtests/test_flights.py --sim -v #-v is verbose argument of unittest - name: Upload files id: step7 diff --git a/systemtests/plotter_class.py b/systemtests/plotter_class.py index 0903bb628..bceb4db6e 100644 --- a/systemtests/plotter_class.py +++ b/systemtests/plotter_class.py @@ -29,9 +29,7 @@ def __init__(self, sim_backend = False): if self.SIM : #It allows to temporally adjust the ideal and real trajectories on the graph. Could this be implemented in a better (not hardcoded) way ? self.DELAY_CONST_FIG8 = -0.18 #for an unknown reason, the delay constant with the sim_backend is different self.ALTITUDE_CONST_FIG8 = 1 #this is the altitude given for the takeoff in figure8.py. I should find a better solution than a symbolic constant ? - # self.ALTITUDE_CONST_MULTITRAJ = 0 #takeoff altitude for traj0 in multi_trajectory.py - # self.X_OFFSET_CONST_MULTITRAJ = 0 #offest on the x axis between ideal and real trajectory. Reason: ideal trajectory (traj0.csv) starts with offset of 0.3m and CrazyflieServer.startTrajectory() is relative to start position - + def file_guard(self, pdf_path): msg = None if os.path.exists(pdf_path): @@ -101,15 +99,6 @@ def read_csv_and_set_arrays(self, ideal_csvfile, rosbag_csvfile): self.ideal_traj_x[i], self.ideal_traj_y[i], self.ideal_traj_z[i]= pos[0], pos[1], pos[2] - # #special cases - # if self.test_name == "fig8": - # # self.ideal_traj_z[i] = self.ALTITUDE_CONST_FIG8 #special case: in fig8 no altitude is given in the trajectory polynomials (idealcsv) but is fixed as the takeoff altitude in figure8.py - # pass - # elif self.test_name == "m_t": - # self.ideal_traj_z[i] = pos[2] + self.ALTITUDE_CONST_MULTITRAJ #for multi_trajectory the altitude given in the trajectory polynomials is added to the fixed takeoff altitude specified in multi_trajectory.py - # self.ideal_traj_x[i] = pos[0] + self.X_OFFSET_CONST_MULTITRAJ #the x-axis is offset by 0.3 m because ideal start position not being (0,0,0) - - self.euclidian_dist[i] = np.linalg.norm([self.ideal_traj_x[i]-self.bag_x[i], self.ideal_traj_y[i]-self.bag_y[i], self.ideal_traj_z[i]-self.bag_z[i]]) if self.euclidian_dist[i] > self.EPSILON: @@ -172,7 +161,7 @@ def adjust_arrays(self): - assert False or (takeoff_index != None) and (landing_index != None), "Plotter : couldn't find drone takeoff or landing" + assert (takeoff_index != None) and (landing_index != None), "Plotter : couldn't find drone takeoff or landing" ####get rid of datapoints before takeoff and after landing in bag_times, bag_x, bag_y, bag_y diff --git a/systemtests/test_flights.py b/systemtests/test_flights.py index a617e1d79..e68c6ae98 100644 --- a/systemtests/test_flights.py +++ b/systemtests/test_flights.py @@ -174,7 +174,7 @@ def test_multi_trajectory(self): self.test_file = "multi_trajectory_traj0_ideal.csv" self.record_start_and_clean("multi_trajectory", 80) test_passed = self.translate_plot_and_check("multi_trajectory") - assert test_passed, "multitrajectory test failed : deviation larger than epsilon" + test_passed, "multitrajectory test failed : deviation larger than epsilon"