Skip to content

Commit 87e2a13

Browse files
robertlong13meee1
authored andcommitted
SITL.cs: fix some swarm regressions
- The `-P`/`--param` option throws an error now in ArduPilot (has been silently broken for years anyway; we didn't need them) - `SYSID_THISMAV` is now `MAV_SYSID` in ArduPilot (setting both in identity.parm works for old/new versions) - Driveby fix for ensuring that identity.parm is always used (wasn't in some cases)
1 parent 5a3d239 commit 87e2a13

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

GCSViews/SITL.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -875,20 +875,22 @@ public async Task StartSwarmSeperate(Firmwares firmware)
875875
var extra = " ";
876876

877877
if (!string.IsNullOrEmpty(config))
878-
extra += @" --defaults """ + config + @",identity.parm"" -P SERIAL0_PROTOCOL=2 -P SERIAL1_PROTOCOL=2 ";
878+
extra += @" --defaults """ + config + @",identity.parm"" ";
879+
else
880+
extra += @" --defaults ""identity.parm"" ";
879881

880882
var home = new PointLatLngAlt(markeroverlay.Markers[0].Position).newpos((double)NUM_heading.Value, a * 4);
881883

882884
if (max == a)
883885
{
884886
extra += String.Format(
885-
" -M{4} -s1 --home {3} --instance {0} --serial0 tcp:0 {1} -P SYSID_THISMAV={2} ",
887+
" -M{4} -s1 --home {3} --instance {0} --serial0 tcp:0 {1} ",
886888
a, "", a + 1, BuildHomeLocation(home, (int)NUM_heading.Value), model);
887889
}
888890
else
889891
{
890892
extra += String.Format(
891-
" -M{4} -s1 --home {3} --instance {0} --serial0 tcp:0 {1} -P SYSID_THISMAV={2} ",
893+
" -M{4} -s1 --home {3} --instance {0} --serial0 tcp:0 {1} ",
892894
a, "" /*"--serial2 tcpclient:127.0.0.1:" + (5770 + 10 * a)*/, a + 1,
893895
BuildHomeLocation(home, (int)NUM_heading.Value), model);
894896
}
@@ -900,6 +902,7 @@ public async Task StartSwarmSeperate(Firmwares firmware)
900902
File.WriteAllText(simdir + "identity.parm", String.Format(@"SERIAL0_PROTOCOL=2
901903
SERIAL1_PROTOCOL=2
902904
SYSID_THISMAV={0}
905+
MAV_SYSID={0}
903906
SIM_TERRAIN=0
904907
TERRAIN_ENABLE=0
905908
SCHED_LOOP_RATE=50
@@ -1021,20 +1024,22 @@ public async void StartSwarmChain()
10211024
var extra = " ";
10221025

10231026
if (!string.IsNullOrEmpty(config))
1024-
extra += @" --defaults """ + config + @",identity.parm"" -P SERIAL0_PROTOCOL=2 -P SERIAL1_PROTOCOL=2 ";
1027+
extra += @" --defaults """ + config + @",identity.parm"" ";
1028+
else
1029+
extra += @" --defaults ""identity.parm"" ";
10251030

10261031
var home = new PointLatLngAlt(markeroverlay.Markers[0].Position).newpos((double)NUM_heading.Value, a * 4);
10271032

10281033
if (max == a)
10291034
{
10301035
extra += String.Format(
1031-
" -M{4} -s1 --home {3} --instance {0} --serial0 tcp:0 {1} -P SYSID_THISMAV={2} ",
1036+
" -M{4} -s1 --home {3} --instance {0} --serial0 tcp:0 {1} ",
10321037
a, "", a + 1, BuildHomeLocation(home, (int)NUM_heading.Value), model);
10331038
}
10341039
else
10351040
{
10361041
extra += String.Format(
1037-
" -M{4} -s1 --home {3} --instance {0} --serial0 tcp:0 {1} -P SYSID_THISMAV={2} ",
1042+
" -M{4} -s1 --home {3} --instance {0} --serial0 tcp:0 {1} ",
10381043
a, "--serial2 tcpclient:127.0.0.1:" + (5772 + 10 * a), a + 1,
10391044
BuildHomeLocation(home, (int)NUM_heading.Value), model);
10401045
}
@@ -1046,6 +1051,7 @@ public async void StartSwarmChain()
10461051
File.WriteAllText(simdir + "identity.parm", String.Format(@"SERIAL0_PROTOCOL=2
10471052
SERIAL1_PROTOCOL=2
10481053
SYSID_THISMAV={0}
1054+
MAV_SYSID={0}
10491055
SIM_TERRAIN=0
10501056
TERRAIN_ENABLE=0
10511057
SCHED_LOOP_RATE=50
@@ -1076,6 +1082,8 @@ public async void StartSwarmChain()
10761082
Path.GetFileName(await exepath).Replace("C:", "/mnt/c").Replace("\\", "/").Replace(".exe", ".elf") + @"""" + " " +
10771083
extra.Replace("C:", "/mnt/c").Replace("\\", "/") + " &\nsleep .3\ncd ..\n");
10781084

1085+
log.InfoFormat("sitl: {0} {1} {2}", exestart.WorkingDirectory, exestart.FileName, exestart.Arguments);
1086+
10791087
simulator.Add(System.Diagnostics.Process.Start(exestart));
10801088
}
10811089

0 commit comments

Comments
 (0)