mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2025-12-13 02:25:48 +08:00
update the batch process script for the ekf analysis tool to support resumed analysis:
- ulog files are skipped from the analysis, if a corresponding .pdf file already exists - an overwrite flag can be set to analyse all the files
This commit is contained in:
@@ -1,14 +1,19 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os, glob
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Runs process_logdata_ekf.py on all the files in the suplied directory with a .ulg extension
|
Runs process_logdata_ekf.py on the .ulg files in the supplied directory. ulg files are skipped from the analysis, if a
|
||||||
|
corresponding .pdf file already exists (unless the overwrite flag was set).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Analyse the estimator_status and ekf2_innovation message data for all .ulg files in the specified directory')
|
parser = argparse.ArgumentParser(description='Analyse the estimator_status and ekf2_innovation message data for the'
|
||||||
|
' .ulg files in the specified directory')
|
||||||
parser.add_argument("directory_path")
|
parser.add_argument("directory_path")
|
||||||
|
parser.add_argument('-ow', '--overwrite', action='store_true',
|
||||||
|
help='Whether to overwrite an already analysed file. If a file with .pdf extension exists for a .ulg'
|
||||||
|
'file, the log file will be skipped from analysis unless this flag has been set.')
|
||||||
|
|
||||||
def is_valid_directory(parser, arg):
|
def is_valid_directory(parser, arg):
|
||||||
if os.path.isdir(arg):
|
if os.path.isdir(arg):
|
||||||
@@ -19,9 +24,17 @@ def is_valid_directory(parser, arg):
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
ulog_directory = args.directory_path
|
ulog_directory = args.directory_path
|
||||||
print("\n"+"analysing all .ulog files in "+ulog_directory)
|
print("\n"+"analysing the .ulg files in "+ulog_directory)
|
||||||
# Run the analysis script on all the log files found in the specified directory
|
|
||||||
for file in os.listdir(ulog_directory):
|
# get all the ulog files found in the specified directory
|
||||||
if file.endswith(".ulg"):
|
ulog_files = glob.glob(os.path.join(ulog_directory, '*.ulg'))
|
||||||
print("\n"+"loading "+file+" for analysis")
|
|
||||||
os.system("python process_logdata_ekf.py '{}'".format(os.path.join(ulog_directory, file)))
|
# remove the files already analysed unless the overwrite flag was specified. A ulog file is consired to be analysed if
|
||||||
|
# a corresponding .pdf file exists.'
|
||||||
|
if not args.overwrite:
|
||||||
|
ulog_files = [ulog_file for ulog_file in ulog_files if not os.path.exists('{}.pdf'.format(ulog_file))]
|
||||||
|
|
||||||
|
# analyse all ulog files
|
||||||
|
for ulog_file in ulog_files:
|
||||||
|
print("\n"+"loading "+ulog_file +" for analysis")
|
||||||
|
os.system("python process_logdata_ekf.py '{}'".format(ulog_file))
|
||||||
|
|||||||
Reference in New Issue
Block a user