Tools: Set SYSID based on instance number in sim_vehicle.py

This commit is contained in:
Arash Negahdar 2020-11-09 10:49:04 -05:00 committed by Tom Pittenger
parent 554e7f8d1c
commit 49af90a70e

View File

@ -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)