Skip to content

Commit

Permalink
MAVLinkInterface: revert arduplane to old guided mode
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Dec 12, 2017
1 parent 84d869e commit 4e011e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Mavlink/MAVLinkInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3039,18 +3039,23 @@ public void setGuidedModeWP(byte sysid, byte compid, Locationwp gotohere, bool s
if (setguidedmode)
{
// fix for followme change
if (MAVlist[sysid,compid].cs.mode.ToUpper() != "GUIDED")
if (MAVlist[sysid, compid].cs.mode.ToUpper() != "GUIDED")
setMode(sysid, compid, "GUIDED");
}

MainV2.comPort.setPositionTargetGlobalInt((byte)sysidcurrent, (byte)compidcurrent,
true, false, false, false, MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT_INT,
gotohere.lat, gotohere.lng, MainV2.comPort.MAV.GuidedMode.z, 0, 0, 0, 0, 0);

//MAV_MISSION_RESULT ans = setWP(sysid, compid, gotohere, 0, MAV_FRAME.GLOBAL_RELATIVE_ALT,(byte) 2);
if (MAVlist[sysid,compid].cs.firmware == MainV2.Firmwares.ArduPlane)
{
MAV_MISSION_RESULT ans = setWP(sysid, compid, gotohere, 0, MAV_FRAME.GLOBAL_RELATIVE_ALT, (byte)2);

//if (ans != MAV_MISSION_RESULT.MAV_MISSION_ACCEPTED)
//throw new Exception("Guided Mode Failed");
if (ans != MAV_MISSION_RESULT.MAV_MISSION_ACCEPTED)
throw new Exception("Guided Mode Failed");
}
else
{
setPositionTargetGlobalInt((byte)sysid, (byte)compid,
true, false, false, false, MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT_INT,
gotohere.lat, gotohere.lng, MainV2.comPort.MAV.GuidedMode.z, 0, 0, 0, 0, 0);
}
}
catch (Exception ex)
{
Expand Down
6 changes: 6 additions & 0 deletions MissionPlanner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,12 @@
<Content Include="Scripts\example1.py">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Update="Drivers\cube.cat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Drivers\Cube.inf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Drivers\signed.cer">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down

0 comments on commit 4e011e7

Please sign in to comment.