APM Planner 1.1.62

3dr Radio support
update mavlink library
This commit is contained in:
Michael Oborne 2012-04-07 07:51:00 +08:00
parent e63e858b64
commit c5f3410ab9
32 changed files with 3299 additions and 2233 deletions

View File

@ -45,7 +45,7 @@
<DefineConstants>TRACE;DEBUG;MAVLINK10cra</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>
</DocumentationFile>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
@ -61,7 +61,7 @@
<DefineConstants>TRACE;DEBUG;MAVLINK10cra</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DocumentationFile>
</DocumentationFile>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
@ -318,6 +318,7 @@
<DependentUpon>Setup.cs</DependentUpon>
</Compile>
<Compile Include="MagCalib.cs" />
<Compile Include="Mavlink\MavlinkOther.cs" />
<Compile Include="PIDTunning.cs" />
<Compile Include="Radio\3DRradio.cs">
<SubType>UserControl</SubType>

View File

@ -49,13 +49,12 @@ namespace ArdupilotMega
return answer;
}
static ICodeCompiler CreateCompiler()
static CodeDomProvider CreateCompiler()
{
//Create an instance of the C# compiler
CodeDomProvider codeProvider = null;
codeProvider = new CSharpCodeProvider();
ICodeCompiler compiler = codeProvider.CreateCompiler();
return compiler;
CodeDomProvider codeProvider = CodeDomProvider.CreateProvider("CSharp");
//ICodeCompiler compiler = codeProvider.CreateCompiler();
return codeProvider;
}
/// <summary>
@ -88,7 +87,7 @@ namespace ArdupilotMega
/// <param name="parms"></param>
/// <param name="source"></param>
/// <returns></returns>
static private CompilerResults CompileCode(ICodeCompiler compiler, CompilerParameters parms, string source)
static private CompilerResults CompileCode(CodeDomProvider compiler, CompilerParameters parms, string source)
{
//actually compile the code
CompilerResults results = compiler.CompileAssemblyFromSource(
@ -144,7 +143,7 @@ namespace ArdupilotMega
static private CompilerResults CompileAssembly()
{
// create a compiler
ICodeCompiler compiler = CreateCompiler();
CodeDomProvider compiler = CreateCompiler();
// get all the compiler parameters
CompilerParameters parms = CreateCompilerParameters();
// compile the code into an assembly

View File

@ -448,7 +448,7 @@ namespace ArdupilotMega
case (int)Common.apmmodes.LOITER:
case (int)Common.apmmodes.FLY_BY_WIRE_A:
case (int)Common.apmmodes.FLY_BY_WIRE_B:
mode.base_mode = (byte)MAVLink.MAV_MODE_FLAG.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED;
mode.base_mode = (byte)MAVLink.MAV_MODE_FLAG.CUSTOM_MODE_ENABLED;
mode.custom_mode = (uint)(int)Enum.Parse(Common.getModes(), modein);
break;
default:
@ -468,7 +468,7 @@ namespace ArdupilotMega
case (int)Common.ac2modes.ALT_HOLD:
case (int)Common.ac2modes.CIRCLE:
case (int)Common.ac2modes.POSITION:
mode.base_mode = (byte)MAVLink.MAV_MODE_FLAG.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED;
mode.base_mode = (byte)MAVLink.MAV_MODE_FLAG.CUSTOM_MODE_ENABLED;
mode.custom_mode = (uint)(int)Enum.Parse(Common.getModes(), modein);
break;
default:
@ -576,7 +576,10 @@ namespace ArdupilotMega
try
{
// this is for mono to a ssl server
ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy();
//ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy();
ServicePointManager.ServerCertificateValidationCallback =
new System.Net.Security.RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create(url);

View File

@ -385,9 +385,9 @@ namespace ArdupilotMega
mode = "Unknown";
if ((hb.base_mode & (byte)MAVLink.MAV_MODE_FLAG.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED) != 0)
if ((hb.base_mode & (byte)MAVLink.MAV_MODE_FLAG.CUSTOM_MODE_ENABLED) != 0)
{
if (hb.type == (byte)MAVLink.MAV_TYPE.MAV_TYPE_FIXED_WING)
if (hb.type == (byte)MAVLink.MAV_TYPE.FIXED_WING)
{
switch (hb.custom_mode)
{
@ -423,7 +423,7 @@ namespace ArdupilotMega
break;
}
}
else if (hb.type == (byte)MAVLink.MAV_TYPE.MAV_TYPE_QUADROTOR)
else if (hb.type == (byte)MAVLink.MAV_TYPE.QUADROTOR)
{
switch (hb.custom_mode)
{
@ -461,9 +461,9 @@ namespace ArdupilotMega
}
}
if (oldmode != mode && MainV2.speechenable && MainV2.getConfig("speechmodeenabled") == "True")
if (oldmode != mode && MainV2.speechEnable && MainV2.getConfig("speechmodeenabled") == "True")
{
MainV2.talk.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechmode")));
MainV2.speechEngine.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechmode")));
}
}
@ -726,9 +726,9 @@ namespace ArdupilotMega
wpno = wpcur.seq;
if (oldwp != wpno && MainV2.speechenable && MainV2.getConfig("speechwaypointenabled") == "True")
if (oldwp != wpno && MainV2.speechEnable && MainV2.getConfig("speechwaypointenabled") == "True")
{
MainV2.talk.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechwaypoint")));
MainV2.speechEngine.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechwaypoint")));
}
//MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_WAYPOINT_CURRENT] = null;

View File

@ -579,7 +579,6 @@ namespace ArdupilotMega.GCSViews
}
}
catch { ((Control)text[0]).BackColor = Color.Red; }
Params.Focus();
}
@ -711,13 +710,6 @@ namespace ArdupilotMega.GCSViews
private void Planner_TabIndexChanged(object sender, EventArgs e)
{
if (ConfigTabs.SelectedTab == TabSetup)
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
CustomMessageBox.Show("Please Connect First");
ConfigTabs.SelectedIndex = 0;
}
else
{
GCSViews.ConfigurationView.Setup temp = new GCSViews.ConfigurationView.Setup();
@ -731,7 +723,6 @@ namespace ArdupilotMega.GCSViews
startup = false;
}
}
}
private void BUT_videostart_Click(object sender, EventArgs e)
{
@ -1106,7 +1097,7 @@ namespace ArdupilotMega.GCSViews
{
param2 = loadParamFile(ofd.FileName);
ParamCompare temp = new ParamCompare(this, param, param2);
ParamCompare temp = new ParamCompare(Params, param, param2);
ThemeManager.ApplyThemeTo(temp);
temp.ShowDialog();
}

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.myLabel3 = new ArdupilotMega.MyLabel();
this.TUNE_LOW = new System.Windows.Forms.NumericUpDown();
this.TUNE_HIGH = new System.Windows.Forms.NumericUpDown();
@ -123,6 +124,7 @@
this.label90 = new System.Windows.Forms.Label();
this.RATE_RLL_P = new System.Windows.Forms.NumericUpDown();
this.label91 = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).BeginInit();
this.groupBox5.SuspendLayout();
@ -1090,6 +1092,7 @@
this.Controls.Add(this.groupBox25);
this.Name = "ConfigArducopter";
this.Size = new System.Drawing.Size(728, 393);
this.Load += new System.EventHandler(this.ConfigArducopter_Load);
((System.ComponentModel.ISupportInitialize)(this.TUNE_LOW)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.TUNE_HIGH)).EndInit();
this.groupBox5.ResumeLayout(false);
@ -1243,5 +1246,6 @@
private System.Windows.Forms.Label label90;
private System.Windows.Forms.NumericUpDown RATE_RLL_P;
private System.Windows.Forms.Label label91;
private System.Windows.Forms.ToolTip toolTip1;
}
}

View File

