Skip to content

Commit

Permalink
delete results/bags/logs folders only if they exist
Browse files Browse the repository at this point in the history
  • Loading branch information
julienthevenoz committed Dec 7, 2023
1 parent e6dcf27 commit 52d35fb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions systemtests/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ def translate_and_plot(testname:str, bagfolder:str):

path = Path(__file__) #Path(__file__) in this case "/home/github/actions-runner/_work/crazyswarm2/crazyswarm2/ros2_ws/src/crazyswarm2/systemtests/newsub.py" ; path.parents[0]=.../systemstests

#delete results, logs and bags of previous experiments
shutil.rmtree(path.parents[3].joinpath("bagfiles"))
shutil.rmtree(path.parents[3].joinpath("results"))
shutil.rmtree(Path.home() / ".ros/log")
#delete results, logs and bags of previous experiments if they exist
if(Path(path.parents[3].joinpath("bagfiles")).exists()):
shutil.rmtree(path.parents[3].joinpath("bagfiles"))
if(Path(path.parents[3].joinpath("results")).exists()):
shutil.rmtree(path.parents[3].joinpath("results"))
if(Path(Path.home() / ".ros/log").exists()):
shutil.rmtree(Path.home() / ".ros/log")


#create the folder where we will record the different bags and the folder where the results pdf will be saved
Expand All @@ -124,7 +127,9 @@ def translate_and_plot(testname:str, bagfolder:str):
atexit.register(clean_process, launch_crazyswarm)

time.sleep(1)
print("f8")
record_start_and_terminate("figure8", 20, bagfolder)
print("multitrajectory")
record_start_and_terminate("multi_trajectory", 80, bagfolder)


Expand Down

0 comments on commit 52d35fb

Please sign in to comment.