Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion GCSViews/FlightData.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions GCSViews/FlightData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4471,6 +4471,48 @@ private void PointCameraCoordsToolStripMenuItem1_Click(object sender, EventArgs
}
}

private void sendExternalPositionEstimateToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
CustomMessageBox.Show(Strings.PleaseConnect, Strings.ERROR);
return;
}

var location = MouseDownStart.Lat.ToString(CultureInfo.InvariantCulture) + ";" +
MouseDownStart.Lng.ToString(CultureInfo.InvariantCulture);
if (DialogResult.Cancel == InputBox.Show("External Position Estimate",
"Please enter the coords 'lat;lng'", ref location))
return;

var split = location.Split(';');

if (split.Length == 2 &&
double.TryParse(split[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var lat) &&
double.TryParse(split[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var lng))
{
try
{
MainV2.comPort.doCommandInt(
(byte)MainV2.comPort.sysidcurrent,
(byte)MainV2.comPort.compidcurrent,
MAVLink.MAV_CMD.EXTERNAL_POSITION_ESTIMATE,
0, 0, float.NaN, 0,
(int)(lat * 1e7),
(int)(lng * 1e7),
float.NaN);
}
catch (Exception ex)
{
CustomMessageBox.Show(Strings.CommandFailed + ex.Message, Strings.ERROR);
}
}
else
{
CustomMessageBox.Show(Strings.InvalidField, Strings.ERROR);
}
}

private void pointCameraHereToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!MainV2.comPort.BaseStream.IsOpen)
Expand Down
8 changes: 7 additions & 1 deletion GCSViews/FlightData.resx
Original file line number Diff line number Diff line change
Expand Up @@ -5479,8 +5479,14 @@
<data name="gimbalVideoToolStripMenuItem.Text" xml:space="preserve">
<value>Gimbal Video</value>
</data>
<data name="sendExternalPositionEstimateToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>187, 22</value>
</data>
<data name="sendExternalPositionEstimateToolStripMenuItem.Text" xml:space="preserve">
<value>Send External Position Estimate</value>
</data>
<data name="contextMenuStripMap.Size" type="System.Drawing.Size, System.Drawing">
<value>188, 290</value>
<value>188, 312</value>
</data>
<data name="&gt;&gt;contextMenuStripMap.Name" xml:space="preserve">
<value>contextMenuStripMap</value>
Expand Down
Loading