@ -7,14 +7,343 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using ArdupilotMega.Controls.BackstageView;
using System.Collections;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigArducopter : BackStageViewContentPanel
{
Hashtable changes = new Hashtable();
static Hashtable tooltips = new Hashtable();
internal bool startup = true;
public ConfigArducopter()
{
InitializeComponent();
}
public struct paramsettings // hk's
{
public string name;
public float minvalue;
public float maxvalue;
public float normalvalue;
public float scale;
public string desc;
}
private void ConfigArducopter_Load(object sender, EventArgs e)
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
this.Enabled = false;
return;
}
else
{
if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
{
this.Enabled = true;
}
else
{
this.Enabled = false;
return;
}
}
startup = true;
changes.Clear();
// read tooltips
if (tooltips.Count == 0)
readToolTips();
// ensure the fields are populated before setting them
CH7_OPT.DataSource = Enum.GetNames(typeof(Common.ac2ch7modes));
TUNE.DataSource = Enum.GetNames(typeof(Common.ac2ch6modes));
// prefill all fields
processToScreen();
startup = false;
}
void readToolTips()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration));
string data = resources.GetString("MAVParam");
if (data == null)
{
data = global::ArdupilotMega.Properties.Resources.MAVParam;
}
string[] tips = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var tip in tips)
{
if (!tip.StartsWith("||"))
continue;
string[] cols = tip.Split(new string[] { "||" }, 9, StringSplitOptions.None);
if (cols.Length >= 8)
{
paramsettings param = new paramsettings();
try
{
param.name = cols[1];
param.desc = AddNewLinesForTooltip(cols[7]);
param.scale = float.Parse(cols[5]);
param.minvalue = float.Parse(cols[2]);
param.maxvalue = float.Parse(cols[3]);
param.normalvalue = float.Parse(cols[4]);
}
catch { }
tooltips[cols[1]] = param;
}
}
}
// from http://stackoverflow.com/questions/2512781/winforms-big-paragraph-tooltip/2512895#2512895
private const int maximumSingleLineTooltipLength = 50;
private static string AddNewLinesForTooltip(string text)
{
if (text.Length < maximumSingleLineTooltipLength)
return text;
int lineLength = (int)Math.Sqrt((double)text.Length) * 2;
StringBuilder sb = new StringBuilder();
int currentLinePosition = 0;
for (int textIndex = 0; textIndex < text.Length; textIndex++)
{
// If we have reached the target line length and the next
// character is whitespace then begin a new line.
if (currentLinePosition >= lineLength &&
char.IsWhiteSpace(text[textIndex]))
{
sb.Append(Environment.NewLine);
currentLinePosition = 0;
}
// If we have just started a new line, skip all the whitespace.
if (currentLinePosition == 0)
while (textIndex < text.Length && char.IsWhiteSpace(text[textIndex]))
textIndex++;
// Append the next character.
if (textIndex < text.Length) sb.Append(text[textIndex]);
currentLinePosition++;
}
return sb.ToString();
}
void disableNumericUpDownControls(Control inctl)
{
foreach (Control ctl in inctl.Controls)
{
if (ctl.Controls.Count > 0)
{
disableNumericUpDownControls(ctl);
}
if (ctl.GetType() == typeof(NumericUpDown))
{
ctl.Enabled = false;
}
}
}
internal void processToScreen()
{
toolTip1.RemoveAll();
disableNumericUpDownControls(this);
// process hashdefines and update display
foreach (string value in MainV2.comPort.param.Keys)
{
if (value == null || value == "")
continue;
//System.Diagnostics.Debug.WriteLine("Doing: " + value);
string name = value;
Control[] text = this.Controls.Find(name, true);
foreach (Control ctl in text)
{
try
{
if (ctl.GetType() == typeof(NumericUpDown))
{
NumericUpDown thisctl = ((NumericUpDown)ctl);
thisctl.Maximum = 9000;
thisctl.Minimum = -9000;
thisctl.Value = (decimal)(float)MainV2.comPort.param[value];
thisctl.Increment = (decimal)0.001;
if (thisctl.Name.EndsWith("_P") || thisctl.Name.EndsWith("_I") || thisctl.Name.EndsWith("_D")
|| thisctl.Name.EndsWith("_LOW") || thisctl.Name.EndsWith("_HIGH") || thisctl.Value == 0
|| thisctl.Value.ToString("0.###", new System.Globalization.CultureInfo("en-US")).Contains("."))
{
thisctl.DecimalPlaces = 3;
}
else
{
thisctl.Increment = (decimal)1;
thisctl.DecimalPlaces = 1;
}
if (thisctl.Name.EndsWith("_IMAX"))
{
thisctl.Maximum = 180;
thisctl.Minimum = -180;
}
thisctl.Enabled = true;
thisctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
thisctl.Validated += null;
if (tooltips[value] != null)
{
try
{
toolTip1.SetToolTip(ctl, ((paramsettings)tooltips[value]).desc);
}
catch { }
}
thisctl.Validated += new EventHandler(EEPROM_View_float_TextChanged);
}
else if (ctl.GetType() == typeof(ComboBox))
{
ComboBox thisctl = ((ComboBox)ctl);
thisctl.SelectedIndex = (int)(float)MainV2.comPort.param[value];
thisctl.Validated += new EventHandler(ComboBox_Validated);
thisctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
}
}
catch { }
}
if (text.Length == 0)
{
//Console.WriteLine(name + " not found");
}
}
}
void ComboBox_Validated(object sender, EventArgs e)
{
EEPROM_View_float_TextChanged(sender, e);
}
void Configuration_Validating(object sender, CancelEventArgs e)
{
EEPROM_View_float_TextChanged(sender, e);
}
internal void EEPROM_View_float_TextChanged(object sender, EventArgs e)
{
if (startup == true)
return;
float value = 0;
string name = ((Control)sender).Name;
// do domainupdown state check
try
{
if (sender.GetType() == typeof(NumericUpDown))
{
value = float.Parse(((Control)sender).Text);
changes[name] = value;
}
else if (sender.GetType() == typeof(ComboBox))
{
value = ((ComboBox)sender).SelectedIndex;
changes[name] = value;
}
((Control)sender).BackColor = Color.Green;
}
catch (Exception)
{
((Control)sender).BackColor = Color.Red;
}
try
{
// enable roll and pitch pairing for ac2
if (CHK_lockrollpitch.Checked)
{
if (name.StartsWith("RATE_") || name.StartsWith("STB_") || name.StartsWith("ACRO_"))
{
if (name.Contains("_RLL_"))
{
string newname = name.Replace("_RLL_", "_PIT_");
Control[] arr = this.Controls.Find(newname, true);
changes[newname] = float.Parse(((Control)sender).Text);
if (arr.Length > 0)
{
arr[0].Text = ((Control)sender).Text;
arr[0].BackColor = Color.Green;
}
}
else if (name.Contains("_PIT_"))
{
string newname = name.Replace("_PIT_", "_RLL_");
Control[] arr = this.Controls.Find(newname, true);
changes[newname] = float.Parse(((Control)sender).Text);
if (arr.Length > 0)
{
arr[0].Text = ((Control)sender).Text;
arr[0].BackColor = Color.Green;
}
}
}
}
// keep nav_lat and nav_lon paired
if (name.Contains("NAV_LAT_"))
{
string newname = name.Replace("NAV_LAT_", "NAV_LON_");
Control[] arr = this.Controls.Find(newname, true);
changes[newname] = float.Parse(((Control)sender).Text);
if (arr.Length > 0)
{
arr[0].Text = ((Control)sender).Text;
arr[0].BackColor = Color.Green;
}
}
// keep nav_lat and nav_lon paired
if (name.Contains("HLD_LAT_"))
{
string newname = name.Replace("HLD_LAT_", "HLD_LON_");
Control[] arr = this.Controls.Find(newname, true);
changes[newname] = float.Parse(((Control)sender).Text);
if (arr.Length > 0)
{
arr[0].Text = ((Control)sender).Text;
arr[0].BackColor = Color.Green;
}
}
}
catch { }
}
}
}

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.THR_FS_VALUE = new System.Windows.Forms.NumericUpDown();
this.label5 = new System.Windows.Forms.Label();
@ -128,6 +129,7 @@
this.label51 = new System.Windows.Forms.Label();
this.RLL2SRV_P = new System.Windows.Forms.NumericUpDown();
this.label52 = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.THR_FS_VALUE)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.THR_MAX)).BeginInit();
@ -1104,6 +1106,7 @@
this.Controls.Add(this.groupBox8);
this.Name = "ConfigArduplane";
this.Size = new System.Drawing.Size(621, 456);
this.Load += new System.EventHandler(this.ConfigArduplane_Load);
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.THR_FS_VALUE)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.THR_MAX)).EndInit();
@ -1266,5 +1269,6 @@
private System.Windows.Forms.Label label51;
private System.Windows.Forms.NumericUpDown RLL2SRV_P;
private System.Windows.Forms.Label label52;
private System.Windows.Forms.ToolTip toolTip1;
}
}

View File

@ -7,14 +7,265 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using ArdupilotMega.Controls.BackstageView;
using System.Collections;
namespace ArdupilotMega.GCSViews.ConfigurationView
{
public partial class ConfigArduplane : BackStageViewContentPanel
{
Hashtable changes = new Hashtable();
static Hashtable tooltips = new Hashtable();
internal bool startup = true;
public ConfigArduplane()
{
InitializeComponent();
}
private void ConfigArduplane_Load(object sender, EventArgs e)
{
if (!MainV2.comPort.BaseStream.IsOpen)
{
this.Enabled = false;
return;
}
else
{
if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane)
{
this.Enabled = true;
}
else
{
this.Enabled = false;
return;
}
}
startup = true;
changes.Clear();
// read tooltips
if (tooltips.Count == 0)
readToolTips();
processToScreen();
startup = false;
}
public struct paramsettings // hk's
{
public string name;
public float minvalue;
public float maxvalue;
public float normalvalue;
public float scale;
public string desc;
}
void readToolTips()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration));
string data = resources.GetString("MAVParam");
if (data == null)
{
data = global::ArdupilotMega.Properties.Resources.MAVParam;
}
string[] tips = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var tip in tips)
{
if (!tip.StartsWith("||"))
continue;
string[] cols = tip.Split(new string[] { "||" }, 9, StringSplitOptions.None);
if (cols.Length >= 8)
{
paramsettings param = new paramsettings();
try
{
param.name = cols[1];
param.desc = AddNewLinesForTooltip(cols[7]);
param.scale = float.Parse(cols[5]);
param.minvalue = float.Parse(cols[2]);
param.maxvalue = float.Parse(cols[3]);
param.normalvalue = float.Parse(cols[4]);
}
catch { }
tooltips[cols[1]] = param;
}
}
}
// from http://stackoverflow.com/questions/2512781/winforms-big-paragraph-tooltip/2512895#2512895
private const int maximumSingleLineTooltipLength = 50;
private static string AddNewLinesForTooltip(string text)
{
if (text.Length < maximumSingleLineTooltipLength)
return text;
int lineLength = (int)Math.Sqrt((double)text.Length) * 2;
StringBuilder sb = new StringBuilder();
int currentLinePosition = 0;
for (int textIndex = 0; textIndex < text.Length; textIndex++)
{
// If we have reached the target line length and the next
// character is whitespace then begin a new line.
if (currentLinePosition >= lineLength &&
char.IsWhiteSpace(text[textIndex]))
{
sb.Append(Environment.NewLine);
currentLinePosition = 0;
}
// If we have just started a new line, skip all the whitespace.
if (currentLinePosition == 0)
while (textIndex < text.Length && char.IsWhiteSpace(text[textIndex]))
textIndex++;
// Append the next character.
if (textIndex < text.Length) sb.Append(text[textIndex]);
currentLinePosition++;
}
return sb.ToString();
}
void disableNumericUpDownControls(Control inctl)
{
foreach (Control ctl in inctl.Controls)
{
if (ctl.Controls.Count > 0)
{
disableNumericUpDownControls(ctl);
}
if (ctl.GetType() == typeof(NumericUpDown))
{
ctl.Enabled = false;
}
}
}
internal void processToScreen()
{
toolTip1.RemoveAll();
disableNumericUpDownControls(this);
// process hashdefines and update display
foreach (string value in MainV2.comPort.param.Keys)
{
if (value == null || value == "")
continue;
string name = value;
Control[] text = this.Controls.Find(name, true);
foreach (Control ctl in text)
{
try
{
if (ctl.GetType() == typeof(NumericUpDown))
{
NumericUpDown thisctl = ((NumericUpDown)ctl);
thisctl.Maximum = 9000;
thisctl.Minimum = -9000;
thisctl.Value = (decimal)(float)MainV2.comPort.param[value];
thisctl.Increment = (decimal)0.001;
if (thisctl.Name.EndsWith("_P") || thisctl.Name.EndsWith("_I") || thisctl.Name.EndsWith("_D")
|| thisctl.Name.EndsWith("_LOW") || thisctl.Name.EndsWith("_HIGH") || thisctl.Value == 0
|| thisctl.Value.ToString("0.###", new System.Globalization.CultureInfo("en-US")).Contains("."))
{
thisctl.DecimalPlaces = 3;
}
else
{
thisctl.Increment = (decimal)1;
thisctl.DecimalPlaces = 1;
}
if (thisctl.Name.EndsWith("_IMAX"))
{
thisctl.Maximum = 180;
thisctl.Minimum = -180;
}
thisctl.Enabled = true;
thisctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45);
thisctl.Validated += null;
if (tooltips[value] != null)
{
try
{
toolTip1.SetToolTip(ctl, ((paramsettings)tooltips[value]).desc);
}
catch { }
}
thisctl.Validated += new EventHandler(EEPROM_View_float_TextChanged);
}
else if (ctl.GetType() == typeof(ComboBox))
{
ComboBox thisctl = ((ComboBox)ctl);
thisctl.SelectedIndex = (int)(float)MainV2.comPort.param[value];
thisctl.Validated += new EventHandler(ComboBox_Validated);
}
}
catch { }
}
if (text.Length == 0)
{
//Console.WriteLine(name + " not found");
}
}
}
void ComboBox_Validated(object sender, EventArgs e)
{
EEPROM_View_float_TextChanged(sender, e);
}
void Configuration_Validating(object sender, CancelEventArgs e)
{
EEPROM_View_float_TextChanged(sender, e);
}
internal void EEPROM_View_float_TextChanged(object sender, EventArgs e)
{
float value = 0;
string name = ((Control)sender).Name;
// do domainupdown state check
try
{
if (sender.GetType() == typeof(NumericUpDown))
{
value = float.Parse(((Control)sender).Text);
changes[name] = value;
}
else if (sender.GetType() == typeof(ComboBox))
{
value = ((ComboBox)sender).SelectedIndex;
changes[name] = value;
}
((Control)sender).BackColor = Color.Green;
}
catch (Exception)
{
((Control)sender).BackColor = Color.Red;
}
}
}
}

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -32,7 +32,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
MainV2.cs.ratesensors = 10;
MainV2.comPort.requestDatastream((byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, MainV2.cs.ratesensors); // mag captures at 10 hz
MainV2.comPort.requestDatastream((byte)MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // mag captures at 10 hz
CustomMessageBox.Show("Data will be collected for 30 seconds, Please click ok and move the apm around all axises");

View File

@ -115,7 +115,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
try
{
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, 10);
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, 10);
}
catch { }
@ -229,7 +229,7 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
try
{
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, oldrc);
MainV2.comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, oldrc);
}
catch { }

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.BUT_compare = new ArdupilotMega.MyButton();
@ -41,11 +42,13 @@
this.Default = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.mavScale = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.RawValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
((System.ComponentModel.ISupportInitialize)(this.Params)).BeginInit();
this.SuspendLayout();
//
// BUT_compare
//
this.BUT_compare.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BUT_compare.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.BUT_compare.Location = new System.Drawing.Point(341, 119);
this.BUT_compare.Name = "BUT_compare";
@ -57,6 +60,7 @@
//
// BUT_rerequestparams
//
this.BUT_rerequestparams.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BUT_rerequestparams.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.BUT_rerequestparams.Location = new System.Drawing.Point(341, 94);
this.BUT_rerequestparams.Name = "BUT_rerequestparams";
@ -68,6 +72,7 @@
//
// BUT_writePIDS
//
this.BUT_writePIDS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BUT_writePIDS.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.BUT_writePIDS.Location = new System.Drawing.Point(341, 69);
this.BUT_writePIDS.Name = "BUT_writePIDS";
@ -79,6 +84,7 @@
//
// BUT_save
//
this.BUT_save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BUT_save.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.BUT_save.Location = new System.Drawing.Point(341, 35);
this.BUT_save.Margin = new System.Windows.Forms.Padding(0);
@ -91,6 +97,7 @@
//
// BUT_load
//
this.BUT_load.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BUT_load.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.BUT_load.Location = new System.Drawing.Point(341, 7);
this.BUT_load.Margin = new System.Windows.Forms.Padding(0);
@ -105,8 +112,9 @@
//
this.Params.AllowUserToAddRows = false;
this.Params.AllowUserToDeleteRows = false;
this.Params.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.Params.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.Maroon;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -136,6 +144,7 @@
this.Params.RowHeadersWidth = 150;
this.Params.Size = new System.Drawing.Size(321, 302);
this.Params.TabIndex = 68;
this.Params.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.Params_CellValueChanged);
//
// Command
//
@ -181,8 +190,6 @@
this.Name = "ConfigRawParams";
this.Size = new System.Drawing.Size(460, 305);
this.Load += new System.EventHandler(this.ConfigRawParams_Load);
this.ControlAdded += new System.Windows.Forms.ControlEventHandler(this.ConfigRawParams_ControlAdded);
this.ControlRemoved += new System.Windows.Forms.ControlEventHandler(this.ConfigRawParams_ControlRemoved);
((System.ComponentModel.ISupportInitialize)(this.Params)).EndInit();
this.ResumeLayout(false);
@ -201,5 +208,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Default;
private System.Windows.Forms.DataGridViewTextBoxColumn mavScale;
private System.Windows.Forms.DataGridViewTextBoxColumn RawValue;
private System.Windows.Forms.ToolTip toolTip1;
}
}

