Tools: Handle repeated add-param-file arguments to sim_vehicle.py.

This commit is contained in:
Samuel Tabor 2021-02-02 14:27:27 +00:00 committed by Peter Barker
parent 660d301f9b
commit 36428f5074

View File

@ -617,12 +617,18 @@ def start_vehicle(binary, opts, stuff, spawns=None):
path = ",".join(paths) path = ",".join(paths)
progress("Using defaults from (%s)" % (path,)) progress("Using defaults from (%s)" % (path,))
if opts.add_param_file: if opts.add_param_file:
if not os.path.isfile(opts.add_param_file): for file in opts.add_param_file:
if not os.path.isfile(file):
print("The parameter file (%s) does not exist" % print("The parameter file (%s) does not exist" %
(opts.add_param_file,)) (file,))
sys.exit(1) sys.exit(1)
path += "," + str(opts.add_param_file)
progress("Adding parameters from (%s)" % (str(opts.add_param_file),)) if path is not None:
path += "," + str(file)
else:
path = str(file)
progress("Adding parameters from (%s)" % (str(file),))
if opts.OSDMSP: if opts.OSDMSP:
path += "," + os.path.join(root_dir, "libraries/AP_MSP/Tools/osdtest.parm") path += "," + os.path.join(root_dir, "libraries/AP_MSP/Tools/osdtest.parm")
path += "," + os.path.join(autotest_dir, "default_params/msposd.parm") path += "," + os.path.join(autotest_dir, "default_params/msposd.parm")
@ -1017,6 +1023,7 @@ group_sim.add_option("", "--rgbled",
help="Enable SITL RGBLed") help="Enable SITL RGBLed")
group_sim.add_option("", "--add-param-file", group_sim.add_option("", "--add-param-file",
type='string', type='string',
action="append",
default=None, default=None,
help="Add a parameters file to use") help="Add a parameters file to use")
group_sim.add_option("", "--no-extra-ports", group_sim.add_option("", "--no-extra-ports",