Skip to content

Commit

Permalink
small modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
julienthevenoz committed Feb 2, 2024
1 parent 08025cf commit 684c847
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions systemtests/plotter_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, sim_backend = False):

self.SIM = sim_backend #indicates if we are plotting data from real life test or from a simulated test. Default is false (real life test)
self.EPSILON = 0.1 # euclidian distance in [m] between ideal and recorded trajectory under which the drone has to stay to pass the test (NB : epsilon is doubled for multi_trajectory test)
self.ALLOWED_DEV_POINTS = 0.05 #allowed percentage of datapoints whose deviation > EPSILON while still passing test (currently 5% for fig8 and 10% for mt)
self.ALLOWED_DEV_POINTS = 0.05 #allowed percentage of datapoints whose deviation > EPSILON while still passing test (currently % for fig8 and 10% for mt)
self.DELAY_CONST_FIG8 = 4.75 #this is the delay constant which I found by adding up all the time.sleep() etc in the figure8.py file.
self.DELAY_CONST_MT = 0
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 ?
Expand Down Expand Up @@ -58,7 +58,6 @@ def read_csv_and_set_arrays(self, ideal_csvfile, rosbag_csvfile, test_name):
self.ideal_traj_csv = Trajectory()
try:
path_to_ideal_csv = os.path.join(os.path.dirname(os.path.abspath(__file__)),ideal_csvfile)
print(path_to_ideal_csv)
self.ideal_traj_csv.loadcsv(path_to_ideal_csv)
except FileNotFoundError:
print("Plotter : File not found " + path_to_ideal_csv)
Expand Down Expand Up @@ -149,6 +148,7 @@ def no_match_warning(self, unmatched_values:list):
def adjust_arrays(self):
''' Method that trims the self.bag_* attributes to get rid of the datapoints where the drone is immobile on the ground and makes self.bag_times start at 0 [s]'''

print(f"rosbag initial length {(self.bag_times[-1]-self.bag_times[0]) }s")
print(f"rosbag initial length {(self.bag_times[-1]-self.bag_times[0]) * 10**-9}s")
#find the takeoff time and landing times
ground_level = self.bag_z[0]
Expand All @@ -161,10 +161,12 @@ def adjust_arrays(self):
takeoff_index = i
takeoff_time = self.bag_times[takeoff_index]
airborne = True
print(f"takeoff time is {self.bag_times[takeoff_index]}s")
print(f"takeof time is {(takeoff_time-self.bag_times[0]) * 10**-9}")
if airborne and z_coord <= ground_level + ground_level*(0.1): #find when it lands again
landing_index = i
landing_time = self.bag_times[landing_index]
print(f"landing time is {self.bag_times[landing_index]}s")
print(f"landing time is {(landing_time-self.bag_times[0]) * 10**-9}")
break
i+=1
Expand Down
2 changes: 1 addition & 1 deletion systemtests/test_flights.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def clean_process(process:Popen) -> int :
'''Kills process and its children on exit if they aren't already terminated (called with atexit). Returns 0 on termination, 1 if SIGKILL was needed'''
if process.poll() == None:
group_id = os.getpgid(process.pid)
print(f"cleaning process {group_id}")
#print(f"cleaning process {group_id}")
os.killpg(group_id, signal.SIGTERM)
time.sleep(0.01) #necessary delay before first poll
i=0
Expand Down

0 comments on commit 684c847

Please sign in to comment.