View File

@ -21,9 +21,21 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
// Changes made to the params between writing to the copter
readonly Hashtable _changes = new Hashtable();
static Hashtable tooltips = new Hashtable();
// ?
internal bool startup = true;
public struct paramsettings // hk's
{
public string name;
public float minvalue;
public float maxvalue;
public float normalvalue;
public float scale;
public string desc;
}
public ConfigRawParams()
{
@ -234,11 +246,10 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
{
param2 = loadParamFile(ofd.FileName);
int fixme;
//var paramCompareForm = new ParamCompare((Form)this, MainV2.comPort.param, param2);
Form paramCompareForm = new ParamCompare(Params, MainV2.comPort.param, param2);
//ThemeManager.ApplyThemeTo(paramCompareForm);
//paramCompareForm.ShowDialog();
ThemeManager.ApplyThemeTo(paramCompareForm);
paramCompareForm.ShowDialog();
}
}
@ -265,24 +276,154 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
startup = true;
processToScreen();
startup = false;
// Todo: this populates or the combos etc and what not. This shoudl prob be a bsv button
}
void Params_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1 || e.ColumnIndex == -1 || startup == true || e.ColumnIndex != 1)
return;
try
{
if (Params[Command.Index, e.RowIndex].Value.ToString().EndsWith("_REV") && (Params[Command.Index, e.RowIndex].Value.ToString().StartsWith("RC") || Params[Command.Index, e.RowIndex].Value.ToString().StartsWith("HS")))
{
if (Params[e.ColumnIndex, e.RowIndex].Value.ToString() == "0")
Params[e.ColumnIndex, e.RowIndex].Value = "-1";
}
Params[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.Green;
_changes[Params[0, e.RowIndex].Value] = float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString());
}
catch (Exception)
{
Params[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.Red;
}
Params.Focus();
}
void readToolTips()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration));
string data = resources.GetString("MAVParam");
if (data == null)
{
data = global::ArdupilotMega.Properties.Resources.MAVParam;
}
string[] tips = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var tip in tips)
{
if (!tip.StartsWith("||"))
continue;
string[] cols = tip.Split(new string[] { "||" }, 9, StringSplitOptions.None);
if (cols.Length >= 8)
{
paramsettings param = new paramsettings();
try
{
param.name = cols[1];
param.desc = AddNewLinesForTooltip(cols[7]);
param.scale = float.Parse(cols[5]);
param.minvalue = float.Parse(cols[2]);
param.maxvalue = float.Parse(cols[3]);
param.normalvalue = float.Parse(cols[4]);
}
catch { }
tooltips[cols[1]] = param;
}
}
}
// from http://stackoverflow.com/questions/2512781/winforms-big-paragraph-tooltip/2512895#2512895
private const int maximumSingleLineTooltipLength = 50;
private static string AddNewLinesForTooltip(string text)
{
if (text.Length < maximumSingleLineTooltipLength)
return text;
int lineLength = (int)Math.Sqrt((double)text.Length) * 2;
StringBuilder sb = new StringBuilder();
int currentLinePosition = 0;
for (int textIndex = 0; textIndex < text.Length; textIndex++)
{
// If we have reached the target line length and the next
// character is whitespace then begin a new line.
if (currentLinePosition >= lineLength &&
char.IsWhiteSpace(text[textIndex]))
{
sb.Append(Environment.NewLine);
currentLinePosition = 0;
}
// If we have just started a new line, skip all the whitespace.
if (currentLinePosition == 0)
while (textIndex < text.Length && char.IsWhiteSpace(text[textIndex]))
textIndex++;
// Append the next character.
if (textIndex < text.Length) sb.Append(text[textIndex]);
currentLinePosition++;
}
return sb.ToString();
}
internal void processToScreen()
{
toolTip1.RemoveAll();
Params.Rows.Clear();
// process hashdefines and update display
foreach (string value in MainV2.comPort.param.Keys)
{
if (value == null || value == "")
continue;
//System.Diagnostics.Debug.WriteLine("Doing: " + value);
Params.Rows.Add();
Params.Rows[Params.RowCount - 1].Cells[Command.Index].Value = value;
Params.Rows[Params.RowCount - 1].Cells[Value.Index].Value = ((float)MainV2.comPort.param[value]).ToString("0.###");
try
{
if (tooltips[value] != null)
{
Params.Rows[Params.RowCount - 1].Cells[Command.Index].ToolTipText = ((paramsettings)tooltips[value]).desc;
//Params.Rows[Params.RowCount - 1].Cells[RawValue.Index].ToolTipText = ((paramsettings)tooltips[value]).desc;
Params.Rows[Params.RowCount - 1].Cells[Value.Index].ToolTipText = ((paramsettings)tooltips[value]).desc;
//Params.Rows[Params.RowCount - 1].Cells[Default.Index].Value = ((paramsettings)tooltips[value]).normalvalue;
//Params.Rows[Params.RowCount - 1].Cells[mavScale.Index].Value = ((paramsettings)tooltips[value]).scale;
//Params.Rows[Params.RowCount - 1].Cells[Value.Index].Value = float.Parse(Params.Rows[Params.RowCount - 1].Cells[RawValue.Index].Value.ToString()) / float.Parse(Params.Rows[Params.RowCount - 1].Cells[mavScale.Index].Value.ToString());
}
}
catch { }
}
Params.Sort(Params.Columns[0], ListSortDirection.Ascending);
}
private void ConfigRawParams_Load(object sender, EventArgs e)
{
// read tooltips
if (tooltips.Count == 0)
readToolTips();
}
startup = true;
private void ConfigRawParams_ControlRemoved(object sender, ControlEventArgs e)
{
}
private void ConfigRawParams_ControlAdded(object sender, ControlEventArgs e)
{
}
processToScreen();
startup = false;
}
}
}

View File

@ -129,4 +129,7 @@
<metadata name="RawValue.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -47,6 +47,7 @@
this.Controls.Add(this.backstageView);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Configuration";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Configuration_FormClosing);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -23,9 +23,14 @@ namespace ArdupilotMega.GCSViews.ConfigurationView
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigAccelerometerCalibration(), "Level Calibration"));
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArducopter(), "Arducopter Setup"));
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArduplane(), "Arduplane Setup"));
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigArduplane(), "Heli Setup"));
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigTradHeli(), "Heli Setup"));
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigRawParams(), "Raw params (Advanced)"));
this.backstageView.AddPage(new BackstageView.BackstageViewPage(new ConfigPlanner(), "Planner"));
}
private void Configuration_FormClosing(object sender, FormClosingEventArgs e)
{
backstageView.Close();
}
}
}

