From 49af90a70e65f3a5a7ab035faa07704bd38e7629 Mon Sep 17 00:00:00 2001 From: Arash Negahdar Date: Mon, 9 Nov 2020 10:49:04 -0500 Subject: [PATCH] Tools: Set SYSID based on instance number in sim_vehicle.py --- Tools/autotest/sim_vehicle.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tools/autotest/sim_vehicle.py b/Tools/autotest/sim_vehicle.py index 8d341bbfbe..6c6fc6ba66 100755 --- a/Tools/autotest/sim_vehicle.py +++ b/Tools/autotest/sim_vehicle.py @@ -714,6 +714,8 @@ def start_vehicle(binary, opts, stuff, spawns=None): c = ["-I" + str(i)] if spawns is not None: c.extend(["--home", spawns[i]]) + if opts.auto_sysid and opts.sysid is None and 0 <= i < 255: + c.extend(["--sysid", str(i + 1)]) os.chdir(i_dir) run_in_terminal_window(cmd_name, cmd + c) os.chdir(old_dir) @@ -1139,6 +1141,10 @@ group_sim.add_option("", "--slave", type='int', default=0, help="Set the number of JSON slave") +group_sim.add_option("", "--auto-sysid", + default=False, + action='store_true', + help="Set SYSID_THISMAV based upon instance number") parser.add_option_group(group_sim)