diff --git a/Tools/ArdupilotMegaPlanner/AGauge.cs b/Tools/ArdupilotMegaPlanner/AGauge.cs deleted file mode 100644 index 300ae3d97c..0000000000 --- a/Tools/ArdupilotMegaPlanner/AGauge.cs +++ /dev/null @@ -1,1918 +0,0 @@ -// Copyright (C) 2007 A.J.Bauer - Modified for multiple needles and scaling - Michael Oborne 2011 -// -// This software is provided as-is, without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. - -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: - -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. if you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.Drawing.Drawing2D; -using System.Diagnostics; - - -namespace AGaugeApp -{ - [ToolboxBitmapAttribute(typeof(AGauge), "AGauge.bmp"), - DefaultEvent("ValueInRangeChanged"), - Description("Displays a value on an analog gauge. Raises an event if the value enters one of the definable ranges.")] - public partial class AGauge : MyUserControl - { -#region enum, var, delegate, event - public enum NeedleColorEnum - { - Gray = 0, - Red = 1, - Green = 2, - Blue = 3, - Yellow = 4, - Violet = 5, - Magenta = 6 - }; - - private const Byte ZERO = 0; - private const Byte NUMOFCAPS = 5; - private const Byte NUMOFRANGES = 5; - - private Single fontBoundY1; - private Single fontBoundY2; - private Bitmap gaugeBitmap; - private Boolean drawGaugeBackground = true; - - private Boolean[] m_valueIsInRange = { false, false, false, false, false }; - private Byte m_CapIdx = 1; - private Color[] m_CapColor = { Color.Black, Color.Black, Color.Black, Color.Black, Color.Black }; - private String[] m_CapText = { "", "", "", "", "" }; - private Point[] m_CapPosition = { new Point(10, 10), new Point(10, 10), new Point(10, 10), new Point(10, 10), new Point(10, 10) }; - private Point m_Center = new Point(100, 100); - private Single m_MinValue = -100; - private Single m_MaxValue = 400; - - private Color m_BaseArcColor = Color.Gray; - private Int32 m_BaseArcRadius = 80; - private Int32 m_BaseArcStart = 135; - private Int32 m_BaseArcSweep = 270; - private Int32 m_BaseArcWidth = 2; - - private Color m_ScaleLinesInterColor = Color.Black; - private Int32 m_ScaleLinesInterInnerRadius = 73; - private Int32 m_ScaleLinesInterOuterRadius = 80; - private Int32 m_ScaleLinesInterWidth = 1; - - private Int32 m_ScaleLinesMinorNumOf = 9; - private Color m_ScaleLinesMinorColor = Color.Gray; - private Int32 m_ScaleLinesMinorInnerRadius = 75; - private Int32 m_ScaleLinesMinorOuterRadius = 80; - private Int32 m_ScaleLinesMinorWidth = 1; - - private Single m_ScaleLinesMajorStepValue = 50.0f; - private Color m_ScaleLinesMajorColor = Color.Black; - private Int32 m_ScaleLinesMajorInnerRadius = 70; - private Int32 m_ScaleLinesMajorOuterRadius = 80; - private Int32 m_ScaleLinesMajorWidth = 2; - - private Byte m_RangeIdx; - private Boolean[] m_RangeEnabled = { true, true, false, false, false }; - private Color[] m_RangeColor = { Color.LightGreen, Color.Red, Color.FromKnownColor(KnownColor.Control), Color.FromKnownColor(KnownColor.Control), Color.FromKnownColor(KnownColor.Control) }; - private Single[] m_RangeStartValue = { -100.0f, 300.0f, 0.0f, 0.0f, 0.0f }; - private Single[] m_RangeEndValue = { 300.0f, 400.0f, 0.0f, 0.0f, 0.0f }; - private Int32[] m_RangeInnerRadius = { 70, 70, 70, 70, 70 }; - private Int32[] m_RangeOuterRadius = { 80, 80, 80, 80, 80 }; - - private Int32 m_ScaleNumbersRadius = 95; - private Color m_ScaleNumbersColor = Color.Black; - private String m_ScaleNumbersFormat; - private Int32 m_ScaleNumbersStartScaleLine; - private Int32 m_ScaleNumbersStepScaleLines = 1; - private Int32 m_ScaleNumbersRotation = 0; - - private Byte m_NeedIdx = 0; - private Int32[] m_NeedleType = { 0, 0, 0, 0 }; - private Int32[] m_NeedleRadius = { 80, 80, 80, 80}; - private NeedleColorEnum[] m_NeedleColor1 = { NeedleColorEnum.Gray, NeedleColorEnum.Gray, NeedleColorEnum.Gray, NeedleColorEnum.Gray }; - private Color[] m_NeedleColor2 = { Color.DimGray, Color.DimGray, Color.DimGray, Color.DimGray }; - private Int32[] m_NeedleWidth = { 2, 2, 2, 2 }; - private bool[] m_NeedleEnabled = { true, false, false, false }; - - private Single[] m_value = { 0, 0, 0, 0 }; - - public class ValueInRangeChangedEventArgs : EventArgs - { - public Int32 valueInRange; - - public ValueInRangeChangedEventArgs(Int32 valueInRange) - { - this.valueInRange = valueInRange; - } - } - - public delegate void ValueInRangeChangedDelegate(Object sender, ValueInRangeChangedEventArgs e); - [Description("This event is raised if the value falls into a defined range.")] - public event ValueInRangeChangedDelegate ValueInRangeChanged; -#endregion - -#region hidden , overridden inherited properties - public new Boolean AllowDrop - { - get - { - return false; - } - set - { - - } - } - public new Boolean AutoSize - { - get - { - return false; - } - set - { - - } - } - public new Boolean ForeColor - { - get - { - return false; - } - set - { - } - } - public new Boolean ImeMode - { - get - { - return false; - } - set - { - } - } - - public override System.Drawing.Color BackColor - { - get - { - return base.BackColor; - } - set - { - base.BackColor = value; - drawGaugeBackground = true; - Refresh(); - } - } - public override System.Drawing.Font Font - { - get - { - return base.Font; - } - set - { - base.Font = value; - drawGaugeBackground = true; - Refresh(); - } - } - public override System.Windows.Forms.ImageLayout BackgroundImageLayout - { - get - { - return base.BackgroundImageLayout; - } - set - { - base.BackgroundImageLayout = value; - drawGaugeBackground = true; - Refresh(); - } - } - #endregion - - public AGauge() - { - InitializeComponent(); - - SetStyle(ControlStyles.OptimizedDoubleBuffer, true); - } - -#region properties - [System.ComponentModel.Browsable(true)] - public Single Value0 { get { return m_value[0]; } set { m_NeedIdx = 0; Value = value; } } - [System.ComponentModel.Browsable(true)] - public Single Value1 { get { return m_value[1]; } set { m_NeedIdx = 1; Value = value; } } - [System.ComponentModel.Browsable(true)] - public Single Value2 { get { return m_value[2]; } set { m_NeedIdx = 2; Value = value; } } - [System.ComponentModel.Browsable(true)] - public Single Value3 { get { return m_value[3]; } set { m_NeedIdx = 3; Value = value; } } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The value.")] - public Single Value - { - get - { - return m_value[m_NeedIdx]; - } - set - { - if (m_value[m_NeedIdx] != value) - { - m_value[m_NeedIdx] = Math.Min(Math.Max(value, m_MinValue), m_MaxValue); - - if (this.DesignMode) - { - drawGaugeBackground = true; - } - - for (Int32 counter = 0; counter < NUMOFRANGES - 1; counter++) - { - if ((m_RangeStartValue[counter] <= m_value[m_NeedIdx]) - && (m_value[m_NeedIdx] <= m_RangeEndValue[counter]) - && (m_RangeEnabled[counter])) - { - if (!m_valueIsInRange[counter]) - { - if (ValueInRangeChanged!=null) - { - ValueInRangeChanged(this, new ValueInRangeChangedEventArgs(counter)); - } - } - } - else - { - m_valueIsInRange[counter] = false; - } - } - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.RefreshProperties(RefreshProperties.All), - System.ComponentModel.Description("The caption index. set this to a value of 0 up to 4 to change the corresponding caption's properties.")] - public Byte Cap_Idx - { - get - { - return m_CapIdx; - } - set - { - if ((m_CapIdx != value) - && (0 <= value) - && (value < 5)) - { - m_CapIdx = value; - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The color of the caption text.")] - public Color CapColor - { - get - { - return m_CapColor[m_CapIdx]; - } - set - { - if (m_CapColor[m_CapIdx] != value) - { - m_CapColor[m_CapIdx] = value; - CapColors = m_CapColor; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Color[] CapColors - { - get - { - return m_CapColor; - } - set - { - m_CapColor = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The text of the caption.")] - public String CapText - { - get - { - return m_CapText[m_CapIdx]; - } - set - { - if (m_CapText[m_CapIdx] != value) - { - m_CapText[m_CapIdx] = value; - CapsText = m_CapText; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public String[] CapsText - { - get - { - return m_CapText; - } - set - { - for (Int32 counter = 0; counter < 5; counter++) - { - m_CapText[counter] = value[counter]; - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The position of the caption.")] - public Point CapPosition - { - get - { - return m_CapPosition[m_CapIdx]; - } - set - { - if (m_CapPosition[m_CapIdx] != value) - { - m_CapPosition[m_CapIdx] = value; - CapsPosition = m_CapPosition; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Point[] CapsPosition - { - get - { - return m_CapPosition; - } - set - { - m_CapPosition = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The center of the gauge (in the control's client area).")] - public Point Center - { - get - { - return m_Center; - } - set - { - if (m_Center != value) - { - m_Center = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The minimum value to show on the scale.")] - public Single MinValue - { - get - { - return m_MinValue; - } - set - { - if ((m_MinValue != value) - && (value < m_MaxValue)) - { - m_MinValue = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The maximum value to show on the scale.")] - public Single MaxValue - { - get - { - return m_MaxValue; - } - set - { - if ((m_MaxValue != value) - && (value > m_MinValue)) - { - m_MaxValue = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The color of the base arc.")] - public Color BaseArcColor - { - get - { - return m_BaseArcColor; - } - set - { - if (m_BaseArcColor != value) - { - m_BaseArcColor = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The radius of the base arc.")] - public Int32 BaseArcRadius - { - get - { - return m_BaseArcRadius; - } - set - { - if (m_BaseArcRadius != value) - { - m_BaseArcRadius = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The start angle of the base arc.")] - public Int32 BaseArcStart - { - get - { - return m_BaseArcStart; - } - set - { - if (m_BaseArcStart != value) - { - m_BaseArcStart = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The sweep angle of the base arc.")] - public Int32 BaseArcSweep - { - get - { - return m_BaseArcSweep; - } - set - { - if (m_BaseArcSweep != value) - { - m_BaseArcSweep = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The width of the base arc.")] - public Int32 BaseArcWidth - { - get - { - return m_BaseArcWidth; - } - set - { - if (m_BaseArcWidth != value) - { - m_BaseArcWidth = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The color of the inter scale lines which are the middle scale lines for an uneven number of minor scale lines.")] - public Color ScaleLinesInterColor - { - get - { - return m_ScaleLinesInterColor; - } - set - { - if (m_ScaleLinesInterColor != value) - { - m_ScaleLinesInterColor = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The inner radius of the inter scale lines which are the middle scale lines for an uneven number of minor scale lines.")] - public Int32 ScaleLinesInterInnerRadius - { - get - { - return m_ScaleLinesInterInnerRadius; - } - set - { - if (m_ScaleLinesInterInnerRadius != value) - { - m_ScaleLinesInterInnerRadius = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The outer radius of the inter scale lines which are the middle scale lines for an uneven number of minor scale lines.")] - public Int32 ScaleLinesInterOuterRadius - { - get - { - return m_ScaleLinesInterOuterRadius; - } - set - { - if (m_ScaleLinesInterOuterRadius != value) - { - m_ScaleLinesInterOuterRadius = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The width of the inter scale lines which are the middle scale lines for an uneven number of minor scale lines.")] - public Int32 ScaleLinesInterWidth - { - get - { - return m_ScaleLinesInterWidth; - } - set - { - if (m_ScaleLinesInterWidth != value) - { - m_ScaleLinesInterWidth = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The number of minor scale lines.")] - public Int32 ScaleLinesMinorNumOf - { - get - { - return m_ScaleLinesMinorNumOf; - } - set - { - if (m_ScaleLinesMinorNumOf != value) - { - m_ScaleLinesMinorNumOf = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The color of the minor scale lines.")] - public Color ScaleLinesMinorColor - { - get - { - return m_ScaleLinesMinorColor; - } - set - { - if (m_ScaleLinesMinorColor != value) - { - m_ScaleLinesMinorColor = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The inner radius of the minor scale lines.")] - public Int32 ScaleLinesMinorInnerRadius - { - get - { - return m_ScaleLinesMinorInnerRadius; - } - set - { - if (m_ScaleLinesMinorInnerRadius != value) - { - m_ScaleLinesMinorInnerRadius = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The outer radius of the minor scale lines.")] - public Int32 ScaleLinesMinorOuterRadius - { - get - { - return m_ScaleLinesMinorOuterRadius; - } - set - { - if (m_ScaleLinesMinorOuterRadius != value) - { - m_ScaleLinesMinorOuterRadius = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The width of the minor scale lines.")] - public Int32 ScaleLinesMinorWidth - { - get - { - return m_ScaleLinesMinorWidth; - } - set - { - if (m_ScaleLinesMinorWidth != value) - { - m_ScaleLinesMinorWidth = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The step value of the major scale lines.")] - public Single ScaleLinesMajorStepValue - { - get - { - return m_ScaleLinesMajorStepValue; - } - set - { - if ((m_ScaleLinesMajorStepValue != value) && (value > 0)) - { - m_ScaleLinesMajorStepValue = Math.Max(Math.Min(value, m_MaxValue), m_MinValue); - drawGaugeBackground = true; - Refresh(); - } - } - } - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The color of the major scale lines.")] - public Color ScaleLinesMajorColor - { - get - { - return m_ScaleLinesMajorColor; - } - set - { - if (m_ScaleLinesMajorColor != value) - { - m_ScaleLinesMajorColor = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The inner radius of the major scale lines.")] - public Int32 ScaleLinesMajorInnerRadius - { - get - { - return m_ScaleLinesMajorInnerRadius; - } - set - { - if (m_ScaleLinesMajorInnerRadius != value) - { - m_ScaleLinesMajorInnerRadius = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The outer radius of the major scale lines.")] - public Int32 ScaleLinesMajorOuterRadius - { - get - { - return m_ScaleLinesMajorOuterRadius; - } - set - { - if (m_ScaleLinesMajorOuterRadius != value) - { - m_ScaleLinesMajorOuterRadius = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The width of the major scale lines.")] - public Int32 ScaleLinesMajorWidth - { - get - { - return m_ScaleLinesMajorWidth; - } - set - { - if (m_ScaleLinesMajorWidth != value) - { - m_ScaleLinesMajorWidth = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.RefreshProperties(RefreshProperties.All), - System.ComponentModel.Description("The range index. set this to a value of 0 up to 4 to change the corresponding range's properties.")] - public Byte Range_Idx - { - get - { - return m_RangeIdx; - } - set - { - if ((m_RangeIdx != value) - && (0 <= value) - && (value < NUMOFRANGES)) - { - m_RangeIdx = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("Enables or disables the range selected by Range_Idx.")] - public Boolean RangeEnabled - { - get - { - return m_RangeEnabled[m_RangeIdx]; - } - set - { - if (m_RangeEnabled[m_RangeIdx] != value) - { - m_RangeEnabled[m_RangeIdx] = value; - RangesEnabled = m_RangeEnabled; - drawGaugeBackground = true; - Refresh(); - } - } - } - - - [System.ComponentModel.Browsable(false)] - public Boolean[] RangesEnabled - { - get - { - return m_RangeEnabled; - } - set - { - m_RangeEnabled = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The color of the range.")] - public Color RangeColor - { - get - { - return m_RangeColor[m_RangeIdx]; - } - set - { - if (m_RangeColor[m_RangeIdx] != value) - { - m_RangeColor[m_RangeIdx] = value; - RangesColor = m_RangeColor; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Color[] RangesColor - { - get - { - return m_RangeColor; - } - set - { - m_RangeColor = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The start value of the range, must be less than RangeEndValue.")] - public Single RangeStartValue - { - get - { - return m_RangeStartValue[m_RangeIdx]; - } - set - { - if ((m_RangeStartValue[m_RangeIdx] != value) - && (value < m_RangeEndValue[m_RangeIdx])) - { - m_RangeStartValue[m_RangeIdx] = value; - RangesStartValue = m_RangeStartValue; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Single[] RangesStartValue - { - get - { - return m_RangeStartValue; - } - set - { - m_RangeStartValue = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The end value of the range. Must be greater than RangeStartValue.")] - public Single RangeEndValue - { - get - { - return m_RangeEndValue[m_RangeIdx]; - } - set - { - if ((m_RangeEndValue[m_RangeIdx] != value) - && (m_RangeStartValue[m_RangeIdx] < value)) - { - m_RangeEndValue[m_RangeIdx] = value; - RangesEndValue = m_RangeEndValue; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Single[] RangesEndValue - { - get - { - return m_RangeEndValue; - } - set - { - m_RangeEndValue = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The inner radius of the range.")] - public Int32 RangeInnerRadius - { - get - { - return m_RangeInnerRadius[m_RangeIdx]; - } - set - { - if (m_RangeInnerRadius[m_RangeIdx] != value) - { - m_RangeInnerRadius[m_RangeIdx] = value; - RangesInnerRadius = m_RangeInnerRadius; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Int32[] RangesInnerRadius - { - get - { - return m_RangeInnerRadius; - } - set - { - m_RangeInnerRadius = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The inner radius of the range.")] - public Int32 RangeOuterRadius - { - get - { - return m_RangeOuterRadius[m_RangeIdx]; - } - set - { - if (m_RangeOuterRadius[m_RangeIdx] != value) - { - m_RangeOuterRadius[m_RangeIdx] = value; - RangesOuterRadius = m_RangeOuterRadius; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Int32[] RangesOuterRadius - { - get - { - return m_RangeOuterRadius; - } - set - { - m_RangeOuterRadius = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The radius of the scale numbers.")] - public Int32 ScaleNumbersRadius - { - get - { - return m_ScaleNumbersRadius; - } - set - { - if (m_ScaleNumbersRadius != value) - { - m_ScaleNumbersRadius = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The color of the scale numbers.")] - public Color ScaleNumbersColor - { - get - { - return m_ScaleNumbersColor; - } - set - { - if (m_ScaleNumbersColor != value) - { - m_ScaleNumbersColor = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The format of the scale numbers.")] - public String ScaleNumbersFormat - { - get - { - return m_ScaleNumbersFormat; - } - set - { - if (m_ScaleNumbersFormat != value) - { - m_ScaleNumbersFormat = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The number of the scale line to start writing numbers next to.")] - public Int32 ScaleNumbersStartScaleLine - { - get - { - return m_ScaleNumbersStartScaleLine; - } - set - { - if (m_ScaleNumbersStartScaleLine != value) - { - m_ScaleNumbersStartScaleLine = Math.Max(value, 1); - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The number of scale line steps for writing numbers.")] - public Int32 ScaleNumbersStepScaleLines - { - get - { - return m_ScaleNumbersStepScaleLines; - } - set - { - if (m_ScaleNumbersStepScaleLines != value) - { - m_ScaleNumbersStepScaleLines = Math.Max(value, 1); - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The angle relative to the tangent of the base arc at a scale line that is used to rotate numbers. set to 0 for no rotation or e.g. set to 90.")] - public Int32 ScaleNumbersRotation - { - get - { - return m_ScaleNumbersRotation; - } - set - { - if (m_ScaleNumbersRotation != value) - { - m_ScaleNumbersRotation = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(true), -System.ComponentModel.Category("AGauge"), -System.ComponentModel.RefreshProperties(RefreshProperties.All), -System.ComponentModel.Description("set needle number")] - public Byte Need_Idx - { - get - { - return m_NeedIdx; - } - set - { - if ((m_NeedIdx != value) - && (0 <= value) - && (value < 5)) - { - m_NeedIdx = value; - } - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The type of the needle, currently only type 0 and 1 are supported. Type 0 looks nicers but if you experience performance problems you might consider using type 1.")] - public Int32 NeedleType - { - get - { - return m_NeedleType[m_NeedIdx]; - } - set - { - if (m_NeedleType[m_NeedIdx] != value) - { - m_NeedleType[m_NeedIdx] = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Int32[] NeedlesType - { - get - { - return m_NeedleType; - } - set - { - m_NeedleType = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The radius of the needle.")] - public Int32 NeedleRadius - { - get - { - return m_NeedleRadius[m_NeedIdx]; - } - set - { - if (m_NeedleRadius[m_NeedIdx] != value) - { - m_NeedleRadius[m_NeedIdx] = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Int32[] NeedlesRadius - { - get - { - return m_NeedleRadius; - } - set - { - m_NeedleRadius = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The first color of the needle.")] - public NeedleColorEnum NeedleColor1 - { - get - { - return m_NeedleColor1[m_NeedIdx]; - } - set - { - if (m_NeedleColor1[m_NeedIdx] != value) - { - m_NeedleColor1[m_NeedIdx] = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public NeedleColorEnum[] NeedlesColor1 - { - get - { - return m_NeedleColor1; - } - set - { - m_NeedleColor1 = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The second color of the needle.")] - public Color NeedleColor2 - { - get - { - return m_NeedleColor2[m_NeedIdx]; - } - set - { - if (m_NeedleColor2[m_NeedIdx] != value) - { - m_NeedleColor2[m_NeedIdx] = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Color[] NeedlesColor2 - { - get - { - return m_NeedleColor2; - } - set - { - m_NeedleColor2 = value; - } - } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("The width of the needle.")] - public Int32 NeedleWidth - { - get - { - return m_NeedleWidth[m_NeedIdx]; - } - set - { - if (m_NeedleWidth[m_NeedIdx] != value) - { - m_NeedleWidth[m_NeedIdx] = value; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Int32[] NeedlesWidth - { - get - { - return m_NeedleWidth; - } - set - { - m_NeedleWidth = value; - } - } - - [System.ComponentModel.Browsable(true), -System.ComponentModel.Category("AGauge"), -System.ComponentModel.Description("Enables or disables the range selected by Need_Idx.")] - public Boolean NeedleEnabled - { - get - { - return m_NeedleEnabled[m_NeedIdx]; - } - set - { - if (m_NeedleEnabled[m_NeedIdx] != value) - { - m_NeedleEnabled[m_NeedIdx] = value; - NeedlesEnabled = m_NeedleEnabled; - drawGaugeBackground = true; - Refresh(); - } - } - } - - [System.ComponentModel.Browsable(false)] - public Boolean[] NeedlesEnabled - { - get - { - return m_NeedleEnabled; - } - set - { - m_NeedleEnabled = value; - } - } - - #endregion - -#region helper - private void FindFontBounds() - { - //find upper and lower bounds for numeric characters - Int32 c1; - Int32 c2; - Boolean boundfound; - Bitmap b; - Graphics g; - SolidBrush backBrush = new SolidBrush(Color.White); - SolidBrush foreBrush = new SolidBrush(Color.Black); - SizeF boundingBox; - - b = new Bitmap(5, 5); - g = Graphics.FromImage(b); - boundingBox = g.MeasureString("0123456789", Font, -1, StringFormat.GenericTypographic); - b = new Bitmap((Int32)(boundingBox.Width), (Int32)(boundingBox.Height)); - g = Graphics.FromImage(b); - g.FillRectangle(backBrush, 0.0F, 0.0F, boundingBox.Width, boundingBox.Height); - g.DrawString("0123456789", Font, foreBrush, 0.0F, 0.0F, StringFormat.GenericTypographic); - - fontBoundY1 = 0; - fontBoundY2 = 0; - c1 = 0; - boundfound = false; - while ((c1 < b.Height) && (!boundfound)) - { - c2 = 0; - while ((c2 < b.Width) && (!boundfound)) - { - if (b.GetPixel(c2, c1) != backBrush.Color) - { - fontBoundY1 = c1; - boundfound = true; - } - c2++; - } - c1++; - } - - c1 = b.Height - 1; - boundfound = false; - while ((0 < c1) && (!boundfound)) - { - c2 = 0; - while ((c2 < b.Width) && (!boundfound)) - { - if (b.GetPixel(c2, c1) != backBrush.Color) - { - fontBoundY2 = c1; - boundfound = true; - } - c2++; - } - c1--; - } - } -#endregion - -#region base member overrides - protected override void OnPaintBackground(PaintEventArgs pevent) - { - } - - protected override void OnPaint(PaintEventArgs pe) - { - if ((Width < 10) || (Height < 10)) - { - return; - } - - float scale = 1; - - // scale it - if (basesize != null) - { - scale = (float)this.Width / basesize.Width; - -// Console.WriteLine("Scale: " + scale); - } - - if (drawGaugeBackground) - { - drawGaugeBackground = false; - try - { - FindFontBounds(); - } - catch { } // ignore for now - happens when the control gets to small for text - - gaugeBitmap = new Bitmap(Width, Height, pe.Graphics); - Graphics ggr = Graphics.FromImage(gaugeBitmap); - ggr.FillRectangle(new SolidBrush(BackColor), ClientRectangle); - - if (BackgroundImage!=null) - { - switch (BackgroundImageLayout) - { - case ImageLayout.Center: - ggr.DrawImageUnscaled(BackgroundImage, Width / 2 - BackgroundImage.Width / 2, Height / 2 - BackgroundImage.Height / 2); - break; - case ImageLayout.None: - ggr.DrawImageUnscaled(BackgroundImage, 0, 0); - break; - case ImageLayout.Stretch: - ggr.DrawImage(BackgroundImage, 0, 0, Width, Height); - break; - case ImageLayout.Tile: - Int32 pixelOffsetX = 0; - Int32 pixelOffsetY = 0; - while (pixelOffsetX < Width) - { - pixelOffsetY = 0; - while (pixelOffsetY < Height) - { - ggr.DrawImageUnscaled(BackgroundImage, pixelOffsetX, pixelOffsetY); - pixelOffsetY += BackgroundImage.Height; - } - pixelOffsetX += BackgroundImage.Width; - } - break; - case ImageLayout.Zoom: - if ((Single)(BackgroundImage.Width / Width) < (Single)(BackgroundImage.Height / Height)) - { - ggr.DrawImage(BackgroundImage, 0, 0, Height, Height); - } - else - { - ggr.DrawImage(BackgroundImage, 0, 0, Width, Width); - } - break; - } - } - - ggr.SmoothingMode = SmoothingMode.HighQuality; - ggr.PixelOffsetMode = PixelOffsetMode.HighQuality; - - // scale it - if (basesize != null) - { - ggr.ScaleTransform(scale, scale); - } - - GraphicsPath gp = new GraphicsPath(); - Single rangeStartAngle; - Single rangeSweepAngle; - for (Int32 counter= 0; counter m_RangeStartValue[counter] - && m_RangeEnabled[counter]) - { - rangeStartAngle = m_BaseArcStart + (m_RangeStartValue[counter] - m_MinValue) * m_BaseArcSweep / (m_MaxValue - m_MinValue); - rangeSweepAngle = (m_RangeEndValue[counter] - m_RangeStartValue[counter]) * m_BaseArcSweep / (m_MaxValue - m_MinValue); - gp.Reset(); - gp.AddPie(new Rectangle(m_Center.X - m_RangeOuterRadius[counter], m_Center.Y - m_RangeOuterRadius[counter], 2 * m_RangeOuterRadius[counter], 2 * m_RangeOuterRadius[counter]), rangeStartAngle, rangeSweepAngle); - gp.Reverse(); - gp.AddPie(new Rectangle(m_Center.X - m_RangeInnerRadius[counter], m_Center.Y - m_RangeInnerRadius[counter], 2 * m_RangeInnerRadius[counter], 2 * m_RangeInnerRadius[counter]), rangeStartAngle, rangeSweepAngle); - gp.Reverse(); - ggr.SetClip(gp); - ggr.FillPie(new SolidBrush(m_RangeColor[counter]), new Rectangle(m_Center.X - m_RangeOuterRadius[counter], m_Center.Y - m_RangeOuterRadius[counter], 2 * m_RangeOuterRadius[counter], 2 * m_RangeOuterRadius[counter]), rangeStartAngle, rangeSweepAngle); - } - } - - ggr.SetClip(ClientRectangle); - if (m_BaseArcRadius > 0) - { - ggr.DrawArc(new Pen(m_BaseArcColor, m_BaseArcWidth), new Rectangle(m_Center.X - m_BaseArcRadius, m_Center.Y - m_BaseArcRadius, 2 * m_BaseArcRadius, 2 * m_BaseArcRadius), m_BaseArcStart, m_BaseArcSweep); - } - - String valueText = ""; - SizeF boundingBox; - Single countValue= 0; - Int32 counter1 = 0; - while (countValue <= (m_MaxValue - m_MinValue)) - { - valueText = (m_MinValue + countValue).ToString(m_ScaleNumbersFormat); - ggr.ResetTransform(); - // scale it - if (basesize != null) - { - ggr.ScaleTransform(scale, scale); - } - boundingBox = ggr.MeasureString(valueText, Font, -1, StringFormat.GenericTypographic); - - gp.Reset(); - gp.AddEllipse(new Rectangle(m_Center.X - m_ScaleLinesMajorOuterRadius, m_Center.Y - m_ScaleLinesMajorOuterRadius, 2 * m_ScaleLinesMajorOuterRadius, 2 * m_ScaleLinesMajorOuterRadius)); - gp.Reverse(); - gp.AddEllipse(new Rectangle(m_Center.X - m_ScaleLinesMajorInnerRadius, m_Center.Y - m_ScaleLinesMajorInnerRadius, 2 * m_ScaleLinesMajorInnerRadius, 2 * m_ScaleLinesMajorInnerRadius)); - gp.Reverse(); - ggr.SetClip(gp); - - ggr.DrawLine(new Pen(m_ScaleLinesMajorColor, m_ScaleLinesMajorWidth), - (Single)(Center.X), - (Single)(Center.Y), - (Single)(Center.X + 2 * m_ScaleLinesMajorOuterRadius * Math.Cos((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue)) * Math.PI / 180.0)), - (Single)(Center.Y + 2 * m_ScaleLinesMajorOuterRadius * Math.Sin((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue)) * Math.PI / 180.0))); - - gp.Reset(); - gp.AddEllipse(new Rectangle(m_Center.X - m_ScaleLinesMinorOuterRadius, m_Center.Y - m_ScaleLinesMinorOuterRadius, 2 * m_ScaleLinesMinorOuterRadius, 2 * m_ScaleLinesMinorOuterRadius)); - gp.Reverse(); - gp.AddEllipse(new Rectangle(m_Center.X - m_ScaleLinesMinorInnerRadius, m_Center.Y - m_ScaleLinesMinorInnerRadius, 2 * m_ScaleLinesMinorInnerRadius, 2 * m_ScaleLinesMinorInnerRadius)); - gp.Reverse(); - ggr.SetClip(gp); - - if (countValue < (m_MaxValue - m_MinValue)) - { - for (Int32 counter2= 1; counter2<=m_ScaleLinesMinorNumOf; counter2++) - { - if (((m_ScaleLinesMinorNumOf % 2) == 1) && ((Int32)(m_ScaleLinesMinorNumOf / 2) + 1 == counter2)) - { - gp.Reset(); - gp.AddEllipse(new Rectangle(m_Center.X - m_ScaleLinesInterOuterRadius, m_Center.Y - m_ScaleLinesInterOuterRadius, 2 * m_ScaleLinesInterOuterRadius, 2 * m_ScaleLinesInterOuterRadius)); - gp.Reverse(); - gp.AddEllipse(new Rectangle(m_Center.X - m_ScaleLinesInterInnerRadius, m_Center.Y - m_ScaleLinesInterInnerRadius, 2 * m_ScaleLinesInterInnerRadius, 2 * m_ScaleLinesInterInnerRadius)); - gp.Reverse(); - ggr.SetClip(gp); - - ggr.DrawLine(new Pen(m_ScaleLinesInterColor, m_ScaleLinesInterWidth), - (Single)(Center.X), - (Single)(Center.Y), - (Single)(Center.X + 2 * m_ScaleLinesInterOuterRadius * Math.Cos((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue) + counter2 * m_BaseArcSweep / (((Single)((m_MaxValue - m_MinValue) / m_ScaleLinesMajorStepValue)) * (m_ScaleLinesMinorNumOf + 1))) * Math.PI / 180.0)), - (Single)(Center.Y + 2 * m_ScaleLinesInterOuterRadius * Math.Sin((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue) + counter2 * m_BaseArcSweep / (((Single)((m_MaxValue - m_MinValue) / m_ScaleLinesMajorStepValue)) * (m_ScaleLinesMinorNumOf + 1))) * Math.PI / 180.0))); - - gp.Reset(); - gp.AddEllipse(new Rectangle(m_Center.X - m_ScaleLinesMinorOuterRadius, m_Center.Y - m_ScaleLinesMinorOuterRadius, 2 * m_ScaleLinesMinorOuterRadius, 2 * m_ScaleLinesMinorOuterRadius)); - gp.Reverse(); - gp.AddEllipse(new Rectangle(m_Center.X - m_ScaleLinesMinorInnerRadius, m_Center.Y - m_ScaleLinesMinorInnerRadius, 2 * m_ScaleLinesMinorInnerRadius, 2 * m_ScaleLinesMinorInnerRadius)); - gp.Reverse(); - ggr.SetClip(gp); - } - else - { - ggr.DrawLine(new Pen(m_ScaleLinesMinorColor, m_ScaleLinesMinorWidth), - (Single)(Center.X), - (Single)(Center.Y), - (Single)(Center.X + 2 * m_ScaleLinesMinorOuterRadius * Math.Cos((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue) + counter2 * m_BaseArcSweep / (((Single)((m_MaxValue - m_MinValue) / m_ScaleLinesMajorStepValue)) * (m_ScaleLinesMinorNumOf + 1))) * Math.PI / 180.0)), - (Single)(Center.Y + 2 * m_ScaleLinesMinorOuterRadius * Math.Sin((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue) + counter2 * m_BaseArcSweep / (((Single)((m_MaxValue - m_MinValue) / m_ScaleLinesMajorStepValue)) * (m_ScaleLinesMinorNumOf + 1))) * Math.PI / 180.0))); - } - } - } - - ggr.SetClip(ClientRectangle); - - if (m_ScaleNumbersRotation != 0) - { - ggr.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; - ggr.RotateTransform(90.0F + m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue)); - } - - /*ggr.TranslateTransform((Single)(Center.X + m_ScaleNumbersRadius * Math.Cos((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue)) * Math.PI / 180.0f)), - (Single)(Center.Y + m_ScaleNumbersRadius * Math.Sin((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue)) * Math.PI / 180.0f)), - System.Drawing.Drawing2D.MatrixOrder.Append);*/ - - ggr.TranslateTransform((Single)(Center.X * scale + m_ScaleNumbersRadius * scale * Math.Cos((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue)) * Math.PI / 180.0f)), - (Single)(Center.Y * scale + m_ScaleNumbersRadius * scale * Math.Sin((m_BaseArcStart + countValue * m_BaseArcSweep / (m_MaxValue - m_MinValue)) * Math.PI / 180.0f)), - System.Drawing.Drawing2D.MatrixOrder.Append); - - if (counter1 >= ScaleNumbersStartScaleLine - 1) - { - ggr.DrawString(valueText, Font, new SolidBrush(m_ScaleNumbersColor), -boundingBox.Width / 2, -fontBoundY1 - (fontBoundY2 - fontBoundY1 + 1) / 2, StringFormat.GenericTypographic); - } - - countValue += m_ScaleLinesMajorStepValue; - counter1 ++; - } - - ggr.ResetTransform(); - // scale it - if (basesize != null) - { - ggr.ScaleTransform(scale, scale); - } - ggr.SetClip(ClientRectangle); - - if (m_ScaleNumbersRotation != 0) - { - ggr.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; - } - - for (Int32 counter= 0; counter this.Height) - { - // this.Height = this.Width; - } - //else - { - this.Width = this.Height; - } - //this.Center = new Point(this.Width / 2, this.Width / 2); - - drawGaugeBackground = true; - Refresh(); - } - - public new Size Size { get { return base.Size; } set { base.Size = value; } } - - [System.ComponentModel.Browsable(true), - System.ComponentModel.Category("AGauge"), - System.ComponentModel.Description("Base Size the dials are designed for")] - public Size basesize { get { return _basesize; } set { _basesize = value; } } - - private Size _basesize = new Size(150,150); - -#endregion - - private void InitializeComponent() - { - this.SuspendLayout(); - // - // AGauge - // - this.BackColor = System.Drawing.Color.Transparent; - this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.DoubleBuffered = true; - this.Name = "AGauge"; - this.ResumeLayout(false); - - } - - } -} diff --git a/Tools/ArdupilotMegaPlanner/AGauge.resx b/Tools/ArdupilotMegaPlanner/AGauge.resx deleted file mode 100644 index 5ea0895e32..0000000000 --- a/Tools/ArdupilotMegaPlanner/AGauge.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index d7965d596b..8057a93af5 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -187,20 +187,36 @@ False ..\..\..\..\..\Desktop\DIYDrones\myquad\sharpkml\SharpKml\bin\Release\SharpKml.dll - - - + + False + + + False + + + False + ..\..\..\..\..\Desktop\DIYDrones\myquad\greatmaps_e1bb830a18a3\Demo.WindowsForms\bin\Debug\x86\System.Data.SQLite.DLL - - + + False + + + False + True - - - + + False + + + False + + + False + False ..\..\ArdupilotSim\ArdupilotSim\bin\Release\ZedGraph.dll diff --git a/Tools/ArdupilotMegaPlanner/Common.cs b/Tools/ArdupilotMegaPlanner/Common.cs index 6ee90dfbbf..11f8fbc24e 100644 --- a/Tools/ArdupilotMegaPlanner/Common.cs +++ b/Tools/ArdupilotMegaPlanner/Common.cs @@ -197,6 +197,12 @@ namespace ArdupilotMega } + public PointLatLngAlt(GMap.NET.PointLatLng pll) + { + this.Lat = pll.Lat; + this.Lng = pll.Lng; + } + public PointLatLng Point() { return new PointLatLng(Lat, Lng); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs index 88d9cc76ba..0367a47c15 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Firmware.cs @@ -685,7 +685,7 @@ namespace ArdupilotMega.GCSViews } } - lbl_status.Text = "Write Done... Waiting (60 sec)"; + lbl_status.Text = "Write Done... Waiting (90 sec)"; } else { @@ -698,8 +698,32 @@ namespace ArdupilotMega.GCSViews Application.DoEvents(); - System.Threading.Thread.Sleep(60000); // 10 seconds - new apvar erases eeprom on new format version, this should buy us some time. + try + { + ((SerialPort)port).Open(); + } + catch { } + DateTime startwait = DateTime.Now; + + while ((DateTime.Now - startwait).TotalSeconds < 90) + { + try + { + Console.Write(((SerialPort)port).ReadExisting().Replace("\0"," ")); + } + catch { } + System.Threading.Thread.Sleep(1000); + progress.Value = (int)((DateTime.Now - startwait).TotalSeconds / 90.0 * 100); + progress.Refresh(); + } + try + { + ((SerialPort)port).Close(); + } + catch { } + + progress.Value = 100; lbl_status.Text = "Done"; } catch (Exception ex) { lbl_status.Text = "Failed upload"; MessageBox.Show("Check port settings or Port in use? " + ex.ToString()); port.Close(); } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs index 9b8de50aa4..8ed38e719d 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs @@ -60,6 +60,7 @@ namespace ArdupilotMega.GCSViews CurveItem list10curve; internal static GMapOverlay kmlpolygons; + internal static GMapOverlay geofence; bool huddropout = false; bool huddropoutresize = false; @@ -92,9 +93,6 @@ namespace ArdupilotMega.GCSViews myhud = hud1; MainHcopy = MainH; - int checkme; - //Control.CheckForIllegalCrossThreadCalls = false; // so can update display from another thread - // setup default tuning graph if (MainV2.config["Tuning_Graph_Selected"] != null) { @@ -164,6 +162,9 @@ namespace ArdupilotMega.GCSViews kmlpolygons = new GMapOverlay(gMapControl1, "kmlpolygons"); gMapControl1.Overlays.Add(kmlpolygons); + geofence = new GMapOverlay(gMapControl1, "geofence"); + gMapControl1.Overlays.Add(geofence); + polygons = new GMapOverlay(gMapControl1, "polygons"); gMapControl1.Overlays.Add(polygons); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs index e391627a6f..3726f280f9 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.Designer.cs @@ -31,14 +31,14 @@ { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlightPlanner)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); this.CHK_altmode = new System.Windows.Forms.CheckBox(); this.CHK_holdalt = new System.Windows.Forms.CheckBox(); this.Commands = new System.Windows.Forms.DataGridView(); @@ -114,7 +114,7 @@ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.ContextMeasure = new System.Windows.Forms.ToolStripMenuItem(); this.rotateMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.gridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.polygonToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addPolygonPointToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.clearPolygonToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.clearMissionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -123,6 +123,9 @@ this.panelBASE = new System.Windows.Forms.Panel(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components); + this.geoFenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.GeoFenceuploadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.GeoFencedownloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.Commands)).BeginInit(); this.panel5.SuspendLayout(); this.panel1.SuspendLayout(); @@ -154,14 +157,14 @@ // this.Commands.AllowUserToAddRows = false; resources.ApplyResources(this.Commands, "Commands"); - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.Commands.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle17.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.Commands.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17; this.Commands.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Command, this.Param1, @@ -175,17 +178,17 @@ this.Up, this.Down}); this.Commands.Name = "Commands"; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle5.Format = "N0"; - dataGridViewCellStyle5.NullValue = "0"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - this.Commands.RowHeadersDefaultCellStyle = dataGridViewCellStyle5; - dataGridViewCellStyle6.ForeColor = System.Drawing.Color.Black; - this.Commands.RowsDefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle21.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle21.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle21.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle21.Format = "N0"; + dataGridViewCellStyle21.NullValue = "0"; + dataGridViewCellStyle21.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle21.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + this.Commands.RowHeadersDefaultCellStyle = dataGridViewCellStyle21; + dataGridViewCellStyle22.ForeColor = System.Drawing.Color.Black; + this.Commands.RowsDefaultCellStyle = dataGridViewCellStyle22; this.Commands.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.Commands_CellContentClick); this.Commands.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.Commands_CellEndEdit); this.Commands.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.Commands_DataError); @@ -197,9 +200,9 @@ // // Command // - dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(68)))), ((int)(((byte)(69))))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White; - this.Command.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(67)))), ((int)(((byte)(68)))), ((int)(((byte)(69))))); + dataGridViewCellStyle18.ForeColor = System.Drawing.Color.White; + this.Command.DefaultCellStyle = dataGridViewCellStyle18; this.Command.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox; resources.ApplyResources(this.Command, "Command"); this.Command.Name = "Command"; @@ -265,7 +268,7 @@ // // Up // - this.Up.DefaultCellStyle = dataGridViewCellStyle3; + this.Up.DefaultCellStyle = dataGridViewCellStyle19; resources.ApplyResources(this.Up, "Up"); this.Up.Image = global::ArdupilotMega.Properties.Resources.up; this.Up.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch; @@ -273,8 +276,8 @@ // // Down // - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.Down.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.Down.DefaultCellStyle = dataGridViewCellStyle20; resources.ApplyResources(this.Down, "Down"); this.Down.Image = global::ArdupilotMega.Properties.Resources.down; this.Down.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch; @@ -418,8 +421,8 @@ // // dataGridViewImageColumn1 // - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dataGridViewImageColumn1.DefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dataGridViewImageColumn1.DefaultCellStyle = dataGridViewCellStyle23; resources.ApplyResources(this.dataGridViewImageColumn1, "dataGridViewImageColumn1"); this.dataGridViewImageColumn1.Image = global::ArdupilotMega.Properties.Resources.up; this.dataGridViewImageColumn1.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch; @@ -427,8 +430,8 @@ // // dataGridViewImageColumn2 // - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.dataGridViewImageColumn2.DefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.dataGridViewImageColumn2.DefaultCellStyle = dataGridViewCellStyle24; resources.ApplyResources(this.dataGridViewImageColumn2, "dataGridViewImageColumn2"); this.dataGridViewImageColumn2.Image = global::ArdupilotMega.Properties.Resources.down; this.dataGridViewImageColumn2.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Stretch; @@ -722,8 +725,9 @@ this.toolStripSeparator1, this.ContextMeasure, this.rotateMapToolStripMenuItem, - this.gridToolStripMenuItem, - this.clearMissionToolStripMenuItem}); + this.polygonToolStripMenuItem, + this.clearMissionToolStripMenuItem, + this.geoFenceToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; resources.ApplyResources(this.contextMenuStrip1, "contextMenuStrip1"); // @@ -797,13 +801,13 @@ resources.ApplyResources(this.rotateMapToolStripMenuItem, "rotateMapToolStripMenuItem"); this.rotateMapToolStripMenuItem.Click += new System.EventHandler(this.rotateMapToolStripMenuItem_Click); // - // gridToolStripMenuItem + // polygonToolStripMenuItem // - this.gridToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.polygonToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addPolygonPointToolStripMenuItem, this.clearPolygonToolStripMenuItem}); - this.gridToolStripMenuItem.Name = "gridToolStripMenuItem"; - resources.ApplyResources(this.gridToolStripMenuItem, "gridToolStripMenuItem"); + this.polygonToolStripMenuItem.Name = "polygonToolStripMenuItem"; + resources.ApplyResources(this.polygonToolStripMenuItem, "polygonToolStripMenuItem"); // // addPolygonPointToolStripMenuItem // @@ -859,6 +863,26 @@ this.timer1.Interval = 1000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // + // geoFenceToolStripMenuItem + // + this.geoFenceToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.GeoFenceuploadToolStripMenuItem, + this.GeoFencedownloadToolStripMenuItem}); + this.geoFenceToolStripMenuItem.Name = "geoFenceToolStripMenuItem"; + resources.ApplyResources(this.geoFenceToolStripMenuItem, "geoFenceToolStripMenuItem"); + // + // GeoFenceuploadToolStripMenuItem + // + this.GeoFenceuploadToolStripMenuItem.Name = "GeoFenceuploadToolStripMenuItem"; + resources.ApplyResources(this.GeoFenceuploadToolStripMenuItem, "GeoFenceuploadToolStripMenuItem"); + this.GeoFenceuploadToolStripMenuItem.Click += new System.EventHandler(this.GeoFenceuploadToolStripMenuItem_Click); + // + // GeoFencedownloadToolStripMenuItem + // + this.GeoFencedownloadToolStripMenuItem.Name = "GeoFencedownloadToolStripMenuItem"; + resources.ApplyResources(this.GeoFencedownloadToolStripMenuItem, "GeoFencedownloadToolStripMenuItem"); + this.GeoFencedownloadToolStripMenuItem.Click += new System.EventHandler(this.GeoFencedownloadToolStripMenuItem_Click); + // // FlightPlanner // resources.ApplyResources(this, "$this"); @@ -946,7 +970,7 @@ private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ToolStripMenuItem rotateMapToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem clearMissionToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem gridToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem polygonToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addPolygonPointToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem clearPolygonToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem loiterToolStripMenuItem; @@ -973,5 +997,8 @@ private MyButton BUT_zoomto; private MyButton BUT_loadkml; private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.ToolStripMenuItem geoFenceToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem GeoFenceuploadToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem GeoFencedownloadToolStripMenuItem; } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs index a58792385c..96506ac0c9 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs @@ -447,6 +447,9 @@ namespace ArdupilotMega.GCSViews kmlpolygons = new GMapOverlay(MainMap, "kmlpolygons"); MainMap.Overlays.Add(kmlpolygons); + geofence = new GMapOverlay(MainMap, "geofence"); + MainMap.Overlays.Add(geofence); + routes = new GMapOverlay(MainMap, "routes"); MainMap.Overlays.Add(routes); @@ -1814,7 +1817,11 @@ namespace ArdupilotMega.GCSViews // polygons GMapPolygon polygon; GMapPolygon drawnpolygon; + GMapPolygon gf; + GMapOverlay kmlpolygons; + GMapOverlay geofence; + // layers GMapOverlay top; @@ -2948,5 +2955,71 @@ namespace ArdupilotMega.GCSViews } catch { } } + + private void GeoFenceuploadToolStripMenuItem_Click(object sender, EventArgs e) + { + //FENCE_TOTAL + if (MainV2.comPort.param["FENCE_ACTION"] == null) + { + MessageBox.Show("Not Supported"); + return; + } + + if (MainV2.comPort.param["FENCE_ACTION"].ToString() != "0") + MainV2.comPort.setParam("FENCE_ACTION", 0); + + MainV2.comPort.setParam("FENCE_TOTAL", drawnpolygon.Points.Count); + + byte a = 0; + + foreach (var pll in drawnpolygon.Points) + { + MainV2.comPort.setFencePoint(a, new PointLatLngAlt(pll), (byte)drawnpolygon.Points.Count); + a++; + } + + drawnpolygons.Polygons.Clear(); + drawnpolygons.Markers.Clear(); + + MainMap.Invalidate(); + } + + private void GeoFencedownloadToolStripMenuItem_Click(object sender, EventArgs e) + { + int count = 1; + + if (MainV2.comPort.param["FENCE_ACTION"] == null || MainV2.comPort.param["FENCE_TOTAL"] == null) + { + MessageBox.Show("Not Supported"); + return; + } + + if (int.Parse(MainV2.comPort.param["FENCE_TOTAL"].ToString()) == 0) + { + MessageBox.Show("Nothing to download"); + return; + } + + geofence.Polygons.Clear(); + + List polygonPoints = new List(); + + gf = new GMapPolygon(polygonPoints, "geofence"); + gf.Stroke = new Pen(Color.Pink, 5); + geofence.Polygons.Add(gf); + + FlightData.geofence.Polygons.Clear(); + FlightData.geofence.Polygons.Add(gf); + + for (int a = 0; a < count; a++) + { + PointLatLngAlt plla = MainV2.comPort.getFencePoint(a, ref count); + gf.Points.Add(new PointLatLng(plla.Lat, plla.Lng)); + } + + MainMap.UpdatePolygonLocalPosition(gf); + + MainMap.Invalidate(); + } } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx index 8aeb579016..f711edf4d9 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.resx @@ -537,6 +537,75 @@ Bottom, Right + + BUT_write + + + ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + panel5 + + + 0 + + + BUT_read + + + ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + panel5 + + + 1 + + + SaveFile + + + ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + panel5 + + + 2 + + + BUT_loadwpfile + + + ArdupilotMega.MyButton, ArdupilotMegaPlanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=38326cb7e06851fc + + + panel5 + + + 3 + + + 8, 250 + + + 117, 114 + + + 29 + + + panel5 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panelAction + + + 1 + NoControl @@ -645,30 +714,114 @@ 3 - - 8, 250 - - - 117, 114 - - - 29 - - - panel5 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panelAction - - - 1 - Bottom, Right + + label4 + + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 0 + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 1 + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 2 + + + Label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 3 + + + TXT_homealt + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 4 + + + TXT_homelng + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 5 + + + TXT_homelat + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel1 + + + 6 + + + 8, 365 + + + 117, 89 + + + 31 + + + panel1 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panelAction + + + 2 + True @@ -852,27 +1005,6 @@ 6 - - 8, 365 - - - 117, 89 - - - 31 - - - panel1 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panelAction - - - 2 - Up @@ -912,6 +1044,111 @@ Bottom, Right + + label7 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 0 + + + label8 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 1 + + + label9 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 2 + + + label10 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 3 + + + TXT_mousealt + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 4 + + + TXT_mouselong + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 5 + + + TXT_mouselat + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 6 + + + 8, 130 + + + 114, 79 + + + 38 + + + panel2 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panelAction + + + 3 + True @@ -1095,27 +1332,9 @@ 6 - - 8, 130 - - - 114, 79 - - - 38 - - - panel2 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panelAction - - - 3 - + + 172, 17 + Bottom, Right @@ -1128,9 +1347,6 @@ 42 - - 172, 17 - Change the current map type @@ -1605,42 +1821,12 @@ Delete WP - - 113, 22 - - - Forever - - - 113, 22 - - - Time - - - 113, 22 - - - Circles - 167, 22 Loiter - - 102, 22 - - - Start - - - 102, 22 - - - WP # - 167, 22 @@ -1662,23 +1848,11 @@ Rotate Map - - 174, 22 - - - Add Polygon Point - - - 174, 22 - - - Clear Polygon - - + 167, 22 - - Grid Polygon + + Draw Polygon 167, 22 @@ -1686,8 +1860,26 @@ Clear Mission + + 152, 22 + + + Upload + + + 152, 22 + + + Download + + + 167, 22 + + + Geo-Fence + - 168, 164 + 168, 208 contextMenuStrip1 @@ -1951,6 +2143,48 @@ 1 + + 113, 22 + + + Forever + + + 113, 22 + + + Time + + + 113, 22 + + + Circles + + + 102, 22 + + + Start + + + 102, 22 + + + WP # + + + 174, 22 + + + Add Polygon Point + + + 174, 22 + + + Clear Polygon + Fill @@ -1975,6 +2209,9 @@ 1 + + 172, 17 + 269, 17 @@ -2134,10 +2371,10 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - gridToolStripMenuItem + + polygonToolStripMenuItem - + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -2170,6 +2407,24 @@ System.Windows.Forms.Timer, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + geoFenceToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + GeoFenceuploadToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + GeoFencedownloadToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + FlightPlanner diff --git a/Tools/ArdupilotMegaPlanner/JoystickSetup.cs b/Tools/ArdupilotMegaPlanner/JoystickSetup.cs index 6e6d33511a..ce492aa7ae 100644 --- a/Tools/ArdupilotMegaPlanner/JoystickSetup.cs +++ b/Tools/ArdupilotMegaPlanner/JoystickSetup.cs @@ -295,7 +295,7 @@ namespace ArdupilotMega ((HorizontalProgressBar)this.Controls.Find("hbar" + name, false)[0]).Value = MainV2.joystick.isButtonPressed(f) ? 100 : 0; } } - catch (Exception ex) { } + catch { } // this is for buttons - silent fail } diff --git a/Tools/ArdupilotMegaPlanner/Log.cs b/Tools/ArdupilotMegaPlanner/Log.cs index 4fe8b67da1..654a06ed44 100644 --- a/Tools/ArdupilotMegaPlanner/Log.cs +++ b/Tools/ArdupilotMegaPlanner/Log.cs @@ -966,7 +966,7 @@ namespace ArdupilotMega byte[] buffer = new byte[4096]; using (FileStream streamReader = File.OpenRead(filename)) { - StreamUtils.Copy(streamReader, zipStream, buffer); + StreamUtils.Copy(streamReader, zipStream, buffer); } zipStream.CloseEntry(); diff --git a/Tools/ArdupilotMegaPlanner/MAVLink.cs b/Tools/ArdupilotMegaPlanner/MAVLink.cs index 5482c776a3..9142c992b2 100644 --- a/Tools/ArdupilotMegaPlanner/MAVLink.cs +++ b/Tools/ArdupilotMegaPlanner/MAVLink.cs @@ -2252,6 +2252,95 @@ namespace ArdupilotMega } } + public PointLatLngAlt getFencePoint(int no, ref int total) + { + byte[] buffer; + + MainV2.givecomport = true; + + PointLatLngAlt plla = new PointLatLngAlt(); + __mavlink_fence_fetch_point_t req = new __mavlink_fence_fetch_point_t(); + + req.idx = (byte)no; + req.target_component = compid; + req.target_system = sysid; + + // request point + generatePacket(MAVLINK_MSG_ID_FENCE_FETCH_POINT, req); + + DateTime start = DateTime.Now; + int retrys = 3; + + while (true) + { + if (!(start.AddMilliseconds(500) > DateTime.Now)) + { + if (retrys > 0) + { + Console.WriteLine("getFencePoint Retry " + retrys + " - giv com " + MainV2.givecomport); + generatePacket(MAVLINK_MSG_ID_FENCE_FETCH_POINT, req); + start = DateTime.Now; + retrys--; + continue; + } + MainV2.givecomport = false; + throw new Exception("Timeout on read - getFencePoint"); + } + + buffer = readPacket(); + if (buffer.Length > 5) + { + if (buffer[5] == MAVLINK_MSG_ID_FENCE_POINT) + { + MainV2.givecomport = false; + + __mavlink_fence_point_t fp = new __mavlink_fence_point_t(); + + object structtemp = (object)fp; + + ByteArrayToStructure(buffer, ref structtemp, 6); + + fp = (__mavlink_fence_point_t)(structtemp); + + plla.Lat = fp.lat; + plla.Lng = fp.lng; + plla.Tag = fp.idx.ToString(); + + total = fp.count; + + return plla; + } + } + } + } + + public bool setFencePoint(byte index, PointLatLngAlt plla,byte fencepointcount) + { + __mavlink_fence_point_t fp = new __mavlink_fence_point_t(); + + fp.idx = index; + fp.count = fencepointcount; + fp.lat = (float)plla.Lat; + fp.lng = (float)plla.Lng; + fp.target_component = compid; + fp.target_system = sysid; + + int retry = 3; + + while (retry > 0) + { + generatePacket(MAVLINK_MSG_ID_FENCE_POINT, fp); + int counttemp = 0; + PointLatLngAlt newfp = getFencePoint(fp.idx, ref counttemp); + + if (newfp.Lat == plla.Lat && newfp.Lng == fp.lng) + return true; + retry--; + } + + return false; + } + byte[] readlogPacket() { byte[] temp = new byte[300]; diff --git a/Tools/ArdupilotMegaPlanner/MAVLinkTypes0.9.cs b/Tools/ArdupilotMegaPlanner/MAVLinkTypes0.9.cs index 8a0d729592..be128df151 100644 --- a/Tools/ArdupilotMegaPlanner/MAVLinkTypes0.9.cs +++ b/Tools/ArdupilotMegaPlanner/MAVLinkTypes0.9.cs @@ -8,41 +8,8 @@ namespace ArdupilotMega #if !MAVLINK10 partial class MAVLink { - // from 1.0 - public enum MAV_AUTOPILOT - { - MAV_AUTOPILOT_GENERIC = 0, /* Generic autopilot, full support for everything | */ - MAV_AUTOPILOT_PIXHAWK = 1, /* PIXHAWK autopilot, http://pixhawk.ethz.ch | */ - MAV_AUTOPILOT_SLUGS = 2, /* SLUGS autopilot, http://slugsuav.soe.ucsc.edu | */ - MAV_AUTOPILOT_ARDUPILOTMEGA = 3, /* ArduPilotMega / ArduCopter, http://diydrones.com | */ - MAV_AUTOPILOT_OPENPILOT = 4, /* OpenPilot, http://openpilot.org | */ - MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY = 5, /* Generic autopilot only supporting simple waypoints | */ - MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY = 6, /* Generic autopilot supporting waypoints and other simple navigation commands | */ - MAV_AUTOPILOT_GENERIC_MISSION_FULL = 7, /* Generic autopilot supporting the full mission command set | */ - MAV_AUTOPILOT_INVALID = 8, /* No valid autopilot, e.g. a GCS or other MAVLink component | */ - MAV_AUTOPILOT_PPZ = 9, /* PPZ UAV - http://nongnu.org/paparazzi | */ - MAV_AUTOPILOT_UDB = 10, /* UAV Dev Board | */ - MAV_AUTOPILOT_FP = 11, /* FlexiPilot | */ - MAV_AUTOPILOT_ENUM_END = 12, /* | */ - }; - - public enum MAV_MODE_FLAG - { - MAV_MODE_FLAG_CUSTOM_MODE_ENABLED = 1, /* 0b00000001 Reserved for future use. | */ - MAV_MODE_FLAG_TEST_ENABLED = 2, /* 0b00000010 system has a test mode enabled. This flag is intended for temporary system tests and should not be used for stable implementations. | */ - MAV_MODE_FLAG_AUTO_ENABLED = 4, /* 0b00000100 autonomous mode enabled, system finds its own goal positions. Guided flag can be set or not, depends on the actual implementation. | */ - MAV_MODE_FLAG_GUIDED_ENABLED = 8, /* 0b00001000 guided mode enabled, system flies MISSIONs / mission items. | */ - MAV_MODE_FLAG_STABILIZE_ENABLED = 16, /* 0b00010000 system stabilizes electronically its attitude (and optionally position). It needs however further control inputs to move around. | */ - MAV_MODE_FLAG_HIL_ENABLED = 32, /* 0b00100000 hardware in the loop simulation. All motors / actuators are blocked, but internal software is full operational. | */ - MAV_MODE_FLAG_MANUAL_INPUT_ENABLED = 64, /* 0b01000000 remote control input is enabled. | */ - MAV_MODE_FLAG_SAFETY_ARMED = 128, /* 0b10000000 MAV safety set to armed. Motors are enabled / running / can start. Ready to fly. | */ - MAV_MODE_FLAG_ENUM_END = 129, /* | */ - }; - - //end 1.0 - - public byte[] MAVLINK_MESSAGE_LENGTHS = new byte[] {3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 18, 18, 24, 24, 0, 0, 0, 26, 16, 36, 5, 6, 56, 26, 21, 18, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 8, 4, 12, 15, 13, 6, 15, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51, 5}; - public byte[] MAVLINK_MESSAGE_CRCS = new byte[] {72, 39, 190, 92, 191, 217, 104, 119, 0, 219, 60, 186, 10, 0, 0, 0, 0, 0, 0, 0, 89, 159, 162, 121, 0, 149, 222, 110, 179, 136, 66, 126, 185, 147, 112, 252, 162, 215, 229, 128, 9, 106, 101, 213, 4, 229, 21, 214, 215, 14, 206, 50, 157, 126, 108, 213, 95, 5, 127, 0, 0, 0, 57, 126, 130, 119, 193, 191, 236, 158, 143, 0, 0, 104, 123, 131, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 29, 208, 188, 118, 242, 19, 97, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 224, 60, 106, 7}; + public byte[] MAVLINK_MESSAGE_LENGTHS = new byte[] {3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 18, 18, 24, 24, 0, 0, 0, 26, 16, 36, 5, 6, 56, 26, 21, 18, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 8, 4, 12, 15, 13, 6, 15, 14, 0, 12, 3, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51, 5}; + public byte[] MAVLINK_MESSAGE_CRCS = new byte[] {72, 39, 190, 92, 191, 217, 104, 119, 0, 219, 60, 186, 10, 0, 0, 0, 0, 0, 0, 0, 89, 159, 162, 121, 0, 149, 222, 110, 179, 136, 66, 126, 185, 147, 112, 252, 162, 215, 229, 128, 9, 106, 101, 213, 4, 229, 21, 214, 215, 14, 206, 50, 157, 126, 108, 213, 95, 5, 127, 0, 0, 0, 57, 126, 130, 119, 193, 191, 236, 158, 143, 0, 0, 104, 123, 131, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 29, 208, 188, 118, 242, 19, 97, 233, 0, 18, 68, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 224, 60, 106, 7}; public enum MAV_MOUNT_MODE { MAV_MOUNT_MODE_RETRACT=0, /* Load and keep safe position (Roll,Pitch,Yaw) from EEPROM and stop stabilization | */ @@ -53,141 +20,6 @@ namespace ArdupilotMega MAV_MOUNT_MODE_ENUM_END=5, /* | */ }; - public const byte MAVLINK_MSG_ID_AP_ADC = 153; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_ap_adc_t - { - public ushort adc1; /// ADC output 1 - public ushort adc2; /// ADC output 2 - public ushort adc3; /// ADC output 3 - public ushort adc4; /// ADC output 4 - public ushort adc5; /// ADC output 5 - public ushort adc6; /// ADC output 6 - }; - - public const byte MAVLINK_MSG_ID_AP_ADC_LEN = 12; - public const byte MAVLINK_MSG_ID_153_LEN = 12; - public const byte MAVLINK_MSG_ID_DIGICAM_CONFIGURE = 154; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_digicam_configure_t - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public byte mode; /// Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore) - public ushort shutter_speed; /// Divisor number //e.g. 1000 means 1/1000 (0 means ignore) - public byte aperture; /// F stop number x 10 //e.g. 28 means 2.8 (0 means ignore) - public byte iso; /// ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore) - public byte exposure_type; /// Exposure type enumeration from 1 to N (0 means ignore) - public byte command_id; /// Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once - public byte engine_cut_off; /// Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off) - public byte extra_param; /// Extra parameters enumeration (0 means ignore) - public float extra_value; /// Correspondent value to given extra_param - }; - - public const byte MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN = 15; - public const byte MAVLINK_MSG_ID_154_LEN = 15; - public const byte MAVLINK_MSG_ID_DIGICAM_CONTROL = 155; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_digicam_control_t - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public byte session; /// 0: stop, 1: start or keep it up //Session control e.g. show/hide lens - public byte zoom_pos; /// 1 to N //Zoom's absolute position (0 means ignore) - public byte zoom_step; /// -100 to 100 //Zooming step value to offset zoom from the current position - public byte focus_lock; /// 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus - public byte shot; /// 0: ignore, 1: shot or start filming - public byte command_id; /// Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once - public byte extra_param; /// Extra parameters enumeration (0 means ignore) - public float extra_value; /// Correspondent value to given extra_param - }; - - public const byte MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN = 13; - public const byte MAVLINK_MSG_ID_155_LEN = 13; - public const byte MAVLINK_MSG_ID_MEMINFO = 152; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_meminfo_t - { - public ushort brkval; /// heap top - public ushort freemem; /// free memory - }; - - public const byte MAVLINK_MSG_ID_MEMINFO_LEN = 4; - public const byte MAVLINK_MSG_ID_152_LEN = 4; - public const byte MAVLINK_MSG_ID_MOUNT_CONFIGURE = 156; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_mount_configure_t - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public byte mount_mode; /// mount operating mode (see MAV_MOUNT_MODE enum) - public byte stab_roll; /// (1 = yes, 0 = no) - public byte stab_pitch; /// (1 = yes, 0 = no) - public byte stab_yaw; /// (1 = yes, 0 = no) - }; - - public const byte MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN = 6; - public const byte MAVLINK_MSG_ID_156_LEN = 6; - public const byte MAVLINK_MSG_ID_MOUNT_CONTROL = 157; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_mount_control_t - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public int input_a; /// pitch(deg*100) or lat, depending on mount mode - public int input_b; /// roll(deg*100) or lon depending on mount mode - public int input_c; /// yaw(deg*100) or alt (in cm) depending on mount mode - public byte save_position; /// if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) - }; - - public const byte MAVLINK_MSG_ID_MOUNT_CONTROL_LEN = 15; - public const byte MAVLINK_MSG_ID_157_LEN = 15; - public const byte MAVLINK_MSG_ID_MOUNT_STATUS = 158; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_mount_status_t - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public int pointing_a; /// pitch(deg*100) or lat, depending on mount mode - public int pointing_b; /// roll(deg*100) or lon depending on mount mode - public int pointing_c; /// yaw(deg*100) or alt (in cm) depending on mount mode - }; - - public const byte MAVLINK_MSG_ID_MOUNT_STATUS_LEN = 14; - public const byte MAVLINK_MSG_ID_158_LEN = 14; - public const byte MAVLINK_MSG_ID_SENSOR_OFFSETS = 150; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_sensor_offsets_t - { - public short mag_ofs_x; /// magnetometer X offset - public short mag_ofs_y; /// magnetometer Y offset - public short mag_ofs_z; /// magnetometer Z offset - public float mag_declination; /// magnetic declination (radians) - public int raw_press; /// raw pressure from barometer - public int raw_temp; /// raw temperature from barometer - public float gyro_cal_x; /// gyro X calibration - public float gyro_cal_y; /// gyro Y calibration - public float gyro_cal_z; /// gyro Z calibration - public float accel_cal_x; /// accel X calibration - public float accel_cal_y; /// accel Y calibration - public float accel_cal_z; /// accel Z calibration - }; - - public const byte MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN = 42; - public const byte MAVLINK_MSG_ID_150_LEN = 42; - public const byte MAVLINK_MSG_ID_SET_MAG_OFFSETS = 151; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_set_mag_offsets_t - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public short mag_ofs_x; /// magnetometer X offset - public short mag_ofs_y; /// magnetometer Y offset - public short mag_ofs_z; /// magnetometer Z offset - }; - - public const byte MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN = 8; - public const byte MAVLINK_MSG_ID_151_LEN = 8; public enum MAV_CMD { WAYPOINT=16, /* Navigate to waypoint. |Hold time in decimal seconds. (ignored by fixed wing, time to stay at waypoint for rotary wing)| Acceptance radius in meters (if the sphere with this radius is hit, the waypoint counts as reached)| 0 to pass through the WP, if > 0 radius in meters to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at waypoint (rotary wing)| Latitude| Longitude| Altitude| */ @@ -225,7 +57,7 @@ namespace ArdupilotMega |Region of interest mode. (see MAV_ROI enum)| Waypoint index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple cameras etc.)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ DO_DIGICAM_CONFIGURE=202, /* Mission command to configure an on-board camera controller system. |Modes: P, TV, AV, M, Etc| Shutter speed: Divisor number for one second| Aperture: F stop number| ISO number e.g. 80, 100, 200, Etc| Exposure type enumerator| Command Identity| Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)| */ DO_DIGICAM_CONTROL=203, /* Mission command to control an on-board camera controller system. |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Empty| */ - DO_MOUNT_CONFIGURE=204, /* Mission command to configure a camera or antenna mount |Mount operation mode (see MAV_CONFIGURE_MOUNT_MODE enum)| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| Empty| Empty| Empty| */ + DO_MOUNT_CONFIGURE=204, /* Mission command to configure a camera or antenna mount |Mount operation mode (see MAV_MOUNT_MODE enum)| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| Empty| Empty| Empty| */ DO_MOUNT_CONTROL=205, /* Mission command to control a camera or antenna mount |pitch(deg*100) or lat, depending on mount mode.| roll(deg*100) or lon depending on mount mode| yaw(deg*100) or alt (in cm) depending on mount mode| Empty| Empty| Empty| Empty| */ DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. |Gyro calibration: 0: no, 1: yes| Magnetometer calibration: 0: no, 1: yes| Ground pressure: 0: no, 1: yes| Radio calibration: 0: no, 1: yes| Empty| Empty| Empty| */ @@ -233,6 +65,185 @@ namespace ArdupilotMega ENUM_END=246, /* | */ }; + public const byte MAVLINK_MSG_ID_AP_ADC = 153; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_ap_adc_t + { + public ushort adc1; /// ADC output 1 + public ushort adc2; /// ADC output 2 + public ushort adc3; /// ADC output 3 + public ushort adc4; /// ADC output 4 + public ushort adc5; /// ADC output 5 + public ushort adc6; /// ADC output 6 + }; + + public const byte MAVLINK_MSG_ID_AP_ADC_LEN = 12; + public const byte MAVLINK_MSG_ID_DIGICAM_CONFIGURE = 154; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_digicam_configure_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte mode; /// Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore) + public ushort shutter_speed; /// Divisor number //e.g. 1000 means 1/1000 (0 means ignore) + public byte aperture; /// F stop number x 10 //e.g. 28 means 2.8 (0 means ignore) + public byte iso; /// ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore) + public byte exposure_type; /// Exposure type enumeration from 1 to N (0 means ignore) + public byte command_id; /// Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once + public byte engine_cut_off; /// Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off) + public byte extra_param; /// Extra parameters enumeration (0 means ignore) + public float extra_value; /// Correspondent value to given extra_param + }; + + public const byte MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN = 15; + public const byte MAVLINK_MSG_ID_DIGICAM_CONTROL = 155; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_digicam_control_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte session; /// 0: stop, 1: start or keep it up //Session control e.g. show/hide lens + public byte zoom_pos; /// 1 to N //Zoom's absolute position (0 means ignore) + public byte zoom_step; /// -100 to 100 //Zooming step value to offset zoom from the current position + public byte focus_lock; /// 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus + public byte shot; /// 0: ignore, 1: shot or start filming + public byte command_id; /// Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once + public byte extra_param; /// Extra parameters enumeration (0 means ignore) + public float extra_value; /// Correspondent value to given extra_param + }; + + public const byte MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN = 13; + public const byte MAVLINK_MSG_ID_FENCED_FETCH_POINT = 161; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_fenced_fetch_point_t + { + public byte idx; /// point index (first point is 1, 0 is for return point) + }; + + public const byte MAVLINK_MSG_ID_FENCED_FETCH_POINT_LEN = 1; + public const byte MAVLINK_MSG_ID_FENCED_POINT = 160; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_fenced_point_t + { + public byte idx; /// point index (first point is 1, 0 is for return point) + public byte count; /// total number of points (for sanity checking) + public float lat; /// Latitude of point + public float lng; /// Longitude of point + }; + + public const byte MAVLINK_MSG_ID_FENCED_POINT_LEN = 10; + public const byte MAVLINK_MSG_ID_FENCE_FETCH_POINT = 161; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_fence_fetch_point_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte idx; /// point index (first point is 1, 0 is for return point) + }; + + public const byte MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN = 3; + public const byte MAVLINK_MSG_ID_FENCE_POINT = 160; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_fence_point_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte idx; /// point index (first point is 1, 0 is for return point) + public byte count; /// total number of points (for sanity checking) + public float lat; /// Latitude of point + public float lng; /// Longitude of point + }; + + public const byte MAVLINK_MSG_ID_FENCE_POINT_LEN = 12; + public const byte MAVLINK_MSG_ID_FENCE_STATUS = 162; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_fence_status_t + { + public byte breach_status; /// 0 if currently inside fence, 1 if outside + public ushort breach_count; /// number of fence breaches + public byte breach_type; /// last breach type (see FENCE_BREACH_* enum) + public uint breach_time; /// time of last breach in milliseconds since boot + }; + + public const byte MAVLINK_MSG_ID_FENCE_STATUS_LEN = 8; + public const byte MAVLINK_MSG_ID_MEMINFO = 152; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_meminfo_t + { + public ushort brkval; /// heap top + public ushort freemem; /// free memory + }; + + public const byte MAVLINK_MSG_ID_MEMINFO_LEN = 4; + public const byte MAVLINK_MSG_ID_MOUNT_CONFIGURE = 156; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mount_configure_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte mount_mode; /// mount operating mode (see MAV_MOUNT_MODE enum) + public byte stab_roll; /// (1 = yes, 0 = no) + public byte stab_pitch; /// (1 = yes, 0 = no) + public byte stab_yaw; /// (1 = yes, 0 = no) + }; + + public const byte MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN = 6; + public const byte MAVLINK_MSG_ID_MOUNT_CONTROL = 157; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mount_control_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public int input_a; /// pitch(deg*100) or lat, depending on mount mode + public int input_b; /// roll(deg*100) or lon depending on mount mode + public int input_c; /// yaw(deg*100) or alt (in cm) depending on mount mode + public byte save_position; /// if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) + }; + + public const byte MAVLINK_MSG_ID_MOUNT_CONTROL_LEN = 15; + public const byte MAVLINK_MSG_ID_MOUNT_STATUS = 158; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mount_status_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public int pointing_a; /// pitch(deg*100) or lat, depending on mount mode + public int pointing_b; /// roll(deg*100) or lon depending on mount mode + public int pointing_c; /// yaw(deg*100) or alt (in cm) depending on mount mode + }; + + public const byte MAVLINK_MSG_ID_MOUNT_STATUS_LEN = 14; + public const byte MAVLINK_MSG_ID_SENSOR_OFFSETS = 150; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_sensor_offsets_t + { + public short mag_ofs_x; /// magnetometer X offset + public short mag_ofs_y; /// magnetometer Y offset + public short mag_ofs_z; /// magnetometer Z offset + public float mag_declination; /// magnetic declination (radians) + public int raw_press; /// raw pressure from barometer + public int raw_temp; /// raw temperature from barometer + public float gyro_cal_x; /// gyro X calibration + public float gyro_cal_y; /// gyro Y calibration + public float gyro_cal_z; /// gyro Z calibration + public float accel_cal_x; /// accel X calibration + public float accel_cal_y; /// accel Y calibration + public float accel_cal_z; /// accel Z calibration + }; + + public const byte MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN = 42; + public const byte MAVLINK_MSG_ID_SET_MAG_OFFSETS = 151; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_set_mag_offsets_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public short mag_ofs_x; /// magnetometer X offset + public short mag_ofs_y; /// magnetometer Y offset + public short mag_ofs_z; /// magnetometer Z offset + }; + + public const byte MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN = 8; public enum MAV_DATA_STREAM { MAV_DATA_STREAM_ALL=0, /* Enable all data streams | */ @@ -267,7 +278,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_ACTION_LEN = 3; - public const byte MAVLINK_MSG_ID_10_LEN = 3; public const byte MAVLINK_MSG_ID_ACTION_ACK = 9; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_action_ack_t @@ -277,7 +287,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_ACTION_ACK_LEN = 2; - public const byte MAVLINK_MSG_ID_9_LEN = 2; public const byte MAVLINK_MSG_ID_ATTITUDE = 30; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_attitude_t @@ -292,19 +301,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_ATTITUDE_LEN = 32; - public const byte MAVLINK_MSG_ID_30_LEN = 32; - public const byte MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT = 60; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_attitude_controller_output_t - { - public byte enabled; /// 1: enabled, 0: disabled - public byte roll; /// Attitude roll: -128: -100%, 127: +100% - public byte pitch; /// Attitude pitch: -128: -100%, 127: +100% - public byte yaw; /// Attitude yaw: -128: -100%, 127: +100% - public byte thrust; /// Attitude thrust: -128: -100%, 127: +100% - - }; - public const byte MAVLINK_MSG_ID_AUTH_KEY = 7; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_auth_key_t @@ -312,11 +308,10 @@ namespace ArdupilotMega [MarshalAs( UnmanagedType.ByValArray, SizeConst=32)] - char key; /// key + public byte[] key; /// key }; public const byte MAVLINK_MSG_ID_AUTH_KEY_LEN = 32; - public const byte MAVLINK_MSG_ID_7_LEN = 32; public const byte MAVLINK_MSG_ID_BOOT = 1; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_boot_t @@ -325,7 +320,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_BOOT_LEN = 4; - public const byte MAVLINK_MSG_ID_1_LEN = 4; public const byte MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL = 5; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_change_operator_control_t @@ -336,11 +330,10 @@ namespace ArdupilotMega [MarshalAs( UnmanagedType.ByValArray, SizeConst=25)] - char passkey; /// Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-" + public byte[] passkey; /// Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-" }; public const byte MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN = 28; - public const byte MAVLINK_MSG_ID_5_LEN = 28; public const byte MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK = 6; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_change_operator_control_ack_t @@ -351,7 +344,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN = 3; - public const byte MAVLINK_MSG_ID_6_LEN = 3; public const byte MAVLINK_MSG_ID_COMMAND = 75; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_command_t @@ -367,7 +359,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_COMMAND_LEN = 20; - public const byte MAVLINK_MSG_ID_75_LEN = 20; public const byte MAVLINK_MSG_ID_COMMAND_ACK = 76; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_command_ack_t @@ -377,7 +368,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_COMMAND_ACK_LEN = 8; - public const byte MAVLINK_MSG_ID_76_LEN = 8; public const byte MAVLINK_MSG_ID_CONTROL_STATUS = 52; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_control_status_t @@ -393,7 +383,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_CONTROL_STATUS_LEN = 8; - public const byte MAVLINK_MSG_ID_52_LEN = 8; public const byte MAVLINK_MSG_ID_DEBUG = 255; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_debug_t @@ -403,7 +392,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_DEBUG_LEN = 5; - public const byte MAVLINK_MSG_ID_255_LEN = 5; public const byte MAVLINK_MSG_ID_DEBUG_VECT = 251; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_debug_vect_t @@ -411,7 +399,7 @@ namespace ArdupilotMega [MarshalAs( UnmanagedType.ByValArray, SizeConst=10)] - char name; /// Name + public byte[] name; /// Name public ulong usec; /// Timestamp public float x; /// x public float y; /// y @@ -419,30 +407,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_DEBUG_VECT_LEN = 30; - public const byte MAVLINK_MSG_ID_251_LEN = 30; - public const byte MAVLINK_MSG_ID_FULL_STATE = 67; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_full_state_t - { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) - public float roll; /// Roll angle (rad) - public float pitch; /// Pitch angle (rad) - public float yaw; /// Yaw angle (rad) - public float rollspeed; /// Roll angular speed (rad/s) - public float pitchspeed; /// Pitch angular speed (rad/s) - public float yawspeed; /// Yaw angular speed (rad/s) - public int lat; /// Latitude, expressed as * 1E7 - public int lon; /// Longitude, expressed as * 1E7 - public int alt; /// Altitude in meters, expressed as * 1000 (millimeters) - public short vx; /// Ground X Speed (Latitude), expressed as m/s * 100 - public short vy; /// Ground Y Speed (Longitude), expressed as m/s * 100 - public short vz; /// Ground Z Speed (Altitude), expressed as m/s * 100 - public short xacc; /// X acceleration (mg) - public short yacc; /// Y acceleration (mg) - public short zacc; /// Z acceleration (mg) - - }; - public const byte MAVLINK_MSG_ID_GLOBAL_POSITION = 33; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_global_position_t @@ -457,7 +421,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_GLOBAL_POSITION_LEN = 32; - public const byte MAVLINK_MSG_ID_33_LEN = 32; public const byte MAVLINK_MSG_ID_GLOBAL_POSITION_INT = 73; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_global_position_int_t @@ -471,7 +434,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN = 18; - public const byte MAVLINK_MSG_ID_73_LEN = 18; public const byte MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET = 49; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_gps_local_origin_set_t @@ -482,7 +444,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET_LEN = 12; - public const byte MAVLINK_MSG_ID_49_LEN = 12; public const byte MAVLINK_MSG_ID_GPS_RAW = 32; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_gps_raw_t @@ -499,7 +460,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_GPS_RAW_LEN = 37; - public const byte MAVLINK_MSG_ID_32_LEN = 37; public const byte MAVLINK_MSG_ID_GPS_RAW_INT = 25; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_gps_raw_int_t @@ -516,7 +476,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_GPS_RAW_INT_LEN = 37; - public const byte MAVLINK_MSG_ID_25_LEN = 37; public const byte MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN = 48; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_gps_set_global_origin_t @@ -529,7 +488,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN_LEN = 14; - public const byte MAVLINK_MSG_ID_48_LEN = 14; public const byte MAVLINK_MSG_ID_GPS_STATUS = 27; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_gps_status_t @@ -558,7 +516,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_GPS_STATUS_LEN = 101; - public const byte MAVLINK_MSG_ID_27_LEN = 101; public const byte MAVLINK_MSG_ID_HEARTBEAT = 0; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_heartbeat_t @@ -569,7 +526,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_HEARTBEAT_LEN = 3; - public const byte MAVLINK_MSG_ID_0_LEN = 3; public const byte MAVLINK_MSG_ID_HIL_CONTROLS = 68; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_hil_controls_t @@ -584,7 +540,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_HIL_CONTROLS_LEN = 26; - public const byte MAVLINK_MSG_ID_68_LEN = 26; public const byte MAVLINK_MSG_ID_HIL_STATE = 67; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_hil_state_t @@ -608,7 +563,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_HIL_STATE_LEN = 56; - public const byte MAVLINK_MSG_ID_67_LEN = 56; public const byte MAVLINK_MSG_ID_LOCAL_POSITION = 31; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_local_position_t @@ -623,7 +577,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_LOCAL_POSITION_LEN = 32; - public const byte MAVLINK_MSG_ID_31_LEN = 32; public const byte MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT = 51; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_local_position_setpoint_t @@ -635,7 +588,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_LEN = 16; - public const byte MAVLINK_MSG_ID_51_LEN = 16; public const byte MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_SET = 50; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_local_position_setpoint_set_t @@ -649,7 +601,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_SET_LEN = 18; - public const byte MAVLINK_MSG_ID_50_LEN = 18; public const byte MAVLINK_MSG_ID_MANUAL_CONTROL = 69; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_manual_control_t @@ -666,7 +617,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_MANUAL_CONTROL_LEN = 21; - public const byte MAVLINK_MSG_ID_69_LEN = 21; public const byte MAVLINK_MSG_ID_NAMED_VALUE_FLOAT = 252; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_named_value_float_t @@ -674,12 +624,11 @@ namespace ArdupilotMega [MarshalAs( UnmanagedType.ByValArray, SizeConst=10)] - char name; /// Name of the debug variable + public byte[] name; /// Name of the debug variable public float value; /// Floating point value }; public const byte MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN = 14; - public const byte MAVLINK_MSG_ID_252_LEN = 14; public const byte MAVLINK_MSG_ID_NAMED_VALUE_INT = 253; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_named_value_int_t @@ -687,12 +636,11 @@ namespace ArdupilotMega [MarshalAs( UnmanagedType.ByValArray, SizeConst=10)] - char name; /// Name of the debug variable + public byte[] name; /// Name of the debug variable public int value; /// Signed integer value }; public const byte MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN = 14; - public const byte MAVLINK_MSG_ID_253_LEN = 14; public const byte MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT = 62; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_nav_controller_output_t @@ -708,7 +656,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN = 26; - public const byte MAVLINK_MSG_ID_62_LEN = 26; public const byte MAVLINK_MSG_ID_OBJECT_DETECTION_EVENT = 140; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_object_detection_event_t @@ -719,14 +666,13 @@ namespace ArdupilotMega [MarshalAs( UnmanagedType.ByValArray, SizeConst=20)] - char name; /// Name of the object as defined by the detector + public byte[] name; /// Name of the object as defined by the detector public byte quality; /// Detection quality / confidence. 0: bad, 255: maximum confidence public float bearing; /// Angle of the object with respect to the body frame in NED coordinates in radians. 0: front public float distance; /// Ground distance in meters }; public const byte MAVLINK_MSG_ID_OBJECT_DETECTION_EVENT_LEN = 36; - public const byte MAVLINK_MSG_ID_140_LEN = 36; public const byte MAVLINK_MSG_ID_OPTICAL_FLOW = 100; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_optical_flow_t @@ -740,7 +686,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_OPTICAL_FLOW_LEN = 18; - public const byte MAVLINK_MSG_ID_100_LEN = 18; public const byte MAVLINK_MSG_ID_PARAM_REQUEST_LIST = 21; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_param_request_list_t @@ -750,7 +695,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_PARAM_REQUEST_LIST_LEN = 2; - public const byte MAVLINK_MSG_ID_21_LEN = 2; public const byte MAVLINK_MSG_ID_PARAM_REQUEST_READ = 20; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_param_request_read_t @@ -765,7 +709,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN = 19; - public const byte MAVLINK_MSG_ID_20_LEN = 19; public const byte MAVLINK_MSG_ID_PARAM_SET = 23; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_param_set_t @@ -780,7 +723,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_PARAM_SET_LEN = 21; - public const byte MAVLINK_MSG_ID_23_LEN = 21; public const byte MAVLINK_MSG_ID_PARAM_VALUE = 22; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_param_value_t @@ -795,7 +737,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_PARAM_VALUE_LEN = 23; - public const byte MAVLINK_MSG_ID_22_LEN = 23; public const byte MAVLINK_MSG_ID_PING = 3; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_ping_t @@ -807,19 +748,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_PING_LEN = 14; - public const byte MAVLINK_MSG_ID_3_LEN = 14; - public const byte MAVLINK_MSG_ID_POSITION_CONTROLLER_OUTPUT = 61; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_position_controller_output_t - { - public byte enabled; /// 1: enabled, 0: disabled - public byte x; /// Position x: -128: -100%, 127: +100% - public byte y; /// Position y: -128: -100%, 127: +100% - public byte z; /// Position z: -128: -100%, 127: +100% - public byte yaw; /// Position yaw: -128: -100%, 127: +100% - - }; - public const byte MAVLINK_MSG_ID_POSITION_TARGET = 63; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_position_target_t @@ -831,7 +759,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_POSITION_TARGET_LEN = 16; - public const byte MAVLINK_MSG_ID_63_LEN = 16; public const byte MAVLINK_MSG_ID_RAW_IMU = 28; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_raw_imu_t @@ -849,7 +776,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_RAW_IMU_LEN = 26; - public const byte MAVLINK_MSG_ID_28_LEN = 26; public const byte MAVLINK_MSG_ID_RAW_PRESSURE = 29; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_raw_pressure_t @@ -862,7 +788,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_RAW_PRESSURE_LEN = 16; - public const byte MAVLINK_MSG_ID_29_LEN = 16; public const byte MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE = 70; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_rc_channels_override_t @@ -880,7 +805,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_LEN = 18; - public const byte MAVLINK_MSG_ID_70_LEN = 18; public const byte MAVLINK_MSG_ID_RC_CHANNELS_RAW = 35; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_rc_channels_raw_t @@ -897,7 +821,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN = 17; - public const byte MAVLINK_MSG_ID_35_LEN = 17; public const byte MAVLINK_MSG_ID_RC_CHANNELS_SCALED = 36; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_rc_channels_scaled_t @@ -914,7 +837,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_RC_CHANNELS_SCALED_LEN = 17; - public const byte MAVLINK_MSG_ID_36_LEN = 17; public const byte MAVLINK_MSG_ID_REQUEST_DATA_STREAM = 66; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_request_data_stream_t @@ -927,29 +849,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN = 6; - public const byte MAVLINK_MSG_ID_66_LEN = 6; - public const byte MAVLINK_MSG_ID_REQUEST_DYNAMIC_GYRO_CALIBRATION = 67; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_request_dynamic_gyro_calibration_t - { - public byte target_system; /// The system which should auto-calibrate - public byte target_component; /// The system component which should auto-calibrate - public float mode; /// The current ground-truth rpm - public byte axis; /// The axis to calibrate: 0 roll, 1 pitch, 2 yaw - public ushort time; /// The time to average over in ms - - }; - - public const byte MAVLINK_MSG_ID_REQUEST_STATIC_CALIBRATION = 68; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_request_static_calibration_t - { - public byte target_system; /// The system which should auto-calibrate - public byte target_component; /// The system component which should auto-calibrate - public ushort time; /// The time to average over in ms - - }; - public const byte MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT = 58; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_roll_pitch_yaw_speed_thrust_setpoint_t @@ -962,7 +861,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT_LEN = 24; - public const byte MAVLINK_MSG_ID_58_LEN = 24; public const byte MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT = 57; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_roll_pitch_yaw_thrust_setpoint_t @@ -975,7 +873,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT_LEN = 24; - public const byte MAVLINK_MSG_ID_57_LEN = 24; public const byte MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA = 54; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_safety_allowed_area_t @@ -990,7 +887,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN = 25; - public const byte MAVLINK_MSG_ID_54_LEN = 25; public const byte MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA = 53; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_safety_set_allowed_area_t @@ -1007,7 +903,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN = 27; - public const byte MAVLINK_MSG_ID_53_LEN = 27; public const byte MAVLINK_MSG_ID_SCALED_IMU = 26; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_scaled_imu_t @@ -1025,7 +920,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SCALED_IMU_LEN = 26; - public const byte MAVLINK_MSG_ID_26_LEN = 26; public const byte MAVLINK_MSG_ID_SCALED_PRESSURE = 38; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_scaled_pressure_t @@ -1037,7 +931,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SCALED_PRESSURE_LEN = 18; - public const byte MAVLINK_MSG_ID_38_LEN = 18; public const byte MAVLINK_MSG_ID_SERVO_OUTPUT_RAW = 37; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_servo_output_raw_t @@ -1053,7 +946,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN = 16; - public const byte MAVLINK_MSG_ID_37_LEN = 16; public const byte MAVLINK_MSG_ID_SET_ALTITUDE = 65; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_set_altitude_t @@ -1063,7 +955,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SET_ALTITUDE_LEN = 5; - public const byte MAVLINK_MSG_ID_65_LEN = 5; public const byte MAVLINK_MSG_ID_SET_MODE = 11; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_set_mode_t @@ -1073,7 +964,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SET_MODE_LEN = 2; - public const byte MAVLINK_MSG_ID_11_LEN = 2; public const byte MAVLINK_MSG_ID_SET_NAV_MODE = 12; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_set_nav_mode_t @@ -1083,31 +973,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SET_NAV_MODE_LEN = 2; - public const byte MAVLINK_MSG_ID_12_LEN = 2; - public const byte MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW = 55; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_set_roll_pitch_yaw_t - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public float roll; /// Desired roll angle in radians - public float pitch; /// Desired pitch angle in radians - public float yaw; /// Desired yaw angle in radians - - }; - - public const byte MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_SPEED = 56; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_set_roll_pitch_yaw_speed_t - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public float roll_speed; /// Desired roll angular speed in rad/s - public float pitch_speed; /// Desired pitch angular speed in rad/s - public float yaw_speed; /// Desired yaw angular speed in rad/s - - }; - public const byte MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_SPEED_THRUST = 56; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_set_roll_pitch_yaw_speed_thrust_t @@ -1121,7 +986,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_SPEED_THRUST_LEN = 18; - public const byte MAVLINK_MSG_ID_56_LEN = 18; public const byte MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_THRUST = 55; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_set_roll_pitch_yaw_thrust_t @@ -1135,7 +999,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_THRUST_LEN = 18; - public const byte MAVLINK_MSG_ID_55_LEN = 18; public const byte MAVLINK_MSG_ID_STATE_CORRECTION = 64; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_state_correction_t @@ -1152,7 +1015,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_STATE_CORRECTION_LEN = 36; - public const byte MAVLINK_MSG_ID_64_LEN = 36; public const byte MAVLINK_MSG_ID_STATUSTEXT = 254; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_statustext_t @@ -1161,11 +1023,10 @@ namespace ArdupilotMega [MarshalAs( UnmanagedType.ByValArray, SizeConst=50)] - public byte[] text; /// Status text message, without null termination character + public byte[] text; /// Status text message, without null termination public byteacter }; public const byte MAVLINK_MSG_ID_STATUSTEXT_LEN = 51; - public const byte MAVLINK_MSG_ID_254_LEN = 51; public const byte MAVLINK_MSG_ID_SYSTEM_TIME = 2; public const byte MAVLINK_MSG_ID_SYSTEM_TIME_UTC = 4; public const byte MAVLINK_MSG_ID_SYS_STATUS = 34; @@ -1182,7 +1043,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_SYS_STATUS_LEN = 11; - public const byte MAVLINK_MSG_ID_34_LEN = 11; public const byte MAVLINK_MSG_ID_VFR_HUD = 74; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_vfr_hud_t @@ -1196,7 +1056,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_VFR_HUD_LEN = 20; - public const byte MAVLINK_MSG_ID_74_LEN = 20; public const byte MAVLINK_MSG_ID_WAYPOINT = 39; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_waypoint_t @@ -1218,7 +1077,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_WAYPOINT_LEN = 36; - public const byte MAVLINK_MSG_ID_39_LEN = 36; public const byte MAVLINK_MSG_ID_WAYPOINT_ACK = 47; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_waypoint_ack_t @@ -1229,7 +1087,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_WAYPOINT_ACK_LEN = 3; - public const byte MAVLINK_MSG_ID_47_LEN = 3; public const byte MAVLINK_MSG_ID_WAYPOINT_CLEAR_ALL = 45; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_waypoint_clear_all_t @@ -1239,7 +1096,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_WAYPOINT_CLEAR_ALL_LEN = 2; - public const byte MAVLINK_MSG_ID_45_LEN = 2; public const byte MAVLINK_MSG_ID_WAYPOINT_COUNT = 44; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_waypoint_count_t @@ -1250,7 +1106,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_WAYPOINT_COUNT_LEN = 4; - public const byte MAVLINK_MSG_ID_44_LEN = 4; public const byte MAVLINK_MSG_ID_WAYPOINT_CURRENT = 42; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_waypoint_current_t @@ -1259,7 +1114,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_WAYPOINT_CURRENT_LEN = 2; - public const byte MAVLINK_MSG_ID_42_LEN = 2; public const byte MAVLINK_MSG_ID_WAYPOINT_REACHED = 46; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_waypoint_reached_t @@ -1268,7 +1122,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_WAYPOINT_REACHED_LEN = 2; - public const byte MAVLINK_MSG_ID_46_LEN = 2; public const byte MAVLINK_MSG_ID_WAYPOINT_REQUEST = 40; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_waypoint_request_t @@ -1279,7 +1132,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_WAYPOINT_REQUEST_LEN = 4; - public const byte MAVLINK_MSG_ID_40_LEN = 4; public const byte MAVLINK_MSG_ID_WAYPOINT_REQUEST_LIST = 43; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_waypoint_request_list_t @@ -1289,7 +1141,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_WAYPOINT_REQUEST_LIST_LEN = 2; - public const byte MAVLINK_MSG_ID_43_LEN = 2; public const byte MAVLINK_MSG_ID_WAYPOINT_SET_CURRENT = 41; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_waypoint_set_current_t @@ -1300,24 +1151,6 @@ namespace ArdupilotMega }; public const byte MAVLINK_MSG_ID_WAYPOINT_SET_CURRENT_LEN = 4; - public const byte MAVLINK_MSG_ID_41_LEN = 4; - public const byte MAVLINK_MSG_ID_WAYPOINT_SET_GLOBAL_REFERENCE = 48; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_waypoint_set_global_reference_t - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public float global_x; /// global x position - public float global_y; /// global y position - public float global_z; /// global z position - public float global_yaw; /// global yaw orientation in radians, 0 = NORTH - public float local_x; /// local x position that matches the global x position - public float local_y; /// local y position that matches the global y position - public float local_z; /// local z position that matches the global z position - public float local_yaw; /// local yaw that matches the global yaw orientation - - }; - public enum MAV_CLASS { MAV_CLASS_GENERIC = 0, /// Generic autopilot, full support for everything @@ -1472,7 +1305,7 @@ namespace ArdupilotMega MAV_FRAME_LOCAL_ENU = 4 }; -Type[] mavstructs = new Type[] {typeof( __mavlink_heartbeat_t) ,typeof( __mavlink_boot_t) ,null ,typeof( __mavlink_ping_t) ,null ,typeof( __mavlink_change_operator_control_t) ,typeof( __mavlink_change_operator_control_ack_t) ,typeof( __mavlink_auth_key_t) ,null ,typeof( __mavlink_action_ack_t) ,typeof( __mavlink_action_t) ,typeof( __mavlink_set_mode_t) ,typeof( __mavlink_set_nav_mode_t) ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_param_request_read_t) ,typeof( __mavlink_param_request_list_t) ,typeof( __mavlink_param_value_t) ,typeof( __mavlink_param_set_t) ,null ,typeof( __mavlink_gps_raw_int_t) ,typeof( __mavlink_scaled_imu_t) ,typeof( __mavlink_gps_status_t) ,typeof( __mavlink_raw_imu_t) ,typeof( __mavlink_raw_pressure_t) ,typeof( __mavlink_attitude_t ) ,typeof( __mavlink_local_position_t) ,typeof( __mavlink_gps_raw_t) ,typeof( __mavlink_global_position_t) ,typeof( __mavlink_sys_status_t) ,typeof( __mavlink_rc_channels_raw_t) ,typeof( __mavlink_rc_channels_scaled_t) ,typeof( __mavlink_servo_output_raw_t) ,typeof( __mavlink_scaled_pressure_t) ,typeof( __mavlink_waypoint_t) ,typeof( __mavlink_waypoint_request_t) ,typeof( __mavlink_waypoint_set_current_t) ,typeof( __mavlink_waypoint_current_t) ,typeof( __mavlink_waypoint_request_list_t) ,typeof( __mavlink_waypoint_count_t) ,typeof( __mavlink_waypoint_clear_all_t) ,typeof( __mavlink_waypoint_reached_t) ,typeof( __mavlink_waypoint_ack_t) ,typeof( __mavlink_waypoint_set_global_reference_t ) ,typeof( __mavlink_gps_local_origin_set_t) ,typeof( __mavlink_local_position_setpoint_set_t) ,typeof( __mavlink_local_position_setpoint_t) ,typeof( __mavlink_control_status_t) ,typeof( __mavlink_safety_set_allowed_area_t) ,typeof( __mavlink_safety_allowed_area_t) ,typeof( __mavlink_set_roll_pitch_yaw_thrust_t) ,typeof( __mavlink_set_roll_pitch_yaw_speed_thrust_t) ,typeof( __mavlink_roll_pitch_yaw_thrust_setpoint_t) ,typeof( __mavlink_roll_pitch_yaw_speed_thrust_setpoint_t) ,null ,typeof( __mavlink_attitude_controller_output_t ) ,typeof( __mavlink_position_controller_output_t ) ,typeof( __mavlink_nav_controller_output_t) ,typeof( __mavlink_position_target_t) ,typeof( __mavlink_state_correction_t) ,typeof( __mavlink_set_altitude_t) ,typeof( __mavlink_request_data_stream_t) ,typeof( __mavlink_request_dynamic_gyro_calibration_t ) ,typeof( __mavlink_request_static_calibration_t ) ,typeof( __mavlink_manual_control_t) ,typeof( __mavlink_rc_channels_override_t) ,null ,null ,typeof( __mavlink_global_position_int_t) ,typeof( __mavlink_vfr_hud_t) ,typeof( __mavlink_command_t) ,typeof( __mavlink_command_ack_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_optical_flow_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_object_detection_event_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_sensor_offsets_t) ,typeof( __mavlink_set_mag_offsets_t) ,typeof( __mavlink_meminfo_t) ,typeof( __mavlink_ap_adc_t) ,typeof( __mavlink_digicam_configure_t) ,typeof( __mavlink_digicam_control_t) ,typeof( __mavlink_mount_configure_t) ,typeof( __mavlink_mount_control_t) ,typeof( __mavlink_mount_status_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_debug_vect_t) ,typeof( __mavlink_named_value_float_t) ,typeof( __mavlink_named_value_int_t) ,typeof( __mavlink_statustext_t) ,typeof( __mavlink_debug_t) ,null ,}; +Type[] mavstructs = new Type[] {typeof( __mavlink_heartbeat_t) ,typeof( __mavlink_boot_t) ,null ,typeof( __mavlink_ping_t) ,null ,typeof( __mavlink_change_operator_control_t) ,typeof( __mavlink_change_operator_control_ack_t) ,typeof( __mavlink_auth_key_t) ,null ,typeof( __mavlink_action_ack_t) ,typeof( __mavlink_action_t) ,typeof( __mavlink_set_mode_t) ,typeof( __mavlink_set_nav_mode_t) ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_param_request_read_t) ,typeof( __mavlink_param_request_list_t) ,typeof( __mavlink_param_value_t) ,typeof( __mavlink_param_set_t) ,null ,typeof( __mavlink_gps_raw_int_t) ,typeof( __mavlink_scaled_imu_t) ,typeof( __mavlink_gps_status_t) ,typeof( __mavlink_raw_imu_t) ,typeof( __mavlink_raw_pressure_t) ,typeof( __mavlink_attitude_t) ,typeof( __mavlink_local_position_t) ,typeof( __mavlink_gps_raw_t) ,typeof( __mavlink_global_position_t) ,typeof( __mavlink_sys_status_t) ,typeof( __mavlink_rc_channels_raw_t) ,typeof( __mavlink_rc_channels_scaled_t) ,typeof( __mavlink_servo_output_raw_t) ,typeof( __mavlink_scaled_pressure_t) ,typeof( __mavlink_waypoint_t) ,typeof( __mavlink_waypoint_request_t) ,typeof( __mavlink_waypoint_set_current_t) ,typeof( __mavlink_waypoint_current_t) ,typeof( __mavlink_waypoint_request_list_t) ,typeof( __mavlink_waypoint_count_t) ,typeof( __mavlink_waypoint_clear_all_t) ,typeof( __mavlink_waypoint_reached_t) ,typeof( __mavlink_waypoint_ack_t) ,typeof( __mavlink_gps_set_global_origin_t) ,typeof( __mavlink_gps_local_origin_set_t) ,typeof( __mavlink_local_position_setpoint_set_t) ,typeof( __mavlink_local_position_setpoint_t) ,typeof( __mavlink_control_status_t) ,typeof( __mavlink_safety_set_allowed_area_t) ,typeof( __mavlink_safety_allowed_area_t) ,typeof( __mavlink_set_roll_pitch_yaw_thrust_t) ,typeof( __mavlink_set_roll_pitch_yaw_speed_thrust_t) ,typeof( __mavlink_roll_pitch_yaw_thrust_setpoint_t) ,typeof( __mavlink_roll_pitch_yaw_speed_thrust_setpoint_t) ,null ,null ,null ,typeof( __mavlink_nav_controller_output_t) ,typeof( __mavlink_position_target_t) ,typeof( __mavlink_state_correction_t) ,typeof( __mavlink_set_altitude_t) ,typeof( __mavlink_request_data_stream_t) ,typeof( __mavlink_hil_state_t) ,typeof( __mavlink_hil_controls_t) ,typeof( __mavlink_manual_control_t) ,typeof( __mavlink_rc_channels_override_t) ,null ,null ,typeof( __mavlink_global_position_int_t) ,typeof( __mavlink_vfr_hud_t) ,typeof( __mavlink_command_t) ,typeof( __mavlink_command_ack_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_optical_flow_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_object_detection_event_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_sensor_offsets_t) ,typeof( __mavlink_set_mag_offsets_t) ,typeof( __mavlink_meminfo_t) ,typeof( __mavlink_ap_adc_t) ,typeof( __mavlink_digicam_configure_t) ,typeof( __mavlink_digicam_control_t) ,typeof( __mavlink_mount_configure_t) ,typeof( __mavlink_mount_control_t) ,typeof( __mavlink_mount_status_t) ,null ,typeof( __mavlink_fence_point_t) ,typeof( __mavlink_fence_fetch_point_t) ,typeof( __mavlink_fence_status_t) ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,typeof( __mavlink_debug_vect_t) ,typeof( __mavlink_named_value_float_t) ,typeof( __mavlink_named_value_int_t) ,typeof( __mavlink_statustext_t) ,typeof( __mavlink_debug_t) ,null ,}; } #endif diff --git a/Tools/ArdupilotMegaPlanner/MyButton.cs b/Tools/ArdupilotMegaPlanner/MyButton.cs deleted file mode 100644 index 11bf6cd531..0000000000 --- a/Tools/ArdupilotMegaPlanner/MyButton.cs +++ /dev/null @@ -1,106 +0,0 @@ -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; - - -using System.Drawing.Drawing2D; - -namespace ArdupilotMega -{ - class MyButton : Button - { - bool mouseover = false; - bool mousedown = false; - - protected override void OnPaint(PaintEventArgs pevent) - { - //base.OnPaint(pevent); - - Graphics gr = pevent.Graphics; - - Rectangle outside = new Rectangle(0,0,this.Width,this.Height); - - LinearGradientBrush linear = new LinearGradientBrush(outside,Color.FromArgb(0x94,0xc1,0x1f),Color.FromArgb(0xcd,0xe2,0x96),LinearGradientMode.Vertical); - - Pen mypen = new Pen(Color.FromArgb(0x79,0x94,0x29),2); - - gr.FillRectangle(linear,outside); - - gr.DrawRectangle(mypen,outside); - - SolidBrush mybrush = new SolidBrush(Color.FromArgb(0x40,0x57,0x04)); - - if (mouseover) - { - SolidBrush brush = new SolidBrush(Color.FromArgb(73, 0x2b, 0x3a, 0x03)); - - gr.FillRectangle(brush, 0, 0, this.Width, this.Height); - } - if (mousedown) - { - SolidBrush brush = new SolidBrush(Color.FromArgb(73, 0x2b, 0x3a, 0x03)); - - gr.FillRectangle(brush, 0, 0, this.Width, this.Height); - } - - if (!this.Enabled) - { - SolidBrush brush = new SolidBrush(Color.FromArgb(150, 0x2b, 0x3a, 0x03)); - - gr.FillRectangle(brush, 0, 0, this.Width, this.Height); - } - - - StringFormat stringFormat = new StringFormat(); - stringFormat.Alignment = StringAlignment.Center; - stringFormat.LineAlignment = StringAlignment.Center; - - string display = this.Text; - int amppos = display.IndexOf('&'); - if (amppos != -1) - display = display.Remove(amppos,1); - - gr.DrawString(display, this.Font, mybrush, outside, stringFormat); - - } - - protected override void OnClick(EventArgs e) - { - base.OnClick(e); - } - - protected override void OnPaintBackground(PaintEventArgs pevent) - { - //base.OnPaintBackground(pevent); - } - - protected override void OnMouseEnter(EventArgs e) - { - mouseover = true; - base.OnMouseEnter(e); - } - - protected override void OnMouseLeave(EventArgs e) - { - mouseover = false; - base.OnMouseLeave(e); - } - - protected override void OnMouseDown(MouseEventArgs mevent) - { - mousedown = true; - base.OnMouseDown(mevent); - } - - protected override void OnMouseUp(MouseEventArgs mevent) - { - mousedown = false; - base.OnMouseUp(mevent); - } - } -} diff --git a/Tools/ArdupilotMegaPlanner/MyLabel.cs b/Tools/ArdupilotMegaPlanner/MyLabel.cs deleted file mode 100644 index 4f16540c0a..0000000000 --- a/Tools/ArdupilotMegaPlanner/MyLabel.cs +++ /dev/null @@ -1,88 +0,0 @@ -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 -{ - /// - /// profiling showed that the built in Label function was using alot ot call time. - /// - public partial class MyLabel : Control //: Label - { - string label = ""; - int noofchars = 0; - bool autosize = false; - - [System.ComponentModel.Browsable(true)] - public bool resize { get { return autosize; } set { autosize = value; } } - - public MyLabel() - { - } - - public override string Text - { - get - { - return label; - } - set - { - if (value == null) - return; - - if (label == value) - return; - - label = value; - - if (noofchars != label.Length && resize) - { - noofchars = label.Length; - Size textSize = TextRenderer.MeasureText(value, this.Font); - this.Width = textSize.Width; - } - - this.Invalidate(); - } - } - - SolidBrush s = new SolidBrush(Color.White); - SolidBrush b = new SolidBrush(Color.Black); - - StringFormat stringFormat = new StringFormat(); - - protected override void OnPaint(PaintEventArgs e) - { - stringFormat.Alignment = StringAlignment.Near; - stringFormat.LineAlignment = StringAlignment.Center; - - s = new SolidBrush(ForeColor); - - e.Graphics.DrawString(label, this.Font, s, new PointF(0, this.Height / 2.0f), stringFormat); - } - - protected override void OnPaintBackground(PaintEventArgs pevent) - { - b = new SolidBrush(BackColor); - - pevent.Graphics.FillRectangle(b, this.ClientRectangle); - - base.OnPaintBackground(pevent); - } - - protected override void WndProc(ref Message m) // seems to crash here on linux... so try ignore it - { - try - { - base.WndProc(ref m); - } - catch { } - } - } -} diff --git a/Tools/ArdupilotMegaPlanner/MyTrackBar.cs b/Tools/ArdupilotMegaPlanner/MyTrackBar.cs deleted file mode 100644 index 83a976cb2d..0000000000 --- a/Tools/ArdupilotMegaPlanner/MyTrackBar.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace ArdupilotMega -{ - class MyTrackBar : TrackBar - { - public new double Maximum { get { return base.Maximum / 100.0; } set { base.Maximum = (int)(value * 100); } } - public new double Minimum { get { return base.Minimum / 100.0; } set { base.Minimum = (int)(value * 100); } } - public new double Value { get { return base.Value / 100.0; } set { base.Value = (int)(value * 100); } } - } -} diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index 2fcc2a3ac8..7b13d50ec2 100644 --- a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs +++ b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ using System.Resources; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.1.8")] +[assembly: AssemblyFileVersion("1.1.9")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/mavlinklist.pl b/Tools/ArdupilotMegaPlanner/mavlinklist.pl index d5aade1b3d..d2b4fb4de6 100644 --- a/Tools/ArdupilotMegaPlanner/mavlinklist.pl +++ b/Tools/ArdupilotMegaPlanner/mavlinklist.pl @@ -1,10 +1,25 @@ -$dir = "C:/Users/hog/Documents/Arduino/libraries/GCS_MAVLink/include/common/"; -$dir2 = "C:/Users/hog/Documents/Arduino/libraries/GCS_MAVLink/include/ardupilotmega/"; +$dir = "C:/Users/hog/Desktop/DIYDrones/ardupilot-mega/libraries/GCS_MAVLink/include/common/"; +$dir2 = "C:/Users/hog/Desktop/DIYDrones/ardupilot-mega/libraries/GCS_MAVLink/include/ardupilotmega/"; + +$fname = "MAVLinkTypes0.9.cs"; + +&doit(); # mavlink 1.0 with old structs $dir = "C:/Users/hog/Desktop/DIYDrones/ardupilot-mega/libraries/GCS_MAVLink/include_v1.0/common/"; $dir2 = "C:/Users/hog/Desktop/DIYDrones/ardupilot-mega/libraries/GCS_MAVLink/include_v1.0/ardupilotmega/"; +$fname = "MAVLinkTypes.cs"; + +&doit(); + +; + +exit; + +sub doit +{ + opendir(DIR,$dir) || die print $!; @files2 = readdir(DIR); closedir(DIR); @@ -18,10 +33,12 @@ push(@files,@files2); push(@files,"../mavlink_types.h"); -open(OUT,">MAVLinkTypes.cs"); +open(OUT,">$fname"); $crcs = 0; +%done = {}; + print OUT <; +} + + 1; \ No newline at end of file