View File

@ -29,20 +29,9 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Setup));
this.lbl_pleaseconnect = new System.Windows.Forms.Label();
this.backstageView = new ArdupilotMega.Controls.BackstageView.BackstageView();
this.SuspendLayout();
//
// lbl_pleaseconnect
//
this.lbl_pleaseconnect.AutoSize = true;
this.lbl_pleaseconnect.Location = new System.Drawing.Point(297, 284);
this.lbl_pleaseconnect.Name = "lbl_pleaseconnect";
this.lbl_pleaseconnect.Size = new System.Drawing.Size(104, 13);
this.lbl_pleaseconnect.TabIndex = 1;
this.lbl_pleaseconnect.Text = "Please Connect First";
this.lbl_pleaseconnect.Visible = false;
//
// backstageView
//
this.backstageView.AutoSize = true;
@ -55,7 +44,6 @@
// Setup
//
this.ClientSize = new System.Drawing.Size(823, 468);
this.Controls.Add(this.lbl_pleaseconnect);
this.Controls.Add(this.backstageView);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(839, 506);
@ -71,6 +59,5 @@
#endregion
private Controls.BackstageView.BackstageView backstageView;
private System.Windows.Forms.Label lbl_pleaseconnect;
}
}

View File

@ -276,14 +276,14 @@ namespace ArdupilotMega.GCSViews
{
//System.Threading.Thread.Sleep(1000);
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_CONTROLLER, 0); // request servoout
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTENDED_STATUS, MainV2.cs.ratestatus); // mode
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_POSITION, MainV2.cs.rateposition); // request gps
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA1, MainV2.cs.rateattitude); // request attitude
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA2, MainV2.cs.rateattitude); // request vfr
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA3, MainV2.cs.ratesensors); // request extra stuff - tridge
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, MainV2.cs.raterc); // request rc info
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_CONTROLLER, 0); // request servoout
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTENDED_STATUS, MainV2.cs.ratestatus); // mode
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.POSITION, MainV2.cs.rateposition); // request gps
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA1, MainV2.cs.rateattitude); // request attitude
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA2, MainV2.cs.rateattitude); // request vfr
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA3, MainV2.cs.ratesensors); // request extra stuff - tridge
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, MainV2.cs.raterc); // request rc info
}
catch { }
lastdata = DateTime.Now.AddSeconds(12); // prevent flooding
@ -927,7 +927,7 @@ namespace ArdupilotMega.GCSViews
{
MainV2.giveComport = true;
MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT, (byte)2);
MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT, (byte)2);
GuidedModeWP = new PointLatLngAlt(gotohere.lat, gotohere.lng, gotohere.alt,"Guided Mode");

View File

@ -1164,7 +1164,7 @@ namespace ArdupilotMega.GCSViews
sw.Write((a + 1)); // seq
sw.Write("\t" + 0); // current
sw.Write("\t" + (CHK_altmode.Checked == true ? (byte)MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL : (byte)MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT)); //frame
sw.Write("\t" + (CHK_altmode.Checked == true ? (byte)MAVLink.MAV_FRAME.GLOBAL : (byte)MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT)); //frame
sw.Write("\t" + mode);
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[Param1.Index].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
sw.Write("\t" + double.Parse(Commands.Rows[a].Cells[Param2.Index].Value.ToString()).ToString("0.000000", new System.Globalization.CultureInfo("en-US")));
@ -1352,9 +1352,9 @@ namespace ArdupilotMega.GCSViews
((Controls.ProgressReporterDialogue)sender).UpdateProgressAndStatus(0, "Set Home");
port.setWP(home, (ushort)0, MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL, 0);
port.setWP(home, (ushort)0, MAVLink.MAV_FRAME.GLOBAL, 0);
MAVLink.MAV_FRAME frame = MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT;
MAVLink.MAV_FRAME frame = MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT;
// process grid to memory eeprom
for (int a = 0; a < Commands.Rows.Count - 0; a++)
@ -1368,11 +1368,11 @@ namespace ArdupilotMega.GCSViews
{
if (CHK_altmode.Checked)
{
frame = MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL;
frame = MAVLink.MAV_FRAME.GLOBAL;
}
else
{
frame = MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT;
frame = MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT;
}
}

View File

@ -51,7 +51,11 @@ namespace ArdupilotMega.GCSViews
// gps buffer
int gpsbufferindex = 0;
#if !MAVLINK10
ArdupilotMega.MAVLink.mavlink_gps_raw_t[] gpsbuffer = new MAVLink.mavlink_gps_raw_t[5];
#else
ArdupilotMega.MAVLink.mavlink_gps_raw_int_t[] gpsbuffer = new MAVLink.mavlink_gps_raw_int_t[5];
#endif
// set defaults
int rollgain = 10000;
@ -374,7 +378,6 @@ namespace ArdupilotMega.GCSViews
/// <param name="write">true/false</param>
private void xmlconfig(bool write)
{
int fixme; // add profiles?
if (write)
{
ArdupilotMega.MainV2.config["REV_roll"] = CHKREV_roll.Checked.ToString();
@ -576,11 +579,11 @@ namespace ArdupilotMega.GCSViews
{
if (CHK_quad.Checked && !RAD_aerosimrc.Checked)// || chkSensor.Checked && RAD_JSBSim.Checked)
{
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_CONTROLLER, 0); // request servoout
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_CONTROLLER, 0); // request servoout
}
else
{
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_CONTROLLER, 50); // request servoout
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_CONTROLLER, 50); // request servoout
}
}
catch { }
@ -834,11 +837,11 @@ namespace ArdupilotMega.GCSViews
gps.fix_type = 3;
if (xplane9)
{
gps.cog = ((float)DATA[19][2]);
gps.cog = (ushort)((float)DATA[19][2]);
}
else
{
gps.cog = ((float)DATA[18][2]);
gps.cog = (ushort)((float)DATA[18][2]);
}
gps.lat = (int)(DATA[20][0] * 1.0e7);
gps.lon = (int)(DATA[20][1] * 1.0e7);
@ -1167,7 +1170,11 @@ namespace ArdupilotMega.GCSViews
sitlout.alt = gps.alt;
sitlout.lat = gps.lat;
sitlout.lon = gps.lon;
#if !MAVLINK10
sitlout.heading = gps.hdg;
#else
sitlout.heading = gps.cog;
#endif
sitlout.v_north = DATA[21][4];
sitlout.v_east = DATA[21][5];

View File

@ -799,7 +799,7 @@ namespace ArdupilotMega
public bool setWPCurrent(ushort index)
{
#if MAVLINK10
MainV2.givecomport = true;
MainV2.giveComport = true;
byte[] buffer;
mavlink_mission_set_current_t req = new mavlink_mission_set_current_t();
@ -825,7 +825,7 @@ namespace ArdupilotMega
retrys--;
continue;
}
MainV2.givecomport = false;
MainV2.giveComport = false;
throw new Exception("Timeout on read - setWPCurrent");
}
@ -834,7 +834,7 @@ namespace ArdupilotMega
{
if (buffer[5] == MAVLINK_MSG_ID_MISSION_CURRENT)
{
MainV2.givecomport = false;
MainV2.giveComport = false;
return true;
}
}
@ -844,7 +844,7 @@ namespace ArdupilotMega
public bool doCommand(MAV_CMD actionid, float p1, float p2, float p3, float p4, float p5, float p6, float p7)
{
MainV2.givecomport = true;
MainV2.giveComport = true;
byte[] buffer;
mavlink_command_long_t req = new mavlink_command_long_t();
@ -888,7 +888,7 @@ namespace ArdupilotMega
retrys--;
continue;
}
MainV2.givecomport = false;
MainV2.giveComport = false;
throw new Exception("Timeout on read - doAction");
}
@ -902,14 +902,14 @@ namespace ArdupilotMega
var ack = buffer.ByteArrayToStructure<mavlink_command_ack_t>(6);
if (ack.result == (byte)MAV_RESULT.MAV_RESULT_ACCEPTED)
if (ack.result == (byte)MAV_RESULT.ACCEPTED)
{
MainV2.givecomport = false;
MainV2.giveComport = false;
return true;
}
else
{
MainV2.givecomport = false;
MainV2.giveComport = false;
return false;
}
}
@ -1032,10 +1032,10 @@ namespace ArdupilotMega
switch (id)
{
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_ALL:
case (byte)MAVLink.MAV_DATA_STREAM.ALL:
break;
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTENDED_STATUS:
case (byte)MAVLink.MAV_DATA_STREAM.EXTENDED_STATUS:
if (packetspersecondbuild[MAVLINK_MSG_ID_SYS_STATUS] < DateTime.Now.AddSeconds(-2))
break;
pps = packetspersecond[MAVLINK_MSG_ID_SYS_STATUS];
@ -1044,7 +1044,7 @@ namespace ArdupilotMega
return;
}
break;
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA1:
case (byte)MAVLink.MAV_DATA_STREAM.EXTRA1:
if (packetspersecondbuild[MAVLINK_MSG_ID_ATTITUDE] < DateTime.Now.AddSeconds(-2))
break;
pps = packetspersecond[MAVLINK_MSG_ID_ATTITUDE];
@ -1053,7 +1053,7 @@ namespace ArdupilotMega
return;
}
break;
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA2:
case (byte)MAVLink.MAV_DATA_STREAM.EXTRA2:
if (packetspersecondbuild[MAVLINK_MSG_ID_VFR_HUD] < DateTime.Now.AddSeconds(-2))
break;
pps = packetspersecond[MAVLINK_MSG_ID_VFR_HUD];
@ -1062,7 +1062,7 @@ namespace ArdupilotMega
return;
}
break;
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA3:
case (byte)MAVLink.MAV_DATA_STREAM.EXTRA3:
if (packetspersecondbuild[MAVLINK_MSG_ID_AHRS] < DateTime.Now.AddSeconds(-2))
break;
pps = packetspersecond[MAVLINK_MSG_ID_AHRS];
@ -1071,7 +1071,7 @@ namespace ArdupilotMega
return;
}
break;
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_POSITION:
case (byte)MAVLink.MAV_DATA_STREAM.POSITION:
// ac2 does not send rate position
if (MainV2.cs.firmware == MainV2.Firmwares.ArduCopter2)
return;
@ -1083,7 +1083,7 @@ namespace ArdupilotMega
return;
}
break;
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_CONTROLLER:
case (byte)MAVLink.MAV_DATA_STREAM.RAW_CONTROLLER:
if (packetspersecondbuild[MAVLINK_MSG_ID_RC_CHANNELS_SCALED] < DateTime.Now.AddSeconds(-2))
break;
pps = packetspersecond[MAVLINK_MSG_ID_RC_CHANNELS_SCALED];
@ -1092,7 +1092,7 @@ namespace ArdupilotMega
return;
}
break;
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS:
case (byte)MAVLink.MAV_DATA_STREAM.RAW_SENSORS:
if (packetspersecondbuild[MAVLINK_MSG_ID_RAW_IMU] < DateTime.Now.AddSeconds(-2))
break;
pps = packetspersecond[MAVLINK_MSG_ID_RAW_IMU];
@ -1101,7 +1101,7 @@ namespace ArdupilotMega
return;
}
break;
case (byte)MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS:
case (byte)MAVLink.MAV_DATA_STREAM.RC_CHANNELS:
if (packetspersecondbuild[MAVLINK_MSG_ID_RC_CHANNELS_RAW] < DateTime.Now.AddSeconds(-2))
break;
pps = packetspersecond[MAVLINK_MSG_ID_RC_CHANNELS_RAW];
@ -1193,13 +1193,13 @@ namespace ArdupilotMega
{
if (retrys > 0)
{
log.Info("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport);
log.Info("getWPCount Retry " + retrys + " - giv com " + MainV2.giveComport);
generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST_LIST, req);
start = DateTime.Now;
retrys--;
continue;
}
MainV2.givecomport = false;
MainV2.giveComport = false;
//return (byte)int.Parse(param["WP_TOTAL"].ToString());
throw new Exception("Timeout on read - getWPCount");
}
@ -1216,7 +1216,7 @@ namespace ArdupilotMega
log.Info("wpcount: " + count.count);
MainV2.givecomport = false;
MainV2.giveComport = false;
return (byte)count.count; // should be ushort, but apm has limited wp count < byte
}
else
@ -1311,7 +1311,7 @@ namespace ArdupilotMega
retrys--;
continue;
}
MainV2.givecomport = false;
MainV2.giveComport = false;
throw new Exception("Timeout on read - getWP");
}
//Console.WriteLine("getwp read " + DateTime.Now.Millisecond);
@ -1561,7 +1561,7 @@ namespace ArdupilotMega
public void setWPTotal(ushort wp_total)
{
#if MAVLINK10
MainV2.givecomport = true;
MainV2.giveComport = true;
mavlink_mission_count_t req = new mavlink_mission_count_t();
req.target_system = sysid;
@ -1586,7 +1586,7 @@ namespace ArdupilotMega
retrys--;
continue;
}
MainV2.givecomport = false;
MainV2.giveComport = false;
throw new Exception("Timeout on read - setWPTotal");
}
byte[] buffer = readPacket();
@ -1605,7 +1605,7 @@ namespace ArdupilotMega
param["WP_TOTAL"] = (float)wp_total - 1;
if (param["CMD_TOTAL"] != null)
param["CMD_TOTAL"] = (float)wp_total - 1;
MainV2.givecomport = false;
MainV2.giveComport = false;
return;
}
}
@ -1813,12 +1813,12 @@ namespace ArdupilotMega
if (ans.seq == (index + 1))
{
log.Info("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]);
MainV2.givecomport = false;
MainV2.giveComport = false;
break;
}
else
{
log.Info("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component);
log.InfoFormat("set wp fail doing " + index + " req " + ans.seq + " ACK 47 or REQ 40 : " + buffer[5] + " seq {0} ts {1} tc {2}", req.seq, req.target_system, req.target_component);
//break;
}
}

View File

@ -8,7 +8,7 @@ namespace ArdupilotMega
#if MAVLINK10
partial class MAVLink
{
public const string MAVLINK_BUILD_DATE = "Wed Apr 4 18:13:10 2012";
public const string MAVLINK_BUILD_DATE = "Fri Apr 6 21:11:00 2012";
public const string MAVLINK_WIRE_PROTOCOL_VERSION = "1.0";
public const int MAVLINK_MAX_DIALECT_PAYLOAD_SIZE = 42;
@ -31,7 +31,7 @@ namespace ArdupilotMega
public Type[] MAVLINK_MESSAGE_INFO = new Type[] {typeof( mavlink_heartbeat_t ), typeof( mavlink_sys_status_t ), typeof( mavlink_system_time_t ), null, typeof( mavlink_ping_t ), typeof( mavlink_change_operator_control_t ), typeof( mavlink_change_operator_control_ack_t ), typeof( mavlink_auth_key_t ), null, null, null, typeof( mavlink_set_mode_t ), null, 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 ), typeof( mavlink_gps_raw_int_t ), typeof( mavlink_gps_status_t ), typeof( mavlink_scaled_imu_t ), typeof( mavlink_raw_imu_t ), typeof( mavlink_raw_pressure_t ), typeof( mavlink_scaled_pressure_t ), typeof( mavlink_attitude_t ), typeof( mavlink_attitude_quaternion_t ), typeof( mavlink_local_position_ned_t ), typeof( mavlink_global_position_int_t ), typeof( mavlink_rc_channels_scaled_t ), typeof( mavlink_rc_channels_raw_t ), typeof( mavlink_servo_output_raw_t ), typeof( mavlink_mission_request_partial_list_t ), typeof( mavlink_mission_write_partial_list_t ), typeof( mavlink_mission_item_t ), typeof( mavlink_mission_request_t ), typeof( mavlink_mission_set_current_t ), typeof( mavlink_mission_current_t ), typeof( mavlink_mission_request_list_t ), typeof( mavlink_mission_count_t ), typeof( mavlink_mission_clear_all_t ), typeof( mavlink_mission_item_reached_t ), typeof( mavlink_mission_ack_t ), typeof( mavlink_set_gps_global_origin_t ), typeof( mavlink_gps_global_origin_t ), typeof( mavlink_set_local_position_setpoint_t ), typeof( mavlink_local_position_setpoint_t ), typeof( mavlink_global_position_setpoint_int_t ), typeof( mavlink_set_global_position_setpoint_int_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, typeof( mavlink_nav_controller_output_t ), null, typeof( mavlink_state_correction_t ), null, typeof( mavlink_request_data_stream_t ), typeof( mavlink_data_stream_t ), null, typeof( mavlink_manual_control_t ), typeof( mavlink_rc_channels_override_t ), null, null, null, typeof( mavlink_vfr_hud_t ), null, typeof( mavlink_command_long_t ), typeof( mavlink_command_ack_t ), null, null, null, null, null, null, null, null, null, null, null, null, typeof( mavlink_hil_state_t ), typeof( mavlink_hil_controls_t ), typeof( mavlink_hil_rc_inputs_raw_t ), null, null, null, null, null, null, null, typeof( mavlink_optical_flow_t ), typeof( mavlink_global_vision_position_estimate_t ), typeof( mavlink_vision_position_estimate_t ), typeof( mavlink_vision_speed_estimate_t ), typeof( mavlink_vicon_position_estimate_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, 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 ), typeof( mavlink_ahrs_t ), typeof( mavlink_simstate_t ), typeof( mavlink_hwstatus_t ), typeof( mavlink_radio_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, typeof( mavlink_memory_vect_t ), 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 ), typeof( mavlink_extended_message_t )};
public const byte MAVLINK_VERSION = 3;
public const byte MAVLINK_VERSION = 2;
/** @brief Enumeration of possible mount operation modes */
@ -56,25 +56,25 @@ namespace ArdupilotMega
public enum MAV_CMD
{
///<summary> Navigate to MISSION. |Hold time in decimal seconds. (ignored by fixed wing, time to stay at MISSION for rotary wing)| Acceptance radius in meters (if the sphere with this radius is hit, the MISSION 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 MISSION (rotary wing)| Latitude| Longitude| Altitude| </summary>
NAV_WAYPOINT=16,
WAYPOINT=16,
///<summary> Loiter around this MISSION an unlimited amount of time |Empty| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| </summary>
NAV_LOITER_UNLIM=17,
LOITER_UNLIM=17,
///<summary> Loiter around this MISSION for X turns |Turns| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| </summary>
NAV_LOITER_TURNS=18,
LOITER_TURNS=18,
///<summary> Loiter around this MISSION for X seconds |Seconds (decimal)| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| </summary>
NAV_LOITER_TIME=19,
LOITER_TIME=19,
///<summary> Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| </summary>
NAV_RETURN_TO_LAUNCH=20,
RETURN_TO_LAUNCH=20,
///<summary> Land at location |Empty| Empty| Empty| Desired yaw angle.| Latitude| Longitude| Altitude| </summary>
NAV_LAND=21,
LAND=21,
///<summary> Takeoff from ground / hand |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer| Latitude| Longitude| Altitude| </summary>
NAV_TAKEOFF=22,
TAKEOFF=22,
///<summary> Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of intereset mode. (see MAV_ROI enum)| MISSION index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| </summary>
NAV_ROI=80,
ROI=80,
///<summary> Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal, in compass degrees, [0..360]| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| </summary>
NAV_PATHPLANNING=81,
PATHPLANNING=81,
///<summary> NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| </summary>
NAV_LAST=95,
LAST=95,
///<summary> Delay mission state machine. |Delay in seconds (decimal)| Empty| Empty| Empty| Empty| Empty| Empty| </summary>
CONDITION_DELAY=112,
///<summary> Ascend/descend at rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate (m/s)| Empty| Empty| Empty| Empty| Empty| Finish Altitude| </summary>
@ -162,6 +162,445 @@ namespace ArdupilotMega
/** @brief Micro air vehicle / autopilot classes. This identifies the individual model. */
public enum MAV_AUTOPILOT
{
///<summary> Generic autopilot, full support for everything | </summary>
GENERIC=0,
///<summary> PIXHAWK autopilot, http://pixhawk.ethz.ch | </summary>
PIXHAWK=1,
///<summary> SLUGS autopilot, http://slugsuav.soe.ucsc.edu | </summary>
SLUGS=2,
///<summary> ArduPilotMega / ArduCopter, http://diydrones.com | </summary>
ARDUPILOTMEGA=3,
///<summary> OpenPilot, http://openpilot.org | </summary>
OPENPILOT=4,
///<summary> Generic autopilot only supporting simple waypoints | </summary>
GENERIC_WAYPOINTS_ONLY=5,
///<summary> Generic autopilot supporting waypoints and other simple navigation commands | </summary>
GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY=6,
///<summary> Generic autopilot supporting the full mission command set | </summary>
GENERIC_MISSION_FULL=7,
///<summary> No valid autopilot, e.g. a GCS or other MAVLink component | </summary>
INVALID=8,
///<summary> PPZ UAV - http://nongnu.org/paparazzi | </summary>
PPZ=9,
///<summary> UAV Dev Board | </summary>
UDB=10,
///<summary> FlexiPilot | </summary>
FP=11,
///<summary> | </summary>
ENUM_END=12,
};
/** @brief These flags encode the MAV mode. */
public enum MAV_MODE_FLAG
{
///<summary> 0b00000001 Reserved for future use. | </summary>
CUSTOM_MODE_ENABLED=1,
///<summary> 0b00000010 system has a test mode enabled. This flag is intended for temporary system tests and should not be used for stable implementations. | </summary>
TEST_ENABLED=2,
///<summary> 0b00000100 autonomous mode enabled, system finds its own goal positions. Guided flag can be set or not, depends on the actual implementation. | </summary>
AUTO_ENABLED=4,
///<summary> 0b00001000 guided mode enabled, system flies MISSIONs / mission items. | </summary>
GUIDED_ENABLED=8,
///<summary> 0b00010000 system stabilizes electronically its attitude (and optionally position). It needs however further control inputs to move around. | </summary>
STABILIZE_ENABLED=16,
///<summary> 0b00100000 hardware in the loop simulation. All motors / actuators are blocked, but internal software is full operational. | </summary>
HIL_ENABLED=32,
///<summary> 0b01000000 remote control input is enabled. | </summary>
MANUAL_INPUT_ENABLED=64,
///<summary> 0b10000000 MAV safety set to armed. Motors are enabled / running / can start. Ready to fly. | </summary>
SAFETY_ARMED=128,
///<summary> | </summary>
ENUM_END=129,
};
/** @brief These values encode the bit positions of the decode position. These values can be used to read the value of a flag bit by combining the base_mode variable with AND with the flag position value. The result will be either 0 or 1, depending on if the flag is set or not. */
public enum MAV_MODE_FLAG_DECODE_POSITION
{
///<summary> Eighth bit: 00000001 | </summary>
CUSTOM_MODE=1,
///<summary> Seventh bit: 00000010 | </summary>
TEST=2,
///<summary> Sixt bit: 00000100 | </summary>
AUTO=4,
///<summary> Fifth bit: 00001000 | </summary>
GUIDED=8,
///<summary> Fourth bit: 00010000 | </summary>
STABILIZE=16,
///<summary> Third bit: 00100000 | </summary>
HIL=32,
///<summary> Second bit: 01000000 | </summary>
MANUAL=64,
///<summary> First bit: 10000000 | </summary>
SAFETY=128,
///<summary> | </summary>
ENUM_END=129,
};
/** @brief Override command, pauses current mission execution and moves immediately to a position */
public enum MAV_GOTO
{
///<summary> Hold at the current position. | </summary>
DO_HOLD=0,
///<summary> Continue with the next item in mission execution. | </summary>
DO_CONTINUE=1,
///<summary> Hold at the current position of the system | </summary>
HOLD_AT_CURRENT_POSITION=2,
///<summary> Hold at the position specified in the parameters of the DO_HOLD action | </summary>
HOLD_AT_SPECIFIED_POSITION=3,
///<summary> | </summary>
ENUM_END=4,
};
/** @brief These defines are predefined OR-combined mode flags. There is no need to use values from this enum, but it simplifies the use of the mode flags. Note that manual input is enabled in all modes as a safety override. */
public enum MAV_MODE
{
///<summary> System is not ready to fly, booting, calibrating, etc. No flag is set. | </summary>
PREFLIGHT=0,
///<summary> System is allowed to be active, under manual (RC) control, no stabilization | </summary>
MANUAL_DISARMED=64,
///<summary> UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. | </summary>
TEST_DISARMED=66,
///<summary> System is allowed to be active, under assisted RC control. | </summary>
STABILIZE_DISARMED=80,
///<summary> System is allowed to be active, under autonomous control, manual setpoint | </summary>
GUIDED_DISARMED=88,
///<summary> System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by MISSIONs) | </summary>
AUTO_DISARMED=92,
///<summary> System is allowed to be active, under manual (RC) control, no stabilization | </summary>
MANUAL_ARMED=192,
///<summary> UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. | </summary>
TEST_ARMED=194,
///<summary> System is allowed to be active, under assisted RC control. | </summary>
STABILIZE_ARMED=208,
///<summary> System is allowed to be active, under autonomous control, manual setpoint | </summary>
GUIDED_ARMED=216,
///<summary> System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by MISSIONs) | </summary>
AUTO_ARMED=220,
///<summary> | </summary>
ENUM_END=221,
};
/** @brief */
public enum MAV_STATE
{
///<summary> Uninitialized system, state is unknown. | </summary>
UNINIT=0,
///<summary> System is booting up. | </summary>
BOOT=1,
///<summary> System is calibrating and not flight-ready. | </summary>
CALIBRATING=2,
///<summary> System is grounded and on standby. It can be launched any time. | </summary>
STANDBY=3,
///<summary> System is active and might be already airborne. Motors are engaged. | </summary>
ACTIVE=4,
///<summary> System is in a non-normal flight mode. It can however still navigate. | </summary>
CRITICAL=5,
///<summary> System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down. | </summary>
EMERGENCY=6,
///<summary> System just initialized its power-down sequence, will shut down now. | </summary>
POWEROFF=7,
///<summary> | </summary>
ENUM_END=8,
};
/** @brief */
public enum MAV_TYPE
{
///<summary> Generic micro air vehicle. | </summary>
GENERIC=0,
///<summary> Fixed wing aircraft. | </summary>
FIXED_WING=1,
///<summary> Quadrotor | </summary>
QUADROTOR=2,
///<summary> Coaxial helicopter | </summary>
COAXIAL=3,
///<summary> Normal helicopter with tail rotor. | </summary>
HELICOPTER=4,
///<summary> Ground installation | </summary>
ANTENNA_TRACKER=5,
///<summary> Operator control unit / ground control station | </summary>
GCS=6,
///<summary> Airship, controlled | </summary>
AIRSHIP=7,
///<summary> Free balloon, uncontrolled | </summary>
FREE_BALLOON=8,
///<summary> Rocket | </summary>
ROCKET=9,
///<summary> Ground rover | </summary>
GROUND_ROVER=10,
///<summary> Surface vessel, boat, ship | </summary>
SURFACE_BOAT=11,
///<summary> Submarine | </summary>
SUBMARINE=12,
///<summary> Hexarotor | </summary>
HEXAROTOR=13,
///<summary> Octorotor | </summary>
OCTOROTOR=14,
///<summary> Octorotor | </summary>
TRICOPTER=15,
///<summary> Flapping wing | </summary>
FLAPPING_WING=16,
///<summary> | </summary>
ENUM_END=17,
};
/** @brief */
public enum MAV_COMPONENT
{
///<summary> | </summary>
MAV_COMP_ID_ALL=0,
///<summary> | </summary>
MAV_COMP_ID_CAMERA=100,
///<summary> | </summary>
MAV_COMP_ID_SERVO1=140,
///<summary> | </summary>
MAV_COMP_ID_SERVO2=141,
///<summary> | </summary>
MAV_COMP_ID_SERVO3=142,
///<summary> | </summary>
MAV_COMP_ID_SERVO4=143,
///<summary> | </summary>
MAV_COMP_ID_SERVO5=144,
///<summary> | </summary>
MAV_COMP_ID_SERVO6=145,
///<summary> | </summary>
MAV_COMP_ID_SERVO7=146,
///<summary> | </summary>
MAV_COMP_ID_SERVO8=147,
///<summary> | </summary>
MAV_COMP_ID_SERVO9=148,
///<summary> | </summary>
MAV_COMP_ID_SERVO10=149,
///<summary> | </summary>
MAV_COMP_ID_SERVO11=150,
///<summary> | </summary>
MAV_COMP_ID_SERVO12=151,
///<summary> | </summary>
MAV_COMP_ID_SERVO13=152,
///<summary> | </summary>
MAV_COMP_ID_SERVO14=153,
///<summary> | </summary>
MAV_COMP_ID_MAPPER=180,
///<summary> | </summary>
MAV_COMP_ID_MISSIONPLANNER=190,
///<summary> | </summary>
MAV_COMP_ID_PATHPLANNER=195,
///<summary> | </summary>
MAV_COMP_ID_IMU=200,
///<summary> | </summary>
MAV_COMP_ID_IMU_2=201,
///<summary> | </summary>
MAV_COMP_ID_IMU_3=202,
///<summary> | </summary>
MAV_COMP_ID_GPS=220,
///<summary> | </summary>
MAV_COMP_ID_UDP_BRIDGE=240,
///<summary> | </summary>
MAV_COMP_ID_UART_BRIDGE=241,
///<summary> | </summary>
MAV_COMP_ID_SYSTEM_CONTROL=250,
///<summary> | </summary>
ENUM_END=251,
};
/** @brief */
public enum MAV_FRAME
{
///<summary> Global coordinate frame, WGS84 coordinate system. First value / x: latitude, second value / y: longitude, third value / z: positive altitude over mean sea level (MSL) | </summary>
GLOBAL=0,
///<summary> Local coordinate frame, Z-up (x: north, y: east, z: down). | </summary>
LOCAL_NED=1,
///<summary> NOT a coordinate frame, indicates a mission command. | </summary>
MISSION=2,
///<summary> Global coordinate frame, WGS84 coordinate system, relative altitude over ground with respect to the home position. First value / x: latitude, second value / y: longitude, third value / z: positive altitude with 0 being at the altitude of the home location. | </summary>
GLOBAL_RELATIVE_ALT=3,
///<summary> Local coordinate frame, Z-down (x: east, y: north, z: up) | </summary>
LOCAL_ENU=4,
///<summary> | </summary>
ENUM_END=5,
};
/** @brief */
public enum MAVLINK_DATA_STREAM_TYPE
{
///<summary> | </summary>
MAVLINK_DATA_STREAM_IMG_JPEG=1,
///<summary> | </summary>
MAVLINK_DATA_STREAM_IMG_BMP=2,
///<summary> | </summary>
MAVLINK_DATA_STREAM_IMG_RAW8U=3,
///<summary> | </summary>
MAVLINK_DATA_STREAM_IMG_RAW32U=4,
///<summary> | </summary>
MAVLINK_DATA_STREAM_IMG_PGM=5,
///<summary> | </summary>
MAVLINK_DATA_STREAM_IMG_PNG=6,
///<summary> | </summary>
ENUM_END=7,
};
/** @brief Data stream IDs. A data stream is not a fixed set of messages, but rather a recommendation to the autopilot software. Individual autopilots may or may not obey the recommended messages. */
public enum MAV_DATA_STREAM
{
///<summary> Enable all data streams | </summary>
ALL=0,
///<summary> Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. | </summary>
RAW_SENSORS=1,
///<summary> Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | </summary>
EXTENDED_STATUS=2,
///<summary> Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | </summary>
RC_CHANNELS=3,
///<summary> Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | </summary>
RAW_CONTROLLER=4,
///<summary> Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | </summary>
POSITION=6,
///<summary> Dependent on the autopilot | </summary>
EXTRA1=10,
///<summary> Dependent on the autopilot | </summary>
EXTRA2=11,
///<summary> Dependent on the autopilot | </summary>
EXTRA3=12,
///<summary> | </summary>
ENUM_END=13,
};
/** @brief The ROI (region of interest) for the vehicle. This can be be used by the vehicle for camera/vehicle attitude alignment (see MAV_CMD_NAV_ROI). */
public enum MAV_ROI
{
///<summary> No region of interest. | </summary>
NONE=0,
///<summary> Point toward next MISSION. | </summary>
WPNEXT=1,
///<summary> Point toward given MISSION. | </summary>
WPINDEX=2,
///<summary> Point toward fixed location. | </summary>
LOCATION=3,
///<summary> Point toward of given id. | </summary>
TARGET=4,
///<summary> | </summary>
ENUM_END=5,
};
/** @brief ACK / NACK / ERROR values as a result of MAV_CMDs and for mission item transmission. */
public enum MAV_CMD_ACK
{
///<summary> Command / mission item is ok. | </summary>
OK=1,
///<summary> Generic error message if none of the other reasons fails or if no detailed error reporting is implemented. | </summary>
ERR_FAIL=2,
///<summary> The system is refusing to accept this command from this source / communication partner. | </summary>
ERR_ACCESS_DENIED=3,
///<summary> Command or mission item is not supported, other commands would be accepted. | </summary>
ERR_NOT_SUPPORTED=4,
///<summary> The coordinate frame of this command / mission item is not supported. | </summary>
ERR_COORDINATE_FRAME_NOT_SUPPORTED=5,
///<summary> The coordinate frame of this command is ok, but he coordinate values exceed the safety limits of this system. This is a generic error, please use the more specific error messages below if possible. | </summary>
ERR_COORDINATES_OUT_OF_RANGE=6,
///<summary> The X or latitude value is out of range. | </summary>
ERR_X_LAT_OUT_OF_RANGE=7,
///<summary> The Y or longitude value is out of range. | </summary>
ERR_Y_LON_OUT_OF_RANGE=8,
///<summary> The Z or altitude value is out of range. | </summary>
ERR_Z_ALT_OUT_OF_RANGE=9,
///<summary> | </summary>
ENUM_END=10,
};
/** @brief type of a mavlink parameter */
public enum MAV_VAR
{
///<summary> 32 bit float | </summary>
FLOAT=0,
///<summary> 8 bit unsigned integer | </summary>
UINT8=1,
///<summary> 8 bit signed integer | </summary>
INT8=2,
///<summary> 16 bit unsigned integer | </summary>
UINT16=3,
///<summary> 16 bit signed integer | </summary>
INT16=4,
///<summary> 32 bit unsigned integer | </summary>
UINT32=5,
///<summary> 32 bit signed integer | </summary>
INT32=6,
///<summary> | </summary>
ENUM_END=7,
};
/** @brief result from a mavlink command */
public enum MAV_RESULT
{
///<summary> Command ACCEPTED and EXECUTED | </summary>
ACCEPTED=0,
///<summary> Command TEMPORARY REJECTED/DENIED | </summary>
TEMPORARILY_REJECTED=1,
///<summary> Command PERMANENTLY DENIED | </summary>
DENIED=2,
///<summary> Command UNKNOWN/UNSUPPORTED | </summary>
UNSUPPORTED=3,
///<summary> Command executed, but failed | </summary>
FAILED=4,
///<summary> | </summary>
ENUM_END=5,
};
/** @brief result in a mavlink mission ack */
public enum MAV_MISSION_RESULT
{
///<summary> mission accepted OK | </summary>
MAV_MISSION_ACCEPTED=0,
///<summary> generic error / not accepting mission commands at all right now | </summary>
MAV_MISSION_ERROR=1,
///<summary> coordinate frame is not supported | </summary>
MAV_MISSION_UNSUPPORTED_FRAME=2,
///<summary> command is not supported | </summary>
MAV_MISSION_UNSUPPORTED=3,
///<summary> mission item exceeds storage space | </summary>
MAV_MISSION_NO_SPACE=4,
///<summary> one of the parameters has an invalid value | </summary>
MAV_MISSION_INVALID=5,
///<summary> param1 has an invalid value | </summary>
MAV_MISSION_INVALID_PARAM1=6,
///<summary> param2 has an invalid value | </summary>
MAV_MISSION_INVALID_PARAM2=7,
///<summary> param3 has an invalid value | </summary>
MAV_MISSION_INVALID_PARAM3=8,
///<summary> param4 has an invalid value | </summary>
MAV_MISSION_INVALID_PARAM4=9,
///<summary> x/param5 has an invalid value | </summary>
MAV_MISSION_INVALID_PARAM5_X=10,
///<summary> y/param6 has an invalid value | </summary>
MAV_MISSION_INVALID_PARAM6_Y=11,
///<summary> param7 has an invalid value | </summary>
MAV_MISSION_INVALID_PARAM7=12,
///<summary> received waypoint out of sequence | </summary>
MAV_MISSION_INVALID_SEQUENCE=13,
///<summary> not accepting any mission commands from this communication partner | </summary>
MAV_MISSION_DENIED=14,
///<summary> | </summary>
ENUM_END=15,
};
public const byte MAVLINK_MSG_ID_SENSOR_OFFSETS = 150;
[StructLayout(LayoutKind.Sequential,Pack=1,Size=42)]
public struct mavlink_sensor_offsets_t
@ -479,7 +918,7 @@ namespace ArdupilotMega
/// <summary> serial errors </summary>
public UInt16 serrors;
/// <summary> count of error corrected packets </summary>
public UInt16 fixed;
public UInt16 fixedp;
/// <summary> local signal strength </summary>
public byte rssi;
/// <summary> remote signal strength </summary>
@ -669,7 +1108,7 @@ namespace ArdupilotMega
public UInt16 param_index;
/// <summary> Onboard parameter id </summary>
[MarshalAs(UnmanagedType.ByValArray,SizeConst=16)]
public string param_id;
public byte[] param_id;
/// <summary> Onboard parameter type: see MAV_VAR enum </summary>
public byte param_type;
@ -688,7 +1127,7 @@ namespace ArdupilotMega
public byte target_component;
/// <summary> Onboard parameter id </summary>
[MarshalAs(UnmanagedType.ByValArray,SizeConst=16)]
public string param_id;
public byte[] param_id;
/// <summary> Onboard parameter type: see MAV_VAR enum </summary>
public byte param_type;

View File

@ -8,7 +8,7 @@ namespace ArdupilotMega
#if !MAVLINK10
partial class MAVLink
{
public const string MAVLINK_BUILD_DATE = "Wed Apr 4 18:13:05 2012";
public const string MAVLINK_BUILD_DATE = "Fri Apr 6 21:10:55 2012";
public const string MAVLINK_WIRE_PROTOCOL_VERSION = "0.9";
public const int MAVLINK_MAX_DIALECT_PAYLOAD_SIZE = 42;
@ -156,6 +156,51 @@ namespace ArdupilotMega
/** @brief Data stream IDs. A data stream is not a fixed set of messages, but rather a recommendation to the autopilot software. Individual autopilots may or may not obey the recommended messages. */
public enum MAV_DATA_STREAM
{
///<summary> Enable all data streams | </summary>
ALL=0,
///<summary> Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. | </summary>
RAW_SENSORS=1,
///<summary> Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | </summary>
EXTENDED_STATUS=2,
///<summary> Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | </summary>
RC_CHANNELS=3,
///<summary> Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | </summary>
RAW_CONTROLLER=4,
///<summary> Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | </summary>
POSITION=6,
///<summary> Dependent on the autopilot | </summary>
EXTRA1=10,
///<summary> Dependent on the autopilot | </summary>
EXTRA2=11,
///<summary> Dependent on the autopilot | </summary>
EXTRA3=12,
///<summary> | </summary>
ENUM_END=13,
};
/** @brief The ROI (region of interest) for the vehicle. This can be be used by the vehicle for camera/vehicle attitude alignment (see MAV_CMD_NAV_ROI). */
public enum MAV_ROI
{
///<summary> No region of interest. | </summary>
NONE=0,
///<summary> Point toward next waypoint. | </summary>
WPNEXT=1,
///<summary> Point toward given waypoint. | </summary>
WPINDEX=2,
///<summary> Point toward fixed location. | </summary>
LOCATION=3,
///<summary> Point toward of given id. | </summary>
TARGET=4,
///<summary> | </summary>
ENUM_END=5,
};
public const byte MAVLINK_MSG_ID_SENSOR_OFFSETS = 150;
[StructLayout(LayoutKind.Sequential,Pack=1,Size=42)]
public struct mavlink_sensor_offsets_t
@ -1780,173 +1825,8 @@ namespace ArdupilotMega
/// <summary> index of debug variable </summary>
public byte ind;
/// <summary> DEBUG value </summary>
public Single value; };
public enum MAV_CLASS
{
MAV_CLASS_GENERIC = 0, /// Generic autopilot, full support for everything
MAV_CLASS_PIXHAWK = 1, /// PIXHAWK autopilot, http://pixhawk.ethz.ch
MAV_CLASS_SLUGS = 2, /// SLUGS autopilot, http://slugsuav.soe.ucsc.edu
MAV_CLASS_ARDUPILOTMEGA = 3, /// ArduPilotMega / ArduCopter, http://diydrones.com
MAV_CLASS_OPENPILOT = 4, /// OpenPilot, http://openpilot.org
MAV_CLASS_GENERIC_MISSION_WAYPOINTS_ONLY = 5, /// Generic autopilot only supporting simple waypoints
MAV_CLASS_GENERIC_MISSION_NAVIGATION_ONLY = 6, /// Generic autopilot supporting waypoints and other simple navigation commands
MAV_CLASS_GENERIC_MISSION_FULL = 7, /// Generic autopilot supporting the full mission command set
MAV_CLASS_NONE = 8, /// No valid autopilot
MAV_CLASS_NB /// Number of autopilot classes
};
public Single value;
public enum MAV_ACTION
{
MAV_ACTION_HOLD = 0,
MAV_ACTION_MOTORS_START = 1,
MAV_ACTION_LAUNCH = 2,
MAV_ACTION_RETURN = 3,
MAV_ACTION_EMCY_LAND = 4,
MAV_ACTION_EMCY_KILL = 5,
MAV_ACTION_CONFIRM_KILL = 6,
MAV_ACTION_CONTINUE = 7,
MAV_ACTION_MOTORS_STOP = 8,
MAV_ACTION_HALT = 9,
MAV_ACTION_SHUTDOWN = 10,
MAV_ACTION_REBOOT = 11,
MAV_ACTION_SET_MANUAL = 12,
MAV_ACTION_SET_AUTO = 13,
MAV_ACTION_STORAGE_READ = 14,
MAV_ACTION_STORAGE_WRITE = 15,
MAV_ACTION_CALIBRATE_RC = 16,
MAV_ACTION_CALIBRATE_GYRO = 17,
MAV_ACTION_CALIBRATE_MAG = 18,
MAV_ACTION_CALIBRATE_ACC = 19,
MAV_ACTION_CALIBRATE_PRESSURE = 20,
MAV_ACTION_REC_START = 21,
MAV_ACTION_REC_PAUSE = 22,
MAV_ACTION_REC_STOP = 23,
MAV_ACTION_TAKEOFF = 24,
MAV_ACTION_NAVIGATE = 25,
MAV_ACTION_LAND = 26,
MAV_ACTION_LOITER = 27,
MAV_ACTION_SET_ORIGIN = 28,
MAV_ACTION_RELAY_ON = 29,
MAV_ACTION_RELAY_OFF = 30,
MAV_ACTION_GET_IMAGE = 31,
MAV_ACTION_VIDEO_START = 32,
MAV_ACTION_VIDEO_STOP = 33,
MAV_ACTION_RESET_MAP = 34,
MAV_ACTION_RESET_PLAN = 35,
MAV_ACTION_DELAY_BEFORE_COMMAND = 36,
MAV_ACTION_ASCEND_AT_RATE = 37,
MAV_ACTION_CHANGE_MODE = 38,
MAV_ACTION_LOITER_MAX_TURNS = 39,
MAV_ACTION_LOITER_MAX_TIME = 40,
MAV_ACTION_START_HILSIM = 41,
MAV_ACTION_STOP_HILSIM = 42,
MAV_ACTION_NB /// Number of MAV actions
};
public enum MAV_MODE
{
MAV_MODE_UNINIT = 0, /// System is in undefined state
MAV_MODE_LOCKED = 1, /// Motors are blocked, system is safe
MAV_MODE_MANUAL = 2, /// System is allowed to be active, under manual (RC) control
MAV_MODE_GUIDED = 3, /// System is allowed to be active, under autonomous control, manual setpoint
MAV_MODE_AUTO = 4, /// System is allowed to be active, under autonomous control and navigation
MAV_MODE_TEST1 = 5, /// Generic test mode, for custom use
MAV_MODE_TEST2 = 6, /// Generic test mode, for custom use
MAV_MODE_TEST3 = 7, /// Generic test mode, for custom use
MAV_MODE_READY = 8, /// System is ready, motors are unblocked, but controllers are inactive
MAV_MODE_RC_TRAINING = 9 /// System is blocked, only RC valued are read and reported back
};
public enum MAV_STATE
{
MAV_STATE_UNINIT = 0,
MAV_STATE_BOOT,
MAV_STATE_CALIBRATING,
MAV_STATE_STANDBY,
MAV_STATE_ACTIVE,
MAV_STATE_CRITICAL,
MAV_STATE_EMERGENCY,
MAV_STATE_HILSIM,
MAV_STATE_POWEROFF
};
public enum MAV_NAV
{
MAV_NAV_GROUNDED = 0,
MAV_NAV_LIFTOFF,
MAV_NAV_HOLD,
MAV_NAV_WAYPOINT,
MAV_NAV_VECTOR,
MAV_NAV_RETURNING,
MAV_NAV_LANDING,
MAV_NAV_LOST,
MAV_NAV_LOITER,
MAV_NAV_FREE_DRIFT
};
public enum MAV_TYPE
{
MAV_GENERIC = 0,
MAV_FIXED_WING = 1,
MAV_QUADROTOR = 2,
MAV_COAXIAL = 3,
MAV_HELICOPTER = 4,
MAV_GROUND = 5,
OCU = 6,
MAV_AIRSHIP = 7,
MAV_FREE_BALLOON = 8,
MAV_ROCKET = 9,
UGV_GROUND_ROVER = 10,
UGV_SURFACE_SHIP = 11
};
public enum MAV_AUTOPILOT_TYPE
{
MAV_AUTOPILOT_GENERIC = 0,
MAV_AUTOPILOT_PIXHAWK = 1,
MAV_AUTOPILOT_SLUGS = 2,
MAV_AUTOPILOT_ARDUPILOTMEGA = 3,
MAV_AUTOPILOT_NONE = 4
};
public enum MAV_COMPONENT
{
MAV_COMP_ID_GPS,
MAV_COMP_ID_WAYPOINTPLANNER,
MAV_COMP_ID_BLOBTRACKER,
MAV_COMP_ID_PATHPLANNER,
MAV_COMP_ID_AIRSLAM,
MAV_COMP_ID_MAPPER,
MAV_COMP_ID_CAMERA,
MAV_COMP_ID_IMU = 200,
MAV_COMP_ID_IMU_2 = 201,
MAV_COMP_ID_IMU_3 = 202,
MAV_COMP_ID_UDP_BRIDGE = 240,
MAV_COMP_ID_UART_BRIDGE = 241,
MAV_COMP_ID_SYSTEM_CONTROL = 250
};
public enum MAV_FRAME
{
MAV_FRAME_GLOBAL = 0,
MAV_FRAME_LOCAL = 1,
MAV_FRAME_MISSION = 2,
MAV_FRAME_GLOBAL_RELATIVE_ALT = 3,
MAV_FRAME_LOCAL_ENU = 4
};
public enum MAV_DATA_STREAM
{
MAV_DATA_STREAM_ALL=0, /* Enable all data streams | */
MAV_DATA_STREAM_RAW_SENSORS=1, /* Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. | */
MAV_DATA_STREAM_EXTENDED_STATUS=2, /* Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | */
MAV_DATA_STREAM_RC_CHANNELS=3, /* Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | */
MAV_DATA_STREAM_RAW_CONTROLLER=4, /* Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | */
MAV_DATA_STREAM_POSITION=6, /* Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | */
MAV_DATA_STREAM_EXTRA1=10, /* Dependent on the autopilot | */
MAV_DATA_STREAM_EXTRA2=11, /* Dependent on the autopilot | */
MAV_DATA_STREAM_EXTRA3=12, /* Dependent on the autopilot | */
MAV_DATA_STREAM_ENUM_END=13, /* | */
};
}

View File

@ -993,8 +993,8 @@ namespace ArdupilotMega
MAVLink.mavlink_heartbeat_t htb = new MAVLink.mavlink_heartbeat_t();
#if MAVLINK10
htb.type = (byte)MAVLink.MAV_TYPE.MAV_TYPE_GCS;
htb.autopilot = (byte)MAVLink.MAV_AUTOPILOT.MAV_AUTOPILOT_ARDUPILOTMEGA;
htb.type = (byte)MAVLink.MAV_TYPE.GCS;
htb.autopilot = (byte)MAVLink.MAV_AUTOPILOT.ARDUPILOTMEGA;
htb.mavlink_version = 3;
#else
htb.type = (byte)MAVLink.MAV_TYPE.MAV_GENERIC;
@ -1896,7 +1896,7 @@ namespace ArdupilotMega
}
if (keyData == (Keys.Control | Keys.W)) // test
{
Form frm = new GCSViews.ConfigurationView.Setup();
Form frm = new GCSViews.ConfigurationView.Configuration();
ThemeManager.ApplyThemeTo(frm);
frm.Show();
return true;

View File

@ -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.61")]
[assembly: AssemblyFileVersion("1.1.62")]
[assembly: NeutralResourcesLanguageAttribute("")]

View File

@ -217,7 +217,7 @@ namespace ArdupilotMega
MainV2.cs.ratesensors = 3; // hardcode 3 hz
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
}
catch { }
}
@ -242,12 +242,12 @@ namespace ArdupilotMega
//comPort.stopall(true); // ensure off
Console.WriteLine("Req streams {0} {1}", comPort.bps, DateTime.Now);
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTENDED_STATUS, 0); // mode gps raw
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_POSITION, 3); // request location
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA1, 3); // request attitude
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_EXTRA2, 3); // request vfr
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RC_CHANNELS, 3); // request rc info
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTENDED_STATUS, 0); // mode gps raw
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.POSITION, 3); // request location
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA1, 3); // request attitude
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.EXTRA2, 3); // request vfr
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, MainV2.cs.ratesensors); // request raw sensor
//comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RC_CHANNELS, 3); // request rc info
}
catch
{
@ -260,7 +260,7 @@ namespace ArdupilotMega
private void CMB_rawupdaterate_SelectedIndexChanged(object sender, EventArgs e)
{
MainV2.cs.ratesensors = (byte)int.Parse(CMB_rawupdaterate.Text);
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.MAV_DATA_STREAM_RAW_SENSORS, (byte)int.Parse(CMB_rawupdaterate.Text)); // request raw sensor
comPort.requestDatastream((byte)ArdupilotMega.MAVLink.MAV_DATA_STREAM.RAW_SENSORS, (byte)int.Parse(CMB_rawupdaterate.Text)); // request raw sensor
}
System.IO.StreamWriter sw = null;

View File

@ -159,7 +159,7 @@ namespace ArdupilotMega
{
MainV2.giveComport = true;
MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT, (byte)2);
MainV2.comPort.setWP(gotohere, 0, MAVLink.MAV_FRAME.GLOBAL_RELATIVE_ALT, (byte)2);
GCSViews.FlightData.GuidedModeWP = new PointLatLngAlt(gotohere);

View File

@ -11,16 +11,16 @@ namespace ArdupilotMega
{
public partial class ParamCompare : Form
{
GCSViews.Configuration config;
DataGridView dgv;
Hashtable param = new Hashtable();
Hashtable param2 = new Hashtable();
public ParamCompare(GCSViews.Configuration config, Hashtable param, Hashtable param2)
public ParamCompare(DataGridView dgv, Hashtable param, Hashtable param2)
{
InitializeComponent();
this.param = param;
this.param2 = param2;
this.config = config;
this.dgv = dgv;
processToScreen();
}
@ -61,7 +61,14 @@ namespace ArdupilotMega
{
if ((bool)row.Cells[Use.Index].Value == true)
{
config.EEPROM_View_float_TextChanged(new Control() { Name = row.Cells[Command.Index].Value.ToString(), Text = row.Cells[newvalue.Index].Value.ToString() }, null);
foreach (DataGridViewRow dgvr in dgv.Rows)
{
if (dgvr.Cells[0].Value.ToString() == row.Cells[Command.Index].Value.ToString())
{
dgvr.Cells[1].Value = row.Cells[newvalue.Index].Value.ToString();
break;
}
}
}
}
this.Close();