From 11a56c4df102e904a1a804959500843aaa57b6d0 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Wed, 25 Jul 2012 21:44:24 +0800 Subject: [PATCH] Mission Planner 1.2 Enable Mount config screen Add Quick View (double click to change) fix mono updater issue RFD900 transmit values Mod new mavlink controls (wip) --- .../ArdupilotMegaPlanner/ArdupilotMega.csproj | 47 +- .../Controls/CustomMessageBox.cs | 1 - .../Controls/MavlinkCheckBox.cs | 82 ++ .../Controls/MavlinkComboBox.cs | 70 ++ .../Controls/MavlinkNumericUpDown.cs | 77 ++ .../Controls/QuickView.Designer.cs | 92 ++ .../Controls/QuickView.cs | 40 + .../Controls/QuickView.resx | 120 +++ Tools/ArdupilotMegaPlanner/CurrentState.cs | 5 +- .../ArdupilotMegaPlanner/FollowMe.Designer.cs | 134 +++ Tools/ArdupilotMegaPlanner/FollowMe.cs | 225 ++++ .../ArdupilotMegaPlanner/FollowMe.es-ES.resx | 123 +++ Tools/ArdupilotMegaPlanner/FollowMe.pl.resx | 131 +++ Tools/ArdupilotMegaPlanner/FollowMe.resx | 208 ++++ .../ConfigAccelerometerCalibrationQuad.cs | 2 +- .../ConfigHardwareOptions.Designer.cs | 80 +- .../ConfigHardwareOptions.resx | 297 +++++- .../GCSViews/ConfigurationView/ConfigMount.cs | 185 ++++ .../ConfigurationView/ConfigMount.designer.cs | 994 ++++++++++++++++++ .../ConfigurationView/ConfigMount.resx | 120 +++ .../GCSViews/ConfigurationView/Setup.cs | 10 +- .../GCSViews/FlightData.Designer.cs | 89 ++ .../GCSViews/FlightData.cs | 154 ++- .../GCSViews/FlightData.resx | 232 +++- .../GCSViews/Simulation.cs | 8 +- Tools/ArdupilotMegaPlanner/MainV2.cs | 3 +- Tools/ArdupilotMegaPlanner/Mavlink/MAVLink.cs | 22 +- .../Mavlink/MAVLinkTypes0.9.cs | 25 + Tools/ArdupilotMegaPlanner/Msi/installer.wxs | 48 +- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/Resources.Designer.cs | 11 + .../Properties/Resources.resx | 5 +- Tools/ArdupilotMegaPlanner/Radio/3DRradio.cs | 6 +- .../Resources/Welcome_to_Michael_Oborne.rtf | Bin 2534 -> 36337 bytes .../Utilities/ThemeManager.cs | 11 +- Tools/ArdupilotMegaPlanner/georefimage.cs | 4 +- Tools/ArdupilotMegaPlanner/temp.Designer.cs | 4 +- Tools/ArdupilotMegaPlanner/temp.cs | 2 +- 38 files changed, 3504 insertions(+), 165 deletions(-) create mode 100644 Tools/ArdupilotMegaPlanner/Controls/MavlinkCheckBox.cs create mode 100644 Tools/ArdupilotMegaPlanner/Controls/MavlinkComboBox.cs create mode 100644 Tools/ArdupilotMegaPlanner/Controls/MavlinkNumericUpDown.cs create mode 100644 Tools/ArdupilotMegaPlanner/Controls/QuickView.Designer.cs create mode 100644 Tools/ArdupilotMegaPlanner/Controls/QuickView.cs create mode 100644 Tools/ArdupilotMegaPlanner/Controls/QuickView.resx create mode 100644 Tools/ArdupilotMegaPlanner/FollowMe.Designer.cs create mode 100644 Tools/ArdupilotMegaPlanner/FollowMe.cs create mode 100644 Tools/ArdupilotMegaPlanner/FollowMe.es-ES.resx create mode 100644 Tools/ArdupilotMegaPlanner/FollowMe.pl.resx create mode 100644 Tools/ArdupilotMegaPlanner/FollowMe.resx create mode 100644 Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.cs create mode 100644 Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.designer.cs create mode 100644 Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.resx diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index dbe1bbcf92..9818ba766e 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -251,6 +251,21 @@ MainSwitcher.cs + + Component + + + Component + + + Component + + + UserControl + + + QuickView.cs + UserControl @@ -258,6 +273,12 @@ ConfigAP_Limits.cs + + UserControl + + + ConfigMount.cs + UserControl @@ -462,11 +483,11 @@ - + Form - - SerialInput.cs + + FollowMe.cs Firmware.cs @@ -661,6 +682,9 @@ OpenGLtest.cs + + QuickView.cs + ConfigAccelerometerCalibrationQuad.cs @@ -841,6 +865,9 @@ ConfigAP_Limits.cs + + ConfigMount.cs + Setup.cs @@ -893,14 +920,14 @@ RAW_Sensor.cs - - SerialInput.cs + + FollowMe.cs - - SerialInput.cs + + FollowMe.cs - - SerialInput.cs + + FollowMe.cs Firmware.cs @@ -1209,6 +1236,7 @@ + @@ -1285,7 +1313,6 @@ true - "$(TargetDir)version.exe" "$(TargetPath)" > "$(TargetDir)version.txt" diff --git a/Tools/ArdupilotMegaPlanner/Controls/CustomMessageBox.cs b/Tools/ArdupilotMegaPlanner/Controls/CustomMessageBox.cs index e6e11168ac..ec35999fb3 100644 --- a/Tools/ArdupilotMegaPlanner/Controls/CustomMessageBox.cs +++ b/Tools/ArdupilotMegaPlanner/Controls/CustomMessageBox.cs @@ -60,7 +60,6 @@ namespace System.Windows.Forms Width = textSize.Width + 50, Height = textSize.Height + 100, TopMost = true, - TopLevel = true }; Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle); diff --git a/Tools/ArdupilotMegaPlanner/Controls/MavlinkCheckBox.cs b/Tools/ArdupilotMegaPlanner/Controls/MavlinkCheckBox.cs new file mode 100644 index 0000000000..c81eb7a76c --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/MavlinkCheckBox.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Collections; + +namespace ArdupilotMega.Controls +{ + public class MavlinkCheckBox : CheckBox + { + [System.ComponentModel.Browsable(true)] + public float OnValue { get; set; } + + [System.ComponentModel.Browsable(true)] + public float OffValue { get; set; } + + [System.ComponentModel.Browsable(true)] + public string ParamName { get; set; } + + [System.ComponentModel.Browsable(true)] + public Hashtable param { get; set; } + + public MavlinkCheckBox() + { + OnValue = 1; + OffValue = 0; + + this.Enabled = false; + } + + public void setup(float OnValue, float OffValue, string paramname, Hashtable paramlist) + { + base.CheckedChanged -= MavlinkCheckBox_CheckedChanged; + + this.OnValue = OnValue; + this.OffValue = OffValue; + this.ParamName = paramname; + this.param = paramlist; + + if (paramlist.ContainsKey(paramname)) + { + this.Enabled = true; + + if ((float)paramlist[paramname] == OnValue) + { + this.Checked = true; + } + else if ((float)paramlist[paramname] == OffValue) + { + this.Checked = false; + } + else + { + this.CheckState = System.Windows.Forms.CheckState.Indeterminate; + } + } + + base.CheckedChanged += new EventHandler(MavlinkCheckBox_CheckedChanged); + } + + void MavlinkCheckBox_CheckedChanged(object sender, EventArgs e) + { + if (this.Checked) + { + if (!MainV2.comPort.setParam(ParamName, OnValue)) + { + CustomMessageBox.Show("Set "+ParamName + " Failed!"); + } + } + else + { + if (!MainV2.comPort.setParam(ParamName, OffValue)) + { + CustomMessageBox.Show("Set " + ParamName + " Failed!"); + } + } + } + + + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/MavlinkComboBox.cs b/Tools/ArdupilotMegaPlanner/Controls/MavlinkComboBox.cs new file mode 100644 index 0000000000..05ee26a1a0 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/MavlinkComboBox.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Collections; + +namespace ArdupilotMega.Controls +{ + public class MavlinkComboBox : ComboBox + { + public new event EventHandler SelectedIndexChanged; + + [System.ComponentModel.Browsable(true)] + public string ParamName { get; set; } + + [System.ComponentModel.Browsable(true)] + public Hashtable param { get; set; } + + Type _source; + string paramname2 = ""; + + public MavlinkComboBox() + { + this.Enabled = false; + this.DropDownStyle = ComboBoxStyle.DropDownList; + } + + public void setup(Type source, string paramname, Hashtable paramlist, string paramname2 = "") + { + base.SelectedIndexChanged -= MavlinkComboBox_SelectedIndexChanged; + + _source = source; + + this.DataSource = Enum.GetNames(source); + + this.ParamName = paramname; + this.param = paramlist; + this.paramname2 = paramname2; + + if (paramlist.ContainsKey(paramname)) + { + this.Enabled = true; + + this.Text = Enum.GetName(source, (Int32)(float)paramlist[paramname]); + } + + base.SelectedIndexChanged += new EventHandler(MavlinkComboBox_SelectedIndexChanged); + } + + void MavlinkComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + if (this.SelectedIndexChanged != null) + this.SelectedIndexChanged(sender,e); + + if (!MainV2.comPort.setParam(ParamName, (float)(Int32)Enum.Parse(_source, this.Text))) + { + CustomMessageBox.Show("Set " + ParamName + " Failed!"); + } + + if (paramname2 != "") + { + if (!MainV2.comPort.setParam(paramname2, (float)(Int32)Enum.Parse(_source, this.Text) > 0 ? 1: 0)) + { + CustomMessageBox.Show("Set " + paramname2 + " Failed!"); + } + } + } + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/MavlinkNumericUpDown.cs b/Tools/ArdupilotMegaPlanner/Controls/MavlinkNumericUpDown.cs new file mode 100644 index 0000000000..6b8c1fcb4e --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/MavlinkNumericUpDown.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Collections; + +namespace ArdupilotMega.Controls +{ + public class MavlinkNumericUpDown : NumericUpDown + { + [System.ComponentModel.Browsable(true)] + public float Min { get; set; } + + [System.ComponentModel.Browsable(true)] + public float Max { get; set; } + + [System.ComponentModel.Browsable(true)] + public string ParamName { get; set; } + + [System.ComponentModel.Browsable(true)] + public Hashtable param { get; set; } + + float _scale = 1; + + + public MavlinkNumericUpDown() + { + Min = 0; + Max = 1; + + this.Enabled = false; + } + + public void setup(float Min, float Max, float Scale, float Increment, string paramname, Hashtable paramlist) + { + this.ValueChanged -= MavlinkNumericUpDown_ValueChanged; + + _scale = Scale; + this.Minimum = (decimal)(Min); + this.Maximum = (decimal)(Max); + this.Increment = (decimal)(Increment); + this.ParamName = paramname; + this.param = paramlist; + + if (paramlist.ContainsKey(paramname)) + { + this.Enabled = true; + + decimal value = (decimal)((float)paramlist[paramname] / _scale); + + if (value < this.Minimum) + this.Minimum = value; + if (value > this.Maximum) + this.Maximum = value; + + this.Value = value; + + } + else + { + this.Enabled = false; + } + + this.ValueChanged += new EventHandler(MavlinkNumericUpDown_ValueChanged); + } + + void MavlinkNumericUpDown_ValueChanged(object sender, EventArgs e) + { + if (!MainV2.comPort.setParam(ParamName, (float)this.Value * _scale)) + { + CustomMessageBox.Show("Set " + ParamName + " Failed!"); + } + } + + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/QuickView.Designer.cs b/Tools/ArdupilotMegaPlanner/Controls/QuickView.Designer.cs new file mode 100644 index 0000000000..63a734a0c6 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/QuickView.Designer.cs @@ -0,0 +1,92 @@ +namespace ArdupilotMega.Controls +{ + partial class QuickView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.labelWithPseudoOpacity1 = new ArdupilotMega.Controls.LabelWithPseudoOpacity(); + this.labelWithPseudoOpacity2 = new ArdupilotMega.Controls.LabelWithPseudoOpacity(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // labelWithPseudoOpacity1 + // + this.labelWithPseudoOpacity1.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelWithPseudoOpacity1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelWithPseudoOpacity1.Location = new System.Drawing.Point(3, 0); + this.labelWithPseudoOpacity1.Name = "labelWithPseudoOpacity1"; + this.labelWithPseudoOpacity1.Size = new System.Drawing.Size(161, 55); + this.labelWithPseudoOpacity1.TabIndex = 0; + this.labelWithPseudoOpacity1.Text = "Altitude:"; + this.labelWithPseudoOpacity1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // labelWithPseudoOpacity2 + // + this.labelWithPseudoOpacity2.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelWithPseudoOpacity2.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelWithPseudoOpacity2.Location = new System.Drawing.Point(170, 0); + this.labelWithPseudoOpacity2.Name = "labelWithPseudoOpacity2"; + this.labelWithPseudoOpacity2.Size = new System.Drawing.Size(162, 55); + this.labelWithPseudoOpacity2.TabIndex = 1; + this.labelWithPseudoOpacity2.Text = "0.0"; + this.labelWithPseudoOpacity2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.labelWithPseudoOpacity2, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.labelWithPseudoOpacity1, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(335, 55); + this.tableLayoutPanel1.TabIndex = 2; + // + // QuickView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "QuickView"; + this.Size = new System.Drawing.Size(335, 55); + this.tableLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private LabelWithPseudoOpacity labelWithPseudoOpacity1; + private LabelWithPseudoOpacity labelWithPseudoOpacity2; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/QuickView.cs b/Tools/ArdupilotMegaPlanner/Controls/QuickView.cs new file mode 100644 index 0000000000..17dd200929 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/QuickView.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ArdupilotMega.Controls +{ + public partial class QuickView : UserControl + { + [System.ComponentModel.Browsable(true)] + public string desc { get { return labelWithPseudoOpacity1.Text; } set { labelWithPseudoOpacity1.Text = value; } } + [System.ComponentModel.Browsable(true)] + public string number { get { return labelWithPseudoOpacity2.Text; } set { labelWithPseudoOpacity2.Text = value; } } + [System.ComponentModel.Browsable(true)] + public Color numberColor { get { return labelWithPseudoOpacity2.ForeColor; } set { labelWithPseudoOpacity2.ForeColor = value; } } + + public QuickView() + { + InitializeComponent(); + + labelWithPseudoOpacity1.DoubleClick += new EventHandler(labelWithPseudoOpacity1_DoubleClick); + labelWithPseudoOpacity2.DoubleClick += new EventHandler(labelWithPseudoOpacity2_DoubleClick); + } + + void labelWithPseudoOpacity2_DoubleClick(object sender, EventArgs e) + { + this.OnDoubleClick(e); + } + + void labelWithPseudoOpacity1_DoubleClick(object sender, EventArgs e) + { + this.OnDoubleClick(e); + } + + } +} diff --git a/Tools/ArdupilotMegaPlanner/Controls/QuickView.resx b/Tools/ArdupilotMegaPlanner/Controls/QuickView.resx new file mode 100644 index 0000000000..7080a7d118 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/Controls/QuickView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/CurrentState.cs b/Tools/ArdupilotMegaPlanner/CurrentState.cs index e48233ea7a..3081049fb1 100644 --- a/Tools/ArdupilotMegaPlanner/CurrentState.cs +++ b/Tools/ArdupilotMegaPlanner/CurrentState.cs @@ -132,7 +132,7 @@ namespace ArdupilotMega public float nav_bearing { get; set; } public float target_bearing { get; set; } public float wp_dist { get { return (_wpdist * multiplierdist); } set { _wpdist = value; } } - public float alt_error { get { return _alt_error * multiplierdist; } set { if (_alt_error == value) return; _alt_error = value; _targetalt = _targetalt * 0.5f + (float)Math.Round(alt + alt_error, 0) * 0.5f; Console.WriteLine(_targetalt); } } + public float alt_error { get { return _alt_error * multiplierdist; } set { if (_alt_error == value) return; _alt_error = value; _targetalt = _targetalt * 0.5f + (float)Math.Round(alt + alt_error, 0) * 0.5f; } } public float ber_error { get { return (target_bearing - yaw); } set { } } public float aspd_error { get { return _aspd_error * multiplierspeed; } set { if (_aspd_error == value) return; _aspd_error = value; _targetairspeed = _targetairspeed * 0.5f + (float)Math.Round(airspeed + aspd_error / 100, 0) * 0.5f; } } public float xtrack_error { get; set; } @@ -594,9 +594,6 @@ namespace ArdupilotMega case (byte)(100 + Common.ac2modes.LAND): mode = EnumTranslator.GetDisplayText(Common.ac2modes.LAND); break; - case (byte)(100 + Common.ac2modes.APPROACH): - mode = EnumTranslator.GetDisplayText(Common.ac2modes.APPROACH); - break; case (byte)(100 + Common.ac2modes.POSITION): mode = EnumTranslator.GetDisplayText(Common.ac2modes.POSITION); break; diff --git a/Tools/ArdupilotMegaPlanner/FollowMe.Designer.cs b/Tools/ArdupilotMegaPlanner/FollowMe.Designer.cs new file mode 100644 index 0000000000..fcb1076ade --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/FollowMe.Designer.cs @@ -0,0 +1,134 @@ +namespace ArdupilotMega +{ + partial class FollowMe + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FollowMe)); + this.CMB_serialport = new System.Windows.Forms.ComboBox(); + this.BUT_connect = new ArdupilotMega.Controls.MyButton(); + this.CMB_baudrate = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.LBL_location = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // CMB_serialport + // + this.CMB_serialport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CMB_serialport.FormattingEnabled = true; + this.CMB_serialport.Location = new System.Drawing.Point(13, 13); + this.CMB_serialport.Name = "CMB_serialport"; + this.CMB_serialport.Size = new System.Drawing.Size(121, 21); + this.CMB_serialport.TabIndex = 0; + // + // BUT_connect + // + this.BUT_connect.Location = new System.Drawing.Point(279, 12); + this.BUT_connect.Name = "BUT_connect"; + this.BUT_connect.Size = new System.Drawing.Size(75, 23); + this.BUT_connect.TabIndex = 1; + this.BUT_connect.Text = "Connect"; + this.BUT_connect.UseVisualStyleBackColor = true; + this.BUT_connect.Click += new System.EventHandler(this.BUT_connect_Click); + // + // CMB_baudrate + // + this.CMB_baudrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CMB_baudrate.FormattingEnabled = true; + this.CMB_baudrate.Items.AddRange(new object[] { + "4800", + "9600", + "14400", + "19200", + "28800", + "38400", + "57600", + "115200"}); + this.CMB_baudrate.Location = new System.Drawing.Point(140, 12); + this.CMB_baudrate.Name = "CMB_baudrate"; + this.CMB_baudrate.Size = new System.Drawing.Size(121, 21); + this.CMB_baudrate.TabIndex = 2; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(90, 47); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(187, 13); + this.label1.TabIndex = 3; + this.label1.Text = "Pick the Nmea gps port and baud rate\r\n"; + // + // LBL_location + // + this.LBL_location.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LBL_location.Location = new System.Drawing.Point(3, 64); + this.LBL_location.Name = "LBL_location"; + this.LBL_location.Size = new System.Drawing.Size(365, 59); + this.LBL_location.TabIndex = 4; + this.LBL_location.Text = "0,0,0"; + // + // textBox1 + // + this.textBox1.Enabled = false; + this.textBox1.Location = new System.Drawing.Point(19, 126); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(335, 133); + this.textBox1.TabIndex = 5; + this.textBox1.Text = resources.GetString("textBox1.Text"); + // + // SerialInput + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(369, 300); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.LBL_location); + this.Controls.Add(this.label1); + this.Controls.Add(this.CMB_baudrate); + this.Controls.Add(this.BUT_connect); + this.Controls.Add(this.CMB_serialport); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "SerialInput"; + this.Text = "Follow Me"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SerialOutput_FormClosing); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ComboBox CMB_serialport; + private ArdupilotMega.Controls.MyButton BUT_connect; + private System.Windows.Forms.ComboBox CMB_baudrate; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label LBL_location; + private System.Windows.Forms.TextBox textBox1; + } +} \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/FollowMe.cs b/Tools/ArdupilotMegaPlanner/FollowMe.cs new file mode 100644 index 0000000000..7365059476 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/FollowMe.cs @@ -0,0 +1,225 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.IO.Ports; + +namespace ArdupilotMega +{ + public partial class FollowMe : Form + { + System.Threading.Thread t12; + static bool threadrun = false; + static internal SerialPort comPort = new SerialPort(); + static internal PointLatLngAlt lastgotolocation = new PointLatLngAlt(0, 0, 0, "Goto last"); + static internal PointLatLngAlt gotolocation = new PointLatLngAlt(0, 0, 0, "Goto"); + static internal int intalt = 100; + + public FollowMe() + { + InitializeComponent(); + + CMB_serialport.DataSource = SerialPort.GetPortNames(); + + if (threadrun) + { + BUT_connect.Text = "Stop"; + } + } + + private void BUT_connect_Click(object sender, EventArgs e) + { + if (comPort.IsOpen) + { + threadrun = false; + comPort.Close(); + BUT_connect.Text = "Connect"; + } + else + { + try + { + comPort.PortName = CMB_serialport.Text; + } + catch { CustomMessageBox.Show("Invalid PortName"); return; } + try { + comPort.BaudRate = int.Parse(CMB_baudrate.Text); + } catch {CustomMessageBox.Show("Invalid BaudRate"); return;} + try { + comPort.Open(); + } catch {CustomMessageBox.Show("Error Connecting\nif using com0com please rename the ports to COM??"); return;} + + + string alt = "100"; + + if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2) + { + alt = (10 * MainV2.cs.multiplierdist).ToString("0"); + } + else + { + alt = (100 * MainV2.cs.multiplierdist).ToString("0"); + } + if (DialogResult.Cancel == Common.InputBox("Enter Alt", "Enter Alt (relative to home alt)", ref alt)) + return; + + intalt = (int)(100 * MainV2.cs.multiplierdist); + if (!int.TryParse(alt, out intalt)) + { + CustomMessageBox.Show("Bad Alt"); + return; + } + + t12 = new System.Threading.Thread(new System.Threading.ThreadStart(mainloop)) + { + IsBackground = true, + Name = "Nmea Input" + }; + t12.Start(); + + BUT_connect.Text = "Stop"; + } + } + + void mainloop() + { + DateTime nextsend = DateTime.Now; + + threadrun = true; + while (threadrun) + { + try + { + string line = comPort.ReadLine(); + + //string line = string.Format("$GP{0},{1:HHmmss},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},", "GGA", DateTime.Now.ToUniversalTime(), Math.Abs(lat * 100), MainV2.cs.lat < 0 ? "S" : "N", Math.Abs(lng * 100), MainV2.cs.lng < 0 ? "W" : "E", MainV2.cs.gpsstatus, MainV2.cs.satcount, MainV2.cs.gpshdop, MainV2.cs.alt, "M", 0, "M", ""); + if (line.StartsWith("$GPGGA")) // + { + string[] items = line.Trim().Split(',','*'); + + if (items[15] != GetChecksum(line.Trim())) + { + Console.WriteLine("Bad Nmea line " + items[15] + " vs " + GetChecksum(line.Trim())); + continue; + } + + if (items[6] == "0") + { + Console.WriteLine("No Fix"); + continue; + } + + gotolocation.Lat = double.Parse(items[2]) / 100.0; + + gotolocation.Lat = (int)gotolocation.Lat + ((gotolocation.Lat - (int)gotolocation.Lat) / 0.60); + + if (items[3] == "S") + gotolocation.Lat *= -1; + + gotolocation.Lng = double.Parse(items[4]) / 100.0; + + gotolocation.Lng = (int)gotolocation.Lng + ((gotolocation.Lng - (int)gotolocation.Lng) / 0.60); + + if (items[5] == "W") + gotolocation.Lng *= -1; + + gotolocation.Alt = intalt; // double.Parse(line.Substring(c9, c10 - c9 - 1)) + + + gotolocation.Tag = "Sats "+ items[7] + " hdop " + items[8] ; + + } + + + if (DateTime.Now > nextsend && gotolocation.Lat != 0 && gotolocation.Lng != 0 && gotolocation.Alt != 0) // 200 * 10 = 2 sec /// lastgotolocation != gotolocation && + { + nextsend = DateTime.Now.AddSeconds(2); + Console.WriteLine("Sending follow wp " +DateTime.Now.ToString("h:MM:ss")+" "+ gotolocation.Lat + " " + gotolocation.Lng + " " +gotolocation.Alt); + lastgotolocation = new PointLatLngAlt(gotolocation); + + Locationwp gotohere = new Locationwp(); + + gotohere.id = (byte)MAVLink.MAV_CMD.WAYPOINT; + gotohere.alt = (float)(gotolocation.Alt); + gotohere.lat = (float)(gotolocation.Lat); + gotohere.lng = (float)(gotolocation.Lng); + + try + { + updateLocationLabel(gotohere); + } + catch { } + + if (MainV2.comPort.BaseStream.IsOpen && MainV2.giveComport == false) + { + try + { + MainV2.giveComport = true; + + MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT, (byte)2); + + GCSViews.FlightData.GuidedModeWP = new PointLatLngAlt(gotohere); + + MainV2.giveComport = false; + } + catch { MainV2.giveComport = false; } + } + } + } + catch { System.Threading.Thread.Sleep(2000); } + } + } + + private void updateLocationLabel(Locationwp plla) + { + this.BeginInvoke((MethodInvoker)delegate + { + LBL_location.Text = gotolocation.Lat + " " + gotolocation.Lng + " " + gotolocation.Alt +" "+ gotolocation.Tag; + } + ); + + } + + private void SerialOutput_FormClosing(object sender, FormClosingEventArgs e) + { + } + + // Calculates the checksum for a sentence + string GetChecksum(string sentence) + { + // Loop through all chars to get a checksum + int Checksum = 0; + foreach (char Character in sentence.ToCharArray()) + { + switch (Character) + { + case '$': + // Ignore the dollar sign + break; + case '*': + // Stop processing before the asterisk + return Checksum.ToString("X2"); + default: + // Is this the first value for the checksum? + if (Checksum == 0) + { + // Yes. Set the checksum to the value + Checksum = Convert.ToByte(Character); + } + else + { + // No. XOR the checksum with this character's value + Checksum = Checksum ^ Convert.ToByte(Character); + } + break; + } + } + // Return the checksum formatted as a two-character hexadecimal + return Checksum.ToString("X2"); + } + + } +} diff --git a/Tools/ArdupilotMegaPlanner/FollowMe.es-ES.resx b/Tools/ArdupilotMegaPlanner/FollowMe.es-ES.resx new file mode 100644 index 0000000000..4d14dfe4ec --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/FollowMe.es-ES.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Lo que esto hace. 1. se las actuales coordenadas GPS de un GPS NMEA. 2. envía un WP modo guiado a la AP cada 2 segundos. Como Usar 1. conectar con la AP. 2. el despegue, el modo de prueba guiada está trabajando. 3. abrir este y escoja su puerto com, y la velocidad de su NMEA GPS. 4. ahora debe estar siguiéndote. + + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/FollowMe.pl.resx b/Tools/ArdupilotMegaPlanner/FollowMe.pl.resx new file mode 100644 index 0000000000..bb1f84d234 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/FollowMe.pl.resx @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + What this does. +1. gets the current gps coords from a nmea gps. +2. sends a guided mode WP to the AP every 2 seconds. + +How to use it +1. connect to ap. +2. take off, test guided mode is working. +3. open this and pick your comport, and baud rate for your nmea gps. +4. it should now be following you. + + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/FollowMe.resx b/Tools/ArdupilotMegaPlanner/FollowMe.resx new file mode 100644 index 0000000000..62276c20c7 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/FollowMe.resx @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + What this does. +1. gets the current gps coords from a nmea gps. +2. sends a guided mode WP to the AP every 2 seconds. + +How to use it +1. connect to ap. +2. take off, test guided mode is working. +3. open this and pick your comport, and baud rate for your nmea gps. +4. it should now be following you. + + + + + AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAAAAAA + AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADOxkjAtnoOAKpJ4vyiK + c+8nh3D/J4Zv/yeHcP8oi3PvKpJ4vy6fg4AzsZIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADjGo2AyspPfLZ+D/yiQ + d/8hlXj/G6F9/xeqg/8XqYL/GKqD/xuhfv8ilnn/KZB3/y2fhP8yspPfN8ajYAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADvRrDA1vpzfL6uN/yel + hP8XvJD/DMyY/wfQl/8FzJP/A8qS/wPJkf8EypL/BsyU/wnRmP8PzZn/Gb2R/yemhP8tqoz/Mb2a3zbQ + qkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAA4y6ZgMbWV/yin + iP8WwZP/Btqf/wDPlf8AyI7/A8aP/yfNnv9T2LP/UNax/03XsP8506b/G8ya/wHKkf8F0Zf/CNuf/xLB + kv8fpYT/J7KQ/y7IomAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAANcajny+w + kf8hqoj/CNSd/wDRlf8Axor/Hcyd/3Lhwf+p7Nj/o+vV/57m0/+X5dD/k+TN/4/jzf+K5Mz/fuHH/0PW + rf8HzJT/ANCT/wDRlv8OpX//HayI/yrFn58AAAAAAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAADDC + nmAtro7/H62J/wPWmv8Ay47/AMaO/3XhxP+e6tT/mObP/5Pjy/+Q4sr/jODJ/4ffx/+C3MT/f9vC/3nb + wf9y2r7/adq7/2DauP8ZzZv/Fdae/8T/9/9WxKj/HKuI/y7IomAAAAAAAAAAAAAAAAD///8AAAAAAAAA + AAAiuZMwKKyM/x6ohf8C1Zr/AMmL/wHGjv+49OL///////////9+3ML/f9zD/4Dcwv9+28L/e9rA/3bZ + vv9w1rr/Z9S4/17Rs/9Qz63/Qcyn/3LewP////////////n///8MpH7/JbKP/zXQqUAAAAAAAAAAAP// + /wAAAAAAAAAAABymhN8dnn//BNGa/wDKjP8AxY3/sfHf/////////////////2nXt/9w1rv/c9e8/3TX + vP9x17z/a9W5/2TTtf9Y0K//SMyp/zXFoP9i07X/////////////////f/LR/wDQlf8epYT/Mb2a3wAA + AAAAAAAA////AAAAAAADlnJgFZR1/wq4iv8AzpH/AMCD/4rmzf//////////////////////WdGv/2PU + tf9p1rf/atS4/2nUtv9i0rT/Vc+u/0fKpv8zxZz/Ws+w//////////////////////8GyJL/ANCS/xLB + kv8tq4z/OMajYAAAAAD///8AAAAAAACHZt8NkW//ANKV/wDChP9i27r//////////////////////9Dx + 6P9MzKn/Vc+v/17Rsv9g0rP/XNCx/1XNrv9Fyaf/McSd/1fPr///////////////////////QM2m/ynK + oP8JzJX/C9yh/ymmhf80spPfAAAAAP///wAAcUwwAHtc/wCrfP8AyIv/AMKK//////////////////// + /////////////5Dgyv9Gyqb/TMyq/07Nq/9MzKn/Qcmj/y/Fnf9Wzq3//////////////////////57k + 0v8av5T/Lceg/yzOo/8M05v/Hr6T/zCghf80spIw////AABoRYAAclT/AL2H/wDBhf9R1rL///////// + ////////4vfw//////////////////H8+P9KzKn/Ocah/zTFnv8qwpj/Us2t//////////////////// + ////////DLqM/yDBlv8wxp//OM6m/xPPm/8Xz53/LZF5/y+fg4////8AAGNAvwB7Wf8Aw4j/ALyC/4bj + yP+g5tL/g93E/2HSsv9Pzqz/Us6s//////////////////////9Yzq//Gr2S/0jLp/////////////// + /////////////yrDm/8SvI//JMGY/zDHn/81zKT/Is2e/xTUnf8nl3v/LJJ5v////wAAXz3vAIlg/wDA + hf8AuoD/quzZ/5Hjyv9628D/ada2/1jRsP9Jy6f/a9a4//////////////////////+Y4s7///////// + //////////////////+c4tD/AbaH/xW8kf8jwZj/LcWd/y/Jn/8kzJ3/E9Ca/yGjgf8ri3Tv////AABd + PP8Ak2b/AL6D/w/Ekv+m6tf/j+HJ/3vawP9p1rf/W9Gx/0rNqf85yJ//Nsaf//////////////////// + /////////////////////////////wCwe/8AtoT/ELqP/xu+k/8jwZj/KMeb/yHKm/8QzZf/HqyG/ymI + cf////8AAF07/wCSZP8AvYL/GMWU/6Dn1P+K38f/ddi+/27Wuf+E3MX/leHN/6fm1f+l5tX/neLQ//// + ////////////////////////////////////////j9/J/27Vuv9Tzq7/JsKY/xa/kv8aw5T/FcaW/wvL + lf8aqoT/J4dw/////wAAXTv/AJFk/wC9gP8GwY3/mObQ/5rkz/+26dv/y/Hl/8Dt3/+06tz/pebV/5bg + zP+g5NL//////////////v///f7+//7+/v//////7fn2////////////tOnb/6Ll0v+v6Nj/jeDI/zXK + o/8IxJD/BMqS/xaqgv8lh2//////AABeO+8AgVf/AL1//wDBif/R9uv/1PPq/8Tv5P+36t3/rujY/6Lk + 0v+U4cv/jt7J//j8+///////+/38//f8+//2+/r/+Pz7//3+/v/m9/P/9Pv6//D6+P9/28L/jd7J/5jj + z/+h5dL/qOvX/4Hmyf8f1J//E596/yOJcO////8AAGA8vwB3U/8p06P/hufM/8Ty5f/D7+T/s+vb/6bm + 1P+c4c//j9/K/4vcyP/t+fb///7///j8/P/0+/r/8vr5//P7+f/1+/r/+/39///////i9fL/ZNO1/3HW + vP992sH/htzG/4vhyv+S5dD/mO7W/6X74v80noT/Io90v////wAAZkCAAHla/33ny/945cb/nunV/7Xr + 3v+l5tT/luDN/4ndxv992cL/1vLq//v9/P/1+/n/8vv4//L69//z+/j/9Pv5/7Xo2//x+vn///////// + //+y59n/aNS3/3LWvP932r//fNzD/4Ljyf+J7ND/l/bd/yORdf8knH6A////AABuRzAAdlT/Xc6x/23o + xv9s4MH/qurZ/5jiz/+I3cb/edjA/8ju5f/3/Pv/8vv4//H6+P/y+/j/6/f0/7np3v/7/fz//v7+/6fk + 1f+56tz///////////9h0bT/aNW4/23Wu/9v3L//dOLG/37w0f9m1rn/Hpt8/ymujTD///8AAAAAAACD + X98po4X/Z+7K/1vgvP+A4sf/jOHK/3rZwv+r59f/9Pv6/+/69//v+vf/8vr4/9fy6/9n0rf/VM6t/6Di + 0v/N7+f/adO4/1PMrf9t1Lr/i9zI/1/Rs/9h0rX/ZNe4/2bbvf9s5sb/ePfV/z2ylf8lrozfAAAAAP// + /wAAAAAAAJNsYAWQbf9U1rP/Vee//0rYsf993sb/pebV//P7+v/s+Pb/6/f1/+749v+s5tj/Vc2u/1jP + r/9ZzrD/btW5/1bOr/9Wza//Vs6v/1fOr/9Z0LD/WdCy/1vTtP9d1rX/Xt+8/2btyP9k4L//IaaF/y7D + nmAAAAAA////AAAAAAAAAAAAD6J9zyCjgv9S68L/P9+0/2Pevv/5////7/v6/+v59//j9/L/gtvF/1PN + r/9Wz7D/Wc+x/1nQsf9Zz7H/WM6w/1fPsP9UzrD/VM+w/1TPrv9U0a//U9Oy/1Tatv9Z5sD/Y/LL/zSx + lP8qupbPAAAAAAAAAAD///8AAAAAAAAAAAAYto4wGaeE/y23lP8+5rn/6/////j////w//3/ve/i/2bV + uP9Tzq7/Vc+v/1jPsP9Z0LL/WM+w/1fOsf9Wz7D/Us2w/1HOrf9Qzq3/T9Cu/0zSr/9M2LP/TeC5/1bt + xP9HxaX/KLKQ/zTPqDAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAkvpdgG6iF/y++m//e/////P///3rl + yf9G0K3/VdKy/1bPsf9Wz7H/Vs6w/1bPsP9Sza//Ucyu/0/Nrf9NzKz/S82s/0fOrP9G0a7/QdWv/0Le + tP9I6L7/Q8Ok/yitjP8yyKJgAAAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAmwJlgG6iF/yK3 + kP8k3q7/H9el/x7Pn/8tzKT/Q9Cs/1HQsP9Q0K7/TM6u/0nMrf9Hzaz/RMyp/0LNqf8+zqn/ONGo/zTV + qf833rD/O+S4/zvCof8orIv/MMSfYAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAA + AAAkvpdgG6iE/xukgv8gy53/HNql/xzRn/8czJz/HcmZ/yXJnP8qyp7/Lcqg/yzLn/8nypz/JMqc/yTO + n/8l1KT/KN2r/y3Tpv8nq4n/JaqJ/yzAm2AAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAato8wFKN/zxCScv8RnHn/DbqM/wjIlP8GyZT/BsaS/wbFkf8GxZH/B8WR/wfH + k/8IypX/DMmV/xG3jP8WoX3/Fph2/xqkgs8ft5EwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJVvYACGZM8Aelr/AHlZ/wCFX/8AiWL/AJlr/wCb + bP8AlGf/AI5k/wB/W/8AeFj/AHtb/wCHZd8ClXBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwSzAAaESAAGI/vwBf + Pd8AXTz/AF08/wBdPP8AXz3fAGJAvwBoRIAAcUswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A/+AD//+AAP/+AAA//AAAH/gAAA/wAAAH4AAAA+AAAAPAAAABwAAAAYAA + AACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAwAAAAcAAAAHgAAAD4AAAA/AA + AAf4AAAP/AAAH/4AAD//gAD//+AD//////8= + + + \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs index 84ad9c6cbb..4ec5d82ec7 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigAccelerometerCalibrationQuad.cs @@ -28,7 +28,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView int fixme; // needs to be accel only MainV2.comPort.doCommand(MAVLink.MAV_CMD.PREFLIGHT_CALIBRATION,1,1,1,1,1,1,1); #else - log.Info("Sending level command (mavlink 0.9)"); + Log.Info("Sending level command (mavlink 0.9)"); MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_CALIBRATE_ACC); #endif diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.Designer.cs index 474d57dc7d..e19b256377 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.Designer.cs @@ -45,6 +45,14 @@ this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.BUT_MagCalibrationLog = new ArdupilotMega.Controls.MyButton(); this.CHK_autodec = new System.Windows.Forms.CheckBox(); + this.label5 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label2 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); @@ -170,23 +178,79 @@ this.CHK_autodec.UseVisualStyleBackColor = true; this.CHK_autodec.CheckedChanged += new System.EventHandler(this.CHK_autodec_CheckedChanged); // + // label5 + // + resources.ApplyResources(this.label5, "label5"); + this.label5.ForeColor = System.Drawing.SystemColors.ControlText; + this.label5.Name = "label5"; + // + // groupBox2 + // + resources.ApplyResources(this.groupBox2, "groupBox2"); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.TabStop = false; + // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.label1.ForeColor = System.Drawing.SystemColors.ControlText; + this.label1.Name = "label1"; + // + // groupBox1 + // + resources.ApplyResources(this.groupBox1, "groupBox1"); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.TabStop = false; + // + // label2 + // + resources.ApplyResources(this.label2, "label2"); + this.label2.ForeColor = System.Drawing.SystemColors.ControlText; + this.label2.Name = "label2"; + // + // groupBox3 + // + resources.ApplyResources(this.groupBox3, "groupBox3"); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.TabStop = false; + // + // label3 + // + resources.ApplyResources(this.label3, "label3"); + this.label3.ForeColor = System.Drawing.SystemColors.ControlText; + this.label3.Name = "label3"; + // + // groupBox4 + // + resources.ApplyResources(this.groupBox4, "groupBox4"); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.TabStop = false; + // // ConfigHardwareOptions // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.CHK_enableoptflow); + this.Controls.Add(this.label3); + this.Controls.Add(this.groupBox4); + this.Controls.Add(this.CHK_enableairspeed); + this.Controls.Add(this.label2); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.CHK_enablesonar); + this.Controls.Add(this.label1); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.CHK_enablecompass); + this.Controls.Add(this.label5); + this.Controls.Add(this.groupBox2); this.Controls.Add(this.CHK_autodec); this.Controls.Add(this.BUT_MagCalibrationLog); this.Controls.Add(this.BUT_MagCalibrationLive); this.Controls.Add(this.label27); this.Controls.Add(this.CMB_sonartype); - this.Controls.Add(this.CHK_enableoptflow); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.linkLabelmagdec); this.Controls.Add(this.label100); this.Controls.Add(this.TXT_declination); - this.Controls.Add(this.CHK_enableairspeed); - this.Controls.Add(this.CHK_enablesonar); - this.Controls.Add(this.CHK_enablecompass); this.Controls.Add(this.pictureBox4); this.Controls.Add(this.pictureBox3); this.Controls.Add(this.pictureBox1); @@ -218,5 +282,13 @@ private System.Windows.Forms.PictureBox pictureBox1; private ArdupilotMega.Controls.MyButton BUT_MagCalibrationLog; private System.Windows.Forms.CheckBox CHK_autodec; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.GroupBox groupBox4; } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.resx b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.resx index 798b0ddf00..6419da389f 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigHardwareOptions.resx @@ -123,7 +123,7 @@ - 331, 13 + 180, 38 60, 23 @@ -139,19 +139,19 @@ BUT_MagCalibrationLive - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.35069, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4589.38394, Culture=neutral, PublicKeyToken=null $this - 2 + 14 NoControl - 455, 45 + 304, 70 145, 20 @@ -172,7 +172,7 @@ $this - 3 + 15 XL-EZ0 @@ -187,7 +187,7 @@ HRLV - 243, 122 + 180, 168 121, 21 @@ -205,7 +205,7 @@ $this - 4 + 16 False @@ -214,7 +214,7 @@ NoControl - 97, 285 + 108, 327 134, 19 @@ -235,7 +235,7 @@ $this - 5 + 0 Zoom @@ -244,7 +244,7 @@ NoControl - 13, 259 + 11, 357 75, 75 @@ -262,7 +262,7 @@ $this - 6 + 17 True @@ -271,7 +271,7 @@ NoControl - 338, 68 + 187, 93 104, 13 @@ -292,13 +292,13 @@ $this - 7 + 18 NoControl - 240, 45 + 105, 73 72, 16 @@ -319,13 +319,13 @@ $this - 8 + 19 False - 331, 45 + 180, 70 121, 20 @@ -343,7 +343,7 @@ $this - 9 + 20 False @@ -352,7 +352,7 @@ NoControl - 97, 202 + 108, 222 103, 17 @@ -373,7 +373,7 @@ $this - 10 + 3 False @@ -382,7 +382,7 @@ NoControl - 94, 124 + 108, 114 90, 17 @@ -403,7 +403,7 @@ $this - 11 + 6 False @@ -412,7 +412,7 @@ NoControl - 97, 44 + 108, 6 105, 17 @@ -433,7 +433,7 @@ $this - 12 + 9 Zoom @@ -442,7 +442,7 @@ NoControl - 13, 176 + 11, 249 75, 75 @@ -460,7 +460,7 @@ $this - 13 + 21 Zoom @@ -469,7 +469,7 @@ NoControl - 13, 94 + 11, 141 75, 75 @@ -487,7 +487,7 @@ $this - 14 + 22 Zoom @@ -502,7 +502,7 @@ - 13, 13 + 11, 33 75, 75 @@ -520,13 +520,13 @@ $this - 15 + 23 NoControl - 392, 13 + 241, 38 60, 23 @@ -541,13 +541,13 @@ BUT_MagCalibrationLog - ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4576.35069, Culture=neutral, PublicKeyToken=null + ArdupilotMega.Controls.MyButton, ArdupilotMegaPlanner10, Version=1.1.4589.38394, Culture=neutral, PublicKeyToken=null $this - 1 + 13 False @@ -556,7 +556,7 @@ NoControl - 243, 25 + 92, 50 82, 17 @@ -577,7 +577,232 @@ $this - 0 + 12 + + + True + + + Microsoft Sans Serif, 12pt + + + 7, 3 + + + 76, 20 + + + 66 + + + Compass + + + label5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 10 + + + Top, Left, Right + + + 3, 21 + + + 731, 5 + + + 65 + + + groupBox2 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 11 + + + True + + + Microsoft Sans Serif, 12pt + + + NoControl + + + 7, 111 + + + 52, 20 + + + 68 + + + Sonar + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 7 + + + Top, Left, Right + + + 3, 129 + + + 731, 5 + + + 67 + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 8 + + + True + + + Microsoft Sans Serif, 12pt + + + NoControl + + + 7, 219 + + + 72, 20 + + + 70 + + + Airspeed + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + Top, Left, Right + + + 3, 237 + + + 731, 5 + + + 69 + + + groupBox3 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + True + + + Microsoft Sans Serif, 12pt + + + NoControl + + + 7, 327 + + + 95, 20 + + + 72 + + + Optical Flow + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + Top, Left, Right + + + 3, 345 + + + 731, 5 + + + 71 + + + groupBox4 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 True @@ -586,12 +811,12 @@ 6, 13 - 602, 351 + 737, 450 ConfigHardwareOptions - ArdupilotMega.Controls.BackstageView.BackStageViewContentPanel, ArdupilotMegaPlanner10, Version=1.1.4576.35069, Culture=neutral, PublicKeyToken=null + System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.cs b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.cs new file mode 100644 index 0000000000..2d18e94335 --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/GCSViews/ConfigurationView/ConfigMount.cs @@ -0,0 +1,185 @@ +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using ArdupilotMega.Controls.BackstageView; +using ArdupilotMega.Presenter; +using Transitions; + +namespace ArdupilotMega.GCSViews.ConfigurationView +{ + public partial class ConfigMount : UserControl, IActivate + { + private Transition[] _ErrorTransition; + private Transition _NoErrorTransition; + + public ConfigMount() + { + InitializeComponent(); + PBOX_WarningIcon.Opacity = 0.0F; + LBL_Error.Opacity = 0.0F; + + + + + var delay = new Transition(new TransitionType_Linear(2000)); + var fadeIn = new Transition(new TransitionType_Linear(800)); + fadeIn.add(PBOX_WarningIcon, "Opacity", 1.0F); + fadeIn.add(LBL_Error, "Opacity", 1.0F); + + _ErrorTransition = new[] { delay, fadeIn }; + + _NoErrorTransition = new Transition(new TransitionType_Linear(10)); + _NoErrorTransition.add(PBOX_WarningIcon, "Opacity", 0.0F); + _NoErrorTransition.add(LBL_Error, "Opacity", 0.0F); + + //setup button actions + foreach (var btn in Controls.Cast().OfType