From 9aff265e77fe4e6370de913561f640733105c592 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Tue, 8 Nov 2011 21:22:07 +0800 Subject: [PATCH] APM Planner 1.0.90 Camera screen error fix mavlink 1.0 now compile time option Configuration screen modify dataflashlog update --- .../ArdupilotMegaPlanner/ArdupilotMega.csproj | 7 +- Tools/ArdupilotMegaPlanner/ArdupilotMega.sln | 3 - Tools/ArdupilotMegaPlanner/AviWriter.cs | 37 +- Tools/ArdupilotMegaPlanner/Camera.cs | 75 +- Tools/ArdupilotMegaPlanner/Common.cs | 111 +- Tools/ArdupilotMegaPlanner/CurrentState.cs | 180 +- .../GCSViews/Configuration.Designer.cs | 340 ++-- .../GCSViews/Configuration.cs | 79 +- .../GCSViews/FlightData.cs | 58 +- .../GCSViews/FlightPlanner.cs | 21 +- .../GCSViews/Simulation.cs | 158 +- Tools/ArdupilotMegaPlanner/HIL/QuadCopter.cs | 70 +- Tools/ArdupilotMegaPlanner/Joystick.cs | 14 +- Tools/ArdupilotMegaPlanner/JoystickSetup.cs | 6 +- Tools/ArdupilotMegaPlanner/MAVLink.cs | 490 +++++- Tools/ArdupilotMegaPlanner/MAVLinkTypes.cs | 1556 ++++++++--------- Tools/ArdupilotMegaPlanner/MAVLinkTypes0.9.cs | 1494 ++++++++++++++++ Tools/ArdupilotMegaPlanner/MainV2.cs | 97 +- Tools/ArdupilotMegaPlanner/Program.cs | 7 + .../Properties/AssemblyInfo.cs | 2 +- Tools/ArdupilotMegaPlanner/Setup/Setup.cs | 31 +- .../Release/ArdupilotMegaPlanner.application | 2 +- .../bin/Release/dataflashlog.xml | 30 +- Tools/ArdupilotMegaPlanner/dataflashlog.xml | 30 +- Tools/ArdupilotMegaPlanner/mavlinklist.pl | 13 +- 25 files changed, 3628 insertions(+), 1283 deletions(-) create mode 100644 Tools/ArdupilotMegaPlanner/MAVLinkTypes0.9.cs diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj index c685556074..61a1b27bfa 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.csproj @@ -42,7 +42,7 @@ full false bin\Debug\ - TRACE;DEBUG + TRACE;DEBUG;MAVLINK10cra prompt 4 false @@ -57,7 +57,7 @@ full true bin\Release\ - TRACE + TRACE;MAVLINK10cra prompt 4 false @@ -227,6 +227,7 @@ JoystickSetup.cs + Component @@ -302,7 +303,7 @@ Component - + Form diff --git a/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln b/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln index 613ea3ce9b..2116e2378f 100644 --- a/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln +++ b/Tools/ArdupilotMegaPlanner/ArdupilotMega.sln @@ -2,9 +2,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual C# Express 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArdupilotMega", "ArdupilotMega.csproj", "{A2E22272-95FE-47B6-B050-9AE7E2055BF5}" - ProjectSection(ProjectDependencies) = postProject - {E64A1A41-A5B0-458E-8284-BB63705354DA} = {E64A1A41-A5B0-458E-8284-BB63705354DA} - EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{E64A1A41-A5B0-458E-8284-BB63705354DA}" EndProject diff --git a/Tools/ArdupilotMegaPlanner/AviWriter.cs b/Tools/ArdupilotMegaPlanner/AviWriter.cs index e1e87f765f..19f1d019c4 100644 --- a/Tools/ArdupilotMegaPlanner/AviWriter.cs +++ b/Tools/ArdupilotMegaPlanner/AviWriter.cs @@ -195,7 +195,7 @@ SizeConst = 4)] { Console.WriteLine(DateTime.Now.Millisecond + "avi frame"); db_head db = new db_head { db = "00dc".ToCharArray(), size = size }; - fd.Write(ArdupilotMega.MAVLink.StructureToByteArray(db), 0, Marshal.SizeOf(db)); + fd.Write(StructureToByteArray(db), 0, Marshal.SizeOf(db)); fd.Write(buf, 0, (int)size); if (size % 2 == 1) { @@ -276,16 +276,35 @@ SizeConst = 4)] long pos = fd.Position; fd.Seek(0, SeekOrigin.Begin); - fd.Write(ArdupilotMega.MAVLink.StructureToByteArray(rh),0, Marshal.SizeOf(rh)); - fd.Write(ArdupilotMega.MAVLink.StructureToByteArray(lh1), 0, Marshal.SizeOf(lh1)); - fd.Write(ArdupilotMega.MAVLink.StructureToByteArray(ah), 0, Marshal.SizeOf(ah)); - fd.Write(ArdupilotMega.MAVLink.StructureToByteArray(lh2), 0, Marshal.SizeOf(lh2)); - fd.Write(ArdupilotMega.MAVLink.StructureToByteArray(sh), 0, Marshal.SizeOf(sh)); - fd.Write(ArdupilotMega.MAVLink.StructureToByteArray(fh), 0, Marshal.SizeOf(fh)); - fd.Write(ArdupilotMega.MAVLink.StructureToByteArray(junk), 0, Marshal.SizeOf(junk)); + fd.Write(StructureToByteArray(rh),0, Marshal.SizeOf(rh)); + fd.Write(StructureToByteArray(lh1), 0, Marshal.SizeOf(lh1)); + fd.Write(StructureToByteArray(ah), 0, Marshal.SizeOf(ah)); + fd.Write(StructureToByteArray(lh2), 0, Marshal.SizeOf(lh2)); + fd.Write(StructureToByteArray(sh), 0, Marshal.SizeOf(sh)); + fd.Write(StructureToByteArray(fh), 0, Marshal.SizeOf(fh)); + fd.Write(StructureToByteArray(junk), 0, Marshal.SizeOf(junk)); fd.Seek(2036, SeekOrigin.Begin); - fd.Write(ArdupilotMega.MAVLink.StructureToByteArray(lh3), 0, Marshal.SizeOf(lh3)); + fd.Write(StructureToByteArray(lh3), 0, Marshal.SizeOf(lh3)); fd.Seek(pos, SeekOrigin.Begin); } + + byte[] StructureToByteArray(object obj) + { + + int len = Marshal.SizeOf(obj); + + byte[] arr = new byte[len]; + + IntPtr ptr = Marshal.AllocHGlobal(len); + + Marshal.StructureToPtr(obj, ptr, true); + + Marshal.Copy(ptr, arr, 0, len); + + Marshal.FreeHGlobal(ptr); + + return arr; + + } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Camera.cs b/Tools/ArdupilotMegaPlanner/Camera.cs index 09fe39f5df..12d9795a6d 100644 --- a/Tools/ArdupilotMegaPlanner/Camera.cs +++ b/Tools/ArdupilotMegaPlanner/Camera.cs @@ -36,43 +36,48 @@ namespace ArdupilotMega void doCalc() { - // entered values - float focallen = (float)num_focallength.Value; - float flyalt = (float)num_agl.Value; - int imagewidth = int.Parse(TXT_imgwidth.Text); - int imageheight = int.Parse(TXT_imgheight.Text); - - float sensorwidth = float.Parse(TXT_senswidth.Text); - float sensorheight = float.Parse(TXT_sensheight.Text); - - int overlap = (int)num_overlap.Value; - int sidelap = (int)num_sidelap.Value; - - - // scale - float flscale = 1000 * flyalt / focallen; - - float viewwidth = (sensorwidth * flscale / 1000); - float viewheight = (sensorheight * flscale / 1000); - - TXT_fovH.Text = (viewwidth).ToString(); - TXT_fovV.Text = (viewheight).ToString(); - - TXT_fovAH.Text = (Math.Atan(sensorwidth / (2 * focallen)) * rad2deg * 2).ToString(); - TXT_fovAV.Text = (Math.Atan(sensorheight / (2 * focallen)) * rad2deg * 2).ToString(); - - TXT_cmpixel.Text = ((viewheight / imageheight) * 100).ToString("0.00 cm"); - - if (CHK_camdirection.Checked) + try { - TXT_distflphotos.Text = ((1 - (overlap / 100.0f)) * viewheight).ToString(); - TXT_distacflphotos.Text = ((1 - (sidelap / 100.0f)) * viewwidth).ToString(); - } - else - { - TXT_distflphotos.Text = ((1 - (overlap / 100.0f)) * viewwidth).ToString(); - TXT_distacflphotos.Text = ((1 - (sidelap / 100.0f)) * viewheight).ToString(); + // entered values + float focallen = (float)num_focallength.Value; + float flyalt = (float)num_agl.Value; + int imagewidth = int.Parse(TXT_imgwidth.Text); + int imageheight = int.Parse(TXT_imgheight.Text); + + float sensorwidth = float.Parse(TXT_senswidth.Text); + float sensorheight = float.Parse(TXT_sensheight.Text); + + int overlap = (int)num_overlap.Value; + int sidelap = (int)num_sidelap.Value; + + + // scale + float flscale = 1000 * flyalt / focallen; + + float viewwidth = (sensorwidth * flscale / 1000); + float viewheight = (sensorheight * flscale / 1000); + + TXT_fovH.Text = (viewwidth).ToString(); + TXT_fovV.Text = (viewheight).ToString(); + + TXT_fovAH.Text = (Math.Atan(sensorwidth / (2 * focallen)) * rad2deg * 2).ToString(); + TXT_fovAV.Text = (Math.Atan(sensorheight / (2 * focallen)) * rad2deg * 2).ToString(); + + TXT_cmpixel.Text = ((viewheight / imageheight) * 100).ToString("0.00 cm"); + + if (CHK_camdirection.Checked) + { + TXT_distflphotos.Text = ((1 - (overlap / 100.0f)) * viewheight).ToString(); + TXT_distacflphotos.Text = ((1 - (sidelap / 100.0f)) * viewwidth).ToString(); + } + else + { + TXT_distflphotos.Text = ((1 - (overlap / 100.0f)) * viewwidth).ToString(); + TXT_distacflphotos.Text = ((1 - (sidelap / 100.0f)) * viewheight).ToString(); + } + } + catch { return; } } private void num_agl_ValueChanged(object sender, EventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/Common.cs b/Tools/ArdupilotMegaPlanner/Common.cs index 7658c48942..a2343f26b6 100644 --- a/Tools/ArdupilotMegaPlanner/Common.cs +++ b/Tools/ArdupilotMegaPlanner/Common.cs @@ -248,7 +248,63 @@ namespace ArdupilotMega CIRCLE = 7, POSITION = 8 } + + #if MAVLINK10 + + public static bool translateMode(string modein, ref MAVLink.__mavlink_set_mode_t mode) + { + //MAVLink.__mavlink_set_mode_t mode = new MAVLink.__mavlink_set_mode_t(); + mode.target_system = MainV2.comPort.sysid; + try + { + if (Common.getModes() == typeof(Common.apmmodes)) + { + switch ((int)Enum.Parse(Common.getModes(), modein)) + { + case (int)Common.apmmodes.MANUAL: + case (int)Common.apmmodes.CIRCLE: + case (int)Common.apmmodes.STABILIZE: + case (int)Common.apmmodes.AUTO: + case (int)Common.apmmodes.RTL: + 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.custom_mode = (uint)(int)Enum.Parse(Common.getModes(), modein); + break; + default: + MessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein)); + return false; + } + } + else if (Common.getModes() == typeof(Common.ac2modes)) + { + switch ((int)Enum.Parse(Common.getModes(), modein)) + { + case (int)Common.ac2modes.STABILIZE: + case (int)Common.ac2modes.AUTO: + case (int)Common.ac2modes.RTL: + case (int)Common.ac2modes.LOITER: + case (int)Common.ac2modes.ACRO: + 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.custom_mode = (uint)(int)Enum.Parse(Common.getModes(), modein); + break; + default: + MessageBox.Show("No Mode Changed " + (int)Enum.Parse(Common.getModes(), modein)); + return false; + } + } + } + catch { System.Windows.Forms.MessageBox.Show("Failed to find Mode"); return false; } + + return true; + } + + #else public static bool translateMode(string modein, ref MAVLink.__mavlink_set_nav_mode_t navmode, ref MAVLink.__mavlink_set_mode_t mode) { @@ -333,8 +389,9 @@ namespace ArdupilotMega catch { System.Windows.Forms.MessageBox.Show("Failed to find Mode"); return false; } return true; - } - + } + #endif + public static bool getFilefromNet(string url,string saveto) { try { @@ -592,6 +649,8 @@ namespace ArdupilotMega int _value = 0; System.Windows.Forms.Label lbl1 = new System.Windows.Forms.Label(); System.Windows.Forms.Label lbl = new System.Windows.Forms.Label(); + public bool reverse = false; + int displayvalue = 0; public HorizontalProgressBar2() : base() @@ -606,7 +665,15 @@ namespace ArdupilotMega if (_value == value) return; _value = value; - int ans = value + offset; + displayvalue = _value; + + if (reverse) + { + int dif = _value - Minimum; + _value = Maximum - dif; + } + + int ans = _value + offset; if (ans <= base.Minimum) { ans = base.Minimum + 1; // prevent an exception for the -1 hack @@ -675,7 +742,7 @@ System.ComponentModel.Description("Text under Bar")] lbl1.Location = new Point(this.Location.X, this.Location.Y + this.Height + 15); lbl1.ClientSize = new Size(this.Width, 13); lbl1.TextAlign = ContentAlignment.MiddleCenter; - lbl1.Text = Value.ToString(); + lbl1.Text = displayvalue.ToString(); if (minline != 0 && maxline != 0) { @@ -688,15 +755,35 @@ System.ComponentModel.Description("Text under Bar")] if ((Type)this.GetType() == typeof(VerticalProgressBar2)) { e.ResetTransform(); range2 = this.Height; - e.DrawLine(redPen, 0, (this.Maximum - minline) / range * range2 + 0, this.Width, (this.Maximum - minline) / range * range2 + 0); - e.DrawLine(redPen, 0, (this.Maximum - maxline) / range * range2 + 6, this.Width, (this.Maximum - maxline) / range * range2 + 6); - e.DrawString(minline.ToString(), SystemFonts.DefaultFont, mybrush, 5, (this.Maximum - minline) / range * range2 + 2); - e.DrawString(maxline.ToString(), SystemFonts.DefaultFont, Brushes.White, 5, (this.Maximum - maxline) / range * range2 - 10); + if (reverse) + { + e.DrawLine(redPen, 0, (maxline - this.Minimum) / range * range2 + 0, this.Width, (maxline - this.Minimum) / range * range2 + 0); + e.DrawLine(redPen, 0, (minline - this.Minimum) / range * range2 + 6, this.Width, (minline - this.Minimum) / range * range2 + 6); + e.DrawString(maxline.ToString(), SystemFonts.DefaultFont, mybrush, 5, (maxline - this.Minimum) / range * range2 + 2); + e.DrawString(minline.ToString(), SystemFonts.DefaultFont, Brushes.White, 5, (minline - this.Minimum) / range * range2 - 10); + } + else + { + e.DrawLine(redPen, 0, (this.Maximum - minline) / range * range2 + 0, this.Width, (this.Maximum - minline) / range * range2 + 0); + e.DrawLine(redPen, 0, (this.Maximum - maxline) / range * range2 + 6, this.Width, (this.Maximum - maxline) / range * range2 + 6); + e.DrawString(minline.ToString(), SystemFonts.DefaultFont, mybrush, 5, (this.Maximum - minline) / range * range2 + 2); + e.DrawString(maxline.ToString(), SystemFonts.DefaultFont, Brushes.White, 5, (this.Maximum - maxline) / range * range2 - 10); + } } else { - e.DrawLine(redPen, (minline - this.Minimum) / range * range2 - 0, 0, (minline - this.Minimum) / range * range2 - 0, this.Height); - e.DrawLine(redPen, (maxline - this.Minimum) / range * range2 - 0, 0, (maxline - this.Minimum) / range * range2 - 0, this.Height); - e.DrawString(minline.ToString(), SystemFonts.DefaultFont, mybrush, (minline - this.Minimum) / range * range2 - 30, 5); - e.DrawString(maxline.ToString(), SystemFonts.DefaultFont, Brushes.White, (maxline - this.Minimum) / range * range2 - 0, 5); + if (reverse) + { + e.DrawLine(redPen, (this.Maximum - minline) / range * range2 - 0, 0, (this.Maximum - minline) / range * range2 - 0, this.Height); + e.DrawLine(redPen, (this.Maximum - maxline) / range * range2 - 0, 0, (this.Maximum - maxline) / range * range2 - 0, this.Height); + e.DrawString(minline.ToString(), SystemFonts.DefaultFont, mybrush, (this.Maximum - minline) / range * range2 - 30, 5); + e.DrawString(maxline.ToString(), SystemFonts.DefaultFont, Brushes.White, (this.Maximum - maxline) / range * range2 - 0, 5); + } + else + { + e.DrawLine(redPen, (minline - this.Minimum) / range * range2 - 0, 0, (minline - this.Minimum) / range * range2 - 0, this.Height); + e.DrawLine(redPen, (maxline - this.Minimum) / range * range2 - 0, 0, (maxline - this.Minimum) / range * range2 - 0, this.Height); + e.DrawString(minline.ToString(), SystemFonts.DefaultFont, mybrush, (minline - this.Minimum) / range * range2 - 30, 5); + e.DrawString(maxline.ToString(), SystemFonts.DefaultFont, Brushes.White, (maxline - this.Minimum) / range * range2 - 0, 5); + } } } } diff --git a/Tools/ArdupilotMegaPlanner/CurrentState.cs b/Tools/ArdupilotMegaPlanner/CurrentState.cs index 51b56ed928..cd1cab5c53 100644 --- a/Tools/ArdupilotMegaPlanner/CurrentState.cs +++ b/Tools/ArdupilotMegaPlanner/CurrentState.cs @@ -272,6 +272,119 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT] = null; } +#if MAVLINK10 + if (mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_HEARTBEAT] != null) + { + ArdupilotMega.MAVLink.__mavlink_heartbeat_t hb = new ArdupilotMega.MAVLink.__mavlink_heartbeat_t(); + + object temp = hb; + + MAVLink.ByteArrayToStructure(mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_HEARTBEAT], ref temp, 6); + + hb = (ArdupilotMega.MAVLink.__mavlink_heartbeat_t)(temp); + + string oldmode = mode; + + mode = "Unknown"; + + if ((hb.base_mode & (byte)MAVLink.MAV_MODE_FLAG.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED) != 0) + { + if (hb.type == (byte)MAVLink.MAV_TYPE.MAV_TYPE_FIXED_WING) + { + switch (hb.custom_mode) + { + case (byte)(Common.apmmodes.MANUAL): + mode = "Manual"; + break; + case (byte)(Common.apmmodes.GUIDED): + mode = "Guided"; + break; + case (byte)(Common.apmmodes.STABILIZE): + mode = "Stabilize"; + break; + case (byte)(Common.apmmodes.FLY_BY_WIRE_A): + mode = "FBW A"; + break; + case (byte)(Common.apmmodes.FLY_BY_WIRE_B): + mode = "FBW B"; + break; + case (byte)(Common.apmmodes.AUTO): + mode = "Auto"; + break; + case (byte)(Common.apmmodes.RTL): + mode = "RTL"; + break; + case (byte)(Common.apmmodes.LOITER): + mode = "Loiter"; + break; + case (byte)(Common.apmmodes.CIRCLE): + mode = "Circle"; + break; + default: + mode = "Unknown"; + break; + } + } + else if (hb.type == (byte)MAVLink.MAV_TYPE.MAV_TYPE_QUADROTOR) + { + switch (hb.custom_mode) + { + case (byte)(Common.ac2modes.STABILIZE): + mode = "Stabilize"; + break; + case (byte)(Common.ac2modes.ACRO): + mode = "Acro"; + break; + case (byte)(Common.ac2modes.ALT_HOLD): + mode = "Alt Hold"; + break; + case (byte)(Common.ac2modes.AUTO): + mode = "Auto"; + break; + case (byte)(Common.ac2modes.GUIDED): + mode = "Guided"; + break; + case (byte)(Common.ac2modes.LOITER): + mode = "Loiter"; + break; + case (byte)(Common.ac2modes.RTL): + mode = "RTL"; + break; + case (byte)(Common.ac2modes.CIRCLE): + mode = "Circle"; + break; + default: + mode = "Unknown"; + break; + } + } + } + + if (oldmode != mode && MainV2.speechenable && MainV2.getConfig("speechmodeenabled") == "True") + { + MainV2.talk.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechmode"))); + } + } + + + if (mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS] != null) + { + ArdupilotMega.MAVLink.__mavlink_sys_status_t sysstatus = new ArdupilotMega.MAVLink.__mavlink_sys_status_t(); + + object temp = sysstatus; + + MAVLink.ByteArrayToStructure(mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS], ref temp, 6); + + sysstatus = (ArdupilotMega.MAVLink.__mavlink_sys_status_t)(temp); + + battery_voltage = sysstatus.voltage_battery; + battery_remaining = sysstatus.battery_remaining; + + packetdropremote = sysstatus.drop_rate_comm; + + //MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS] = null; + } + #else if (mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS] != null) { @@ -384,8 +497,8 @@ namespace ArdupilotMega } //MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS] = null; - } - + } +#endif if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_ATTITUDE] != null) { var att = new ArdupilotMega.MAVLink.__mavlink_attitude_t(); @@ -404,6 +517,32 @@ namespace ArdupilotMega //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_ATTITUDE] = null; } +#if MAVLINK10 + if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW_INT] != null) + { + var gps = new MAVLink.__mavlink_gps_raw_int_t(); + + object temp = gps; + + MAVLink.ByteArrayToStructure(mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW_INT], ref temp, 6); + + gps = (MAVLink.__mavlink_gps_raw_int_t)(temp); + + lat = gps.lat * 1.0e-7f; + lng = gps.lon * 1.0e-7f; + // alt = gps.alt; // using vfr as includes baro calc + + gpsstatus = gps.fix_type; + // Console.WriteLine("gpsfix {0}",gpsstatus); + + gpshdop = gps.eph; + + groundspeed = gps.vel * 1.0e-2f; + groundcourse = gps.cog * 1.0e-2f; + + //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW] = null; + } + #else if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW] != null) { @@ -428,8 +567,8 @@ namespace ArdupilotMega groundcourse = gps.hdg; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW] = null; - } - + } +#endif if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GPS_STATUS] != null) { var gps = new MAVLink.__mavlink_gps_status_t(); @@ -442,7 +581,6 @@ namespace ArdupilotMega satcount = gps.satellites_visible; } - if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GLOBAL_POSITION_INT] != null) { var loc = new MAVLink.__mavlink_global_position_int_t(); @@ -453,12 +591,35 @@ namespace ArdupilotMega loc = (MAVLink.__mavlink_global_position_int_t)(temp); - alt = loc.alt / 1000.0f; + //alt = loc.alt / 1000.0f; lat = loc.lat / 10000000.0f; lng = loc.lon / 10000000.0f; } - if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GLOBAL_POSITION] != null) +#if MAVLINK10 + if (mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_MISSION_CURRENT] != null) + { + ArdupilotMega.MAVLink.__mavlink_mission_current_t wpcur = new ArdupilotMega.MAVLink.__mavlink_mission_current_t(); + + object temp = wpcur; + + MAVLink.ByteArrayToStructure(mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_MISSION_CURRENT], ref temp, 6); + + wpcur = (ArdupilotMega.MAVLink.__mavlink_mission_current_t)(temp); + + int oldwp = (int)wpno; + + wpno = wpcur.seq; + + if (oldwp != wpno && MainV2.speechenable && MainV2.getConfig("speechwaypointenabled") == "True") + { + MainV2.talk.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechwaypoint"))); + } + + //MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_WAYPOINT_CURRENT] = null; + } + #else + if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GLOBAL_POSITION] != null) { var loc = new MAVLink.__mavlink_global_position_t(); @@ -493,8 +654,9 @@ namespace ArdupilotMega } //MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_WAYPOINT_CURRENT] = null; - } - + } + +#endif if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_RAW] != null) { var rcin = new MAVLink.__mavlink_rc_channels_raw_t(); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs index 9682236b3a..890821ed41 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.Designer.cs @@ -41,187 +41,187 @@ this.ConfigTabs = new System.Windows.Forms.TabControl(); this.TabAPM2 = new System.Windows.Forms.TabPage(); this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.THR_FS_VALUE = new System.Windows.Forms.DomainUpDown(); + this.THR_FS_VALUE = new System.Windows.Forms.NumericUpDown(); this.label5 = new System.Windows.Forms.Label(); - this.THR_MAX = new System.Windows.Forms.DomainUpDown(); + this.THR_MAX = new System.Windows.Forms.NumericUpDown(); this.label6 = new System.Windows.Forms.Label(); - this.THR_MIN = new System.Windows.Forms.DomainUpDown(); + this.THR_MIN = new System.Windows.Forms.NumericUpDown(); this.label7 = new System.Windows.Forms.Label(); - this.TRIM_THROTTLE = new System.Windows.Forms.DomainUpDown(); + this.TRIM_THROTTLE = new System.Windows.Forms.NumericUpDown(); this.label8 = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.ARSPD_RATIO = new System.Windows.Forms.DomainUpDown(); + this.ARSPD_RATIO = new System.Windows.Forms.NumericUpDown(); this.label1 = new System.Windows.Forms.Label(); - this.ARSPD_FBW_MAX = new System.Windows.Forms.DomainUpDown(); + this.ARSPD_FBW_MAX = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); - this.ARSPD_FBW_MIN = new System.Windows.Forms.DomainUpDown(); + this.ARSPD_FBW_MIN = new System.Windows.Forms.NumericUpDown(); this.label3 = new System.Windows.Forms.Label(); - this.TRIM_ARSPD_CM = new System.Windows.Forms.DomainUpDown(); + this.TRIM_ARSPD_CM = new System.Windows.Forms.NumericUpDown(); this.label4 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.LIM_PITCH_MIN = new System.Windows.Forms.DomainUpDown(); + this.LIM_PITCH_MIN = new System.Windows.Forms.NumericUpDown(); this.label39 = new System.Windows.Forms.Label(); - this.LIM_PITCH_MAX = new System.Windows.Forms.DomainUpDown(); + this.LIM_PITCH_MAX = new System.Windows.Forms.NumericUpDown(); this.label38 = new System.Windows.Forms.Label(); - this.LIM_ROLL_CD = new System.Windows.Forms.DomainUpDown(); + this.LIM_ROLL_CD = new System.Windows.Forms.NumericUpDown(); this.label37 = new System.Windows.Forms.Label(); this.groupBox15 = new System.Windows.Forms.GroupBox(); - this.XTRK_ANGLE_CD = new System.Windows.Forms.DomainUpDown(); + this.XTRK_ANGLE_CD = new System.Windows.Forms.NumericUpDown(); this.label79 = new System.Windows.Forms.Label(); - this.XTRK_GAIN_SC = new System.Windows.Forms.DomainUpDown(); + this.XTRK_GAIN_SC = new System.Windows.Forms.NumericUpDown(); this.label80 = new System.Windows.Forms.Label(); this.groupBox16 = new System.Windows.Forms.GroupBox(); - this.KFF_PTCH2THR = new System.Windows.Forms.DomainUpDown(); + this.KFF_PTCH2THR = new System.Windows.Forms.NumericUpDown(); this.label83 = new System.Windows.Forms.Label(); - this.KFF_RDDRMIX = new System.Windows.Forms.DomainUpDown(); + this.KFF_RDDRMIX = new System.Windows.Forms.NumericUpDown(); this.label78 = new System.Windows.Forms.Label(); - this.KFF_PTCHCOMP = new System.Windows.Forms.DomainUpDown(); + this.KFF_PTCHCOMP = new System.Windows.Forms.NumericUpDown(); this.label81 = new System.Windows.Forms.Label(); this.groupBox14 = new System.Windows.Forms.GroupBox(); - this.ENRGY2THR_IMAX = new System.Windows.Forms.DomainUpDown(); + this.ENRGY2THR_IMAX = new System.Windows.Forms.NumericUpDown(); this.label73 = new System.Windows.Forms.Label(); - this.ENRGY2THR_D = new System.Windows.Forms.DomainUpDown(); + this.ENRGY2THR_D = new System.Windows.Forms.NumericUpDown(); this.label74 = new System.Windows.Forms.Label(); - this.ENRGY2THR_I = new System.Windows.Forms.DomainUpDown(); + this.ENRGY2THR_I = new System.Windows.Forms.NumericUpDown(); this.label75 = new System.Windows.Forms.Label(); - this.ENRGY2THR_P = new System.Windows.Forms.DomainUpDown(); + this.ENRGY2THR_P = new System.Windows.Forms.NumericUpDown(); this.label76 = new System.Windows.Forms.Label(); this.groupBox13 = new System.Windows.Forms.GroupBox(); - this.ALT2PTCH_IMAX = new System.Windows.Forms.DomainUpDown(); + this.ALT2PTCH_IMAX = new System.Windows.Forms.NumericUpDown(); this.label69 = new System.Windows.Forms.Label(); - this.ALT2PTCH_D = new System.Windows.Forms.DomainUpDown(); + this.ALT2PTCH_D = new System.Windows.Forms.NumericUpDown(); this.label70 = new System.Windows.Forms.Label(); - this.ALT2PTCH_I = new System.Windows.Forms.DomainUpDown(); + this.ALT2PTCH_I = new System.Windows.Forms.NumericUpDown(); this.label71 = new System.Windows.Forms.Label(); - this.ALT2PTCH_P = new System.Windows.Forms.DomainUpDown(); + this.ALT2PTCH_P = new System.Windows.Forms.NumericUpDown(); this.label72 = new System.Windows.Forms.Label(); this.groupBox12 = new System.Windows.Forms.GroupBox(); - this.ARSP2PTCH_IMAX = new System.Windows.Forms.DomainUpDown(); + this.ARSP2PTCH_IMAX = new System.Windows.Forms.NumericUpDown(); this.label65 = new System.Windows.Forms.Label(); - this.ARSP2PTCH_D = new System.Windows.Forms.DomainUpDown(); + this.ARSP2PTCH_D = new System.Windows.Forms.NumericUpDown(); this.label66 = new System.Windows.Forms.Label(); - this.ARSP2PTCH_I = new System.Windows.Forms.DomainUpDown(); + this.ARSP2PTCH_I = new System.Windows.Forms.NumericUpDown(); this.label67 = new System.Windows.Forms.Label(); - this.ARSP2PTCH_P = new System.Windows.Forms.DomainUpDown(); + this.ARSP2PTCH_P = new System.Windows.Forms.NumericUpDown(); this.label68 = new System.Windows.Forms.Label(); this.groupBox11 = new System.Windows.Forms.GroupBox(); - this.HDNG2RLL_IMAX = new System.Windows.Forms.DomainUpDown(); + this.HDNG2RLL_IMAX = new System.Windows.Forms.NumericUpDown(); this.label61 = new System.Windows.Forms.Label(); - this.HDNG2RLL_D = new System.Windows.Forms.DomainUpDown(); + this.HDNG2RLL_D = new System.Windows.Forms.NumericUpDown(); this.label62 = new System.Windows.Forms.Label(); - this.HDNG2RLL_I = new System.Windows.Forms.DomainUpDown(); + this.HDNG2RLL_I = new System.Windows.Forms.NumericUpDown(); this.label63 = new System.Windows.Forms.Label(); - this.HDNG2RLL_P = new System.Windows.Forms.DomainUpDown(); + this.HDNG2RLL_P = new System.Windows.Forms.NumericUpDown(); this.label64 = new System.Windows.Forms.Label(); this.groupBox10 = new System.Windows.Forms.GroupBox(); - this.YW2SRV_IMAX = new System.Windows.Forms.DomainUpDown(); + this.YW2SRV_IMAX = new System.Windows.Forms.NumericUpDown(); this.label57 = new System.Windows.Forms.Label(); - this.YW2SRV_D = new System.Windows.Forms.DomainUpDown(); + this.YW2SRV_D = new System.Windows.Forms.NumericUpDown(); this.label58 = new System.Windows.Forms.Label(); - this.YW2SRV_I = new System.Windows.Forms.DomainUpDown(); + this.YW2SRV_I = new System.Windows.Forms.NumericUpDown(); this.label59 = new System.Windows.Forms.Label(); - this.YW2SRV_P = new System.Windows.Forms.DomainUpDown(); + this.YW2SRV_P = new System.Windows.Forms.NumericUpDown(); this.label60 = new System.Windows.Forms.Label(); this.groupBox9 = new System.Windows.Forms.GroupBox(); - this.PTCH2SRV_IMAX = new System.Windows.Forms.DomainUpDown(); + this.PTCH2SRV_IMAX = new System.Windows.Forms.NumericUpDown(); this.label53 = new System.Windows.Forms.Label(); - this.PTCH2SRV_D = new System.Windows.Forms.DomainUpDown(); + this.PTCH2SRV_D = new System.Windows.Forms.NumericUpDown(); this.label54 = new System.Windows.Forms.Label(); - this.PTCH2SRV_I = new System.Windows.Forms.DomainUpDown(); + this.PTCH2SRV_I = new System.Windows.Forms.NumericUpDown(); this.label55 = new System.Windows.Forms.Label(); - this.PTCH2SRV_P = new System.Windows.Forms.DomainUpDown(); + this.PTCH2SRV_P = new System.Windows.Forms.NumericUpDown(); this.label56 = new System.Windows.Forms.Label(); this.groupBox8 = new System.Windows.Forms.GroupBox(); - this.RLL2SRV_IMAX = new System.Windows.Forms.DomainUpDown(); + this.RLL2SRV_IMAX = new System.Windows.Forms.NumericUpDown(); this.label49 = new System.Windows.Forms.Label(); - this.RLL2SRV_D = new System.Windows.Forms.DomainUpDown(); + this.RLL2SRV_D = new System.Windows.Forms.NumericUpDown(); this.label50 = new System.Windows.Forms.Label(); - this.RLL2SRV_I = new System.Windows.Forms.DomainUpDown(); + this.RLL2SRV_I = new System.Windows.Forms.NumericUpDown(); this.label51 = new System.Windows.Forms.Label(); - this.RLL2SRV_P = new System.Windows.Forms.DomainUpDown(); + this.RLL2SRV_P = new System.Windows.Forms.NumericUpDown(); this.label52 = new System.Windows.Forms.Label(); this.TabAC2 = new System.Windows.Forms.TabPage(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.label14 = new System.Windows.Forms.Label(); - this.THR_RATE_IMAX = new System.Windows.Forms.DomainUpDown(); - this.THR_RATE_I = new System.Windows.Forms.DomainUpDown(); + this.THR_RATE_IMAX = new System.Windows.Forms.NumericUpDown(); + this.THR_RATE_I = new System.Windows.Forms.NumericUpDown(); this.label20 = new System.Windows.Forms.Label(); - this.THR_RATE_P = new System.Windows.Forms.DomainUpDown(); + this.THR_RATE_P = new System.Windows.Forms.NumericUpDown(); this.label25 = new System.Windows.Forms.Label(); this.CHK_lockrollpitch = new System.Windows.Forms.CheckBox(); this.groupBox4 = new System.Windows.Forms.GroupBox(); - this.WP_SPEED_MAX = new System.Windows.Forms.DomainUpDown(); + this.WP_SPEED_MAX = new System.Windows.Forms.NumericUpDown(); this.label9 = new System.Windows.Forms.Label(); - this.NAV_LAT_IMAX = new System.Windows.Forms.DomainUpDown(); + this.NAV_LAT_IMAX = new System.Windows.Forms.NumericUpDown(); this.label13 = new System.Windows.Forms.Label(); - this.NAV_LAT_I = new System.Windows.Forms.DomainUpDown(); + this.NAV_LAT_I = new System.Windows.Forms.NumericUpDown(); this.label15 = new System.Windows.Forms.Label(); - this.NAV_LAT_P = new System.Windows.Forms.DomainUpDown(); + this.NAV_LAT_P = new System.Windows.Forms.NumericUpDown(); this.label16 = new System.Windows.Forms.Label(); this.groupBox6 = new System.Windows.Forms.GroupBox(); - this.XTRK_ANGLE_CD1 = new System.Windows.Forms.DomainUpDown(); + this.XTRK_ANGLE_CD1 = new System.Windows.Forms.NumericUpDown(); this.label10 = new System.Windows.Forms.Label(); - this.XTRACK_IMAX = new System.Windows.Forms.DomainUpDown(); + this.XTRACK_IMAX = new System.Windows.Forms.NumericUpDown(); this.label11 = new System.Windows.Forms.Label(); - this.XTRACK_I = new System.Windows.Forms.DomainUpDown(); + this.XTRACK_I = new System.Windows.Forms.NumericUpDown(); this.label17 = new System.Windows.Forms.Label(); - this.XTRACK_P = new System.Windows.Forms.DomainUpDown(); + this.XTRACK_P = new System.Windows.Forms.NumericUpDown(); this.label18 = new System.Windows.Forms.Label(); this.groupBox7 = new System.Windows.Forms.GroupBox(); - this.THR_ALT_IMAX = new System.Windows.Forms.DomainUpDown(); + this.THR_ALT_IMAX = new System.Windows.Forms.NumericUpDown(); this.label19 = new System.Windows.Forms.Label(); - this.THR_ALT_I = new System.Windows.Forms.DomainUpDown(); + this.THR_ALT_I = new System.Windows.Forms.NumericUpDown(); this.label21 = new System.Windows.Forms.Label(); - this.THR_ALT_P = new System.Windows.Forms.DomainUpDown(); + this.THR_ALT_P = new System.Windows.Forms.NumericUpDown(); this.label22 = new System.Windows.Forms.Label(); this.groupBox19 = new System.Windows.Forms.GroupBox(); - this.HLD_LAT_IMAX = new System.Windows.Forms.DomainUpDown(); + this.HLD_LAT_IMAX = new System.Windows.Forms.NumericUpDown(); this.label28 = new System.Windows.Forms.Label(); - this.HLD_LAT_I = new System.Windows.Forms.DomainUpDown(); + this.HLD_LAT_I = new System.Windows.Forms.NumericUpDown(); this.label30 = new System.Windows.Forms.Label(); - this.HLD_LAT_P = new System.Windows.Forms.DomainUpDown(); + this.HLD_LAT_P = new System.Windows.Forms.NumericUpDown(); this.label31 = new System.Windows.Forms.Label(); this.groupBox20 = new System.Windows.Forms.GroupBox(); - this.STB_YAW_IMAX = new System.Windows.Forms.DomainUpDown(); + this.STB_YAW_IMAX = new System.Windows.Forms.NumericUpDown(); this.label32 = new System.Windows.Forms.Label(); - this.STB_YAW_I = new System.Windows.Forms.DomainUpDown(); + this.STB_YAW_I = new System.Windows.Forms.NumericUpDown(); this.label34 = new System.Windows.Forms.Label(); - this.STB_YAW_P = new System.Windows.Forms.DomainUpDown(); + this.STB_YAW_P = new System.Windows.Forms.NumericUpDown(); this.label35 = new System.Windows.Forms.Label(); this.groupBox21 = new System.Windows.Forms.GroupBox(); - this.STB_PIT_IMAX = new System.Windows.Forms.DomainUpDown(); + this.STB_PIT_IMAX = new System.Windows.Forms.NumericUpDown(); this.label36 = new System.Windows.Forms.Label(); - this.STB_PIT_I = new System.Windows.Forms.DomainUpDown(); + this.STB_PIT_I = new System.Windows.Forms.NumericUpDown(); this.label41 = new System.Windows.Forms.Label(); - this.STB_PIT_P = new System.Windows.Forms.DomainUpDown(); + this.STB_PIT_P = new System.Windows.Forms.NumericUpDown(); this.label42 = new System.Windows.Forms.Label(); this.groupBox22 = new System.Windows.Forms.GroupBox(); - this.STB_RLL_IMAX = new System.Windows.Forms.DomainUpDown(); + this.STB_RLL_IMAX = new System.Windows.Forms.NumericUpDown(); this.label43 = new System.Windows.Forms.Label(); - this.STB_RLL_I = new System.Windows.Forms.DomainUpDown(); + this.STB_RLL_I = new System.Windows.Forms.NumericUpDown(); this.label45 = new System.Windows.Forms.Label(); - this.STB_RLL_P = new System.Windows.Forms.DomainUpDown(); + this.STB_RLL_P = new System.Windows.Forms.NumericUpDown(); this.label46 = new System.Windows.Forms.Label(); this.groupBox23 = new System.Windows.Forms.GroupBox(); - this.RATE_YAW_IMAX = new System.Windows.Forms.DomainUpDown(); + this.RATE_YAW_IMAX = new System.Windows.Forms.NumericUpDown(); this.label47 = new System.Windows.Forms.Label(); - this.RATE_YAW_I = new System.Windows.Forms.DomainUpDown(); + this.RATE_YAW_I = new System.Windows.Forms.NumericUpDown(); this.label77 = new System.Windows.Forms.Label(); - this.RATE_YAW_P = new System.Windows.Forms.DomainUpDown(); + this.RATE_YAW_P = new System.Windows.Forms.NumericUpDown(); this.label82 = new System.Windows.Forms.Label(); this.groupBox24 = new System.Windows.Forms.GroupBox(); - this.RATE_PIT_IMAX = new System.Windows.Forms.DomainUpDown(); + this.RATE_PIT_IMAX = new System.Windows.Forms.NumericUpDown(); this.label84 = new System.Windows.Forms.Label(); - this.RATE_PIT_I = new System.Windows.Forms.DomainUpDown(); + this.RATE_PIT_I = new System.Windows.Forms.NumericUpDown(); this.label86 = new System.Windows.Forms.Label(); - this.RATE_PIT_P = new System.Windows.Forms.DomainUpDown(); + this.RATE_PIT_P = new System.Windows.Forms.NumericUpDown(); this.label87 = new System.Windows.Forms.Label(); this.groupBox25 = new System.Windows.Forms.GroupBox(); - this.RATE_RLL_IMAX = new System.Windows.Forms.DomainUpDown(); + this.RATE_RLL_IMAX = new System.Windows.Forms.NumericUpDown(); this.label88 = new System.Windows.Forms.Label(); - this.RATE_RLL_I = new System.Windows.Forms.DomainUpDown(); + this.RATE_RLL_I = new System.Windows.Forms.NumericUpDown(); this.label90 = new System.Windows.Forms.Label(); - this.RATE_RLL_P = new System.Windows.Forms.DomainUpDown(); + this.RATE_RLL_P = new System.Windows.Forms.NumericUpDown(); this.label91 = new System.Windows.Forms.Label(); this.TabPlanner = new System.Windows.Forms.TabPage(); this.label26 = new System.Windows.Forms.Label(); @@ -276,18 +276,18 @@ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.BUT_compare = new ArdupilotMega.MyButton(); this.groupBox17 = new System.Windows.Forms.GroupBox(); - this.ACRO_PIT_IMAX = new System.Windows.Forms.DomainUpDown(); + this.ACRO_PIT_IMAX = new System.Windows.Forms.NumericUpDown(); this.label27 = new System.Windows.Forms.Label(); - this.ACRO_PIT_I = new System.Windows.Forms.DomainUpDown(); + this.ACRO_PIT_I = new System.Windows.Forms.NumericUpDown(); this.label29 = new System.Windows.Forms.Label(); - this.ACRO_PIT_P = new System.Windows.Forms.DomainUpDown(); + this.ACRO_PIT_P = new System.Windows.Forms.NumericUpDown(); this.label33 = new System.Windows.Forms.Label(); this.groupBox18 = new System.Windows.Forms.GroupBox(); - this.ACRO_RLL_IMAX = new System.Windows.Forms.DomainUpDown(); + this.ACRO_RLL_IMAX = new System.Windows.Forms.NumericUpDown(); this.label40 = new System.Windows.Forms.Label(); - this.ACRO_RLL_I = new System.Windows.Forms.DomainUpDown(); + this.ACRO_RLL_I = new System.Windows.Forms.NumericUpDown(); this.label44 = new System.Windows.Forms.Label(); - this.ACRO_RLL_P = new System.Windows.Forms.DomainUpDown(); + this.ACRO_RLL_P = new System.Windows.Forms.NumericUpDown(); this.label48 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.Params)).BeginInit(); this.ConfigTabs.SuspendLayout(); @@ -2086,174 +2086,174 @@ private System.Windows.Forms.TabPage TabAPM2; private System.Windows.Forms.TabPage TabAC2; private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.DomainUpDown THR_FS_VALUE; + private System.Windows.Forms.NumericUpDown THR_FS_VALUE; private System.Windows.Forms.Label label5; - private System.Windows.Forms.DomainUpDown THR_MAX; + private System.Windows.Forms.NumericUpDown THR_MAX; private System.Windows.Forms.Label label6; - private System.Windows.Forms.DomainUpDown THR_MIN; + private System.Windows.Forms.NumericUpDown THR_MIN; private System.Windows.Forms.Label label7; - private System.Windows.Forms.DomainUpDown TRIM_THROTTLE; + private System.Windows.Forms.NumericUpDown TRIM_THROTTLE; private System.Windows.Forms.Label label8; private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.DomainUpDown ARSPD_RATIO; + private System.Windows.Forms.NumericUpDown ARSPD_RATIO; private System.Windows.Forms.Label label1; - private System.Windows.Forms.DomainUpDown ARSPD_FBW_MAX; + private System.Windows.Forms.NumericUpDown ARSPD_FBW_MAX; private System.Windows.Forms.Label label2; - private System.Windows.Forms.DomainUpDown ARSPD_FBW_MIN; + private System.Windows.Forms.NumericUpDown ARSPD_FBW_MIN; private System.Windows.Forms.Label label3; - private System.Windows.Forms.DomainUpDown TRIM_ARSPD_CM; + private System.Windows.Forms.NumericUpDown TRIM_ARSPD_CM; private System.Windows.Forms.Label label4; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.DomainUpDown LIM_PITCH_MIN; + private System.Windows.Forms.NumericUpDown LIM_PITCH_MIN; private System.Windows.Forms.Label label39; - private System.Windows.Forms.DomainUpDown LIM_PITCH_MAX; + private System.Windows.Forms.NumericUpDown LIM_PITCH_MAX; private System.Windows.Forms.Label label38; - private System.Windows.Forms.DomainUpDown LIM_ROLL_CD; + private System.Windows.Forms.NumericUpDown LIM_ROLL_CD; private System.Windows.Forms.Label label37; private System.Windows.Forms.GroupBox groupBox15; - private System.Windows.Forms.DomainUpDown XTRK_ANGLE_CD; + private System.Windows.Forms.NumericUpDown XTRK_ANGLE_CD; private System.Windows.Forms.Label label79; - private System.Windows.Forms.DomainUpDown XTRK_GAIN_SC; + private System.Windows.Forms.NumericUpDown XTRK_GAIN_SC; private System.Windows.Forms.Label label80; private System.Windows.Forms.GroupBox groupBox16; - private System.Windows.Forms.DomainUpDown KFF_PTCH2THR; + private System.Windows.Forms.NumericUpDown KFF_PTCH2THR; private System.Windows.Forms.Label label83; - private System.Windows.Forms.DomainUpDown KFF_RDDRMIX; + private System.Windows.Forms.NumericUpDown KFF_RDDRMIX; private System.Windows.Forms.Label label78; - private System.Windows.Forms.DomainUpDown KFF_PTCHCOMP; + private System.Windows.Forms.NumericUpDown KFF_PTCHCOMP; private System.Windows.Forms.Label label81; private System.Windows.Forms.GroupBox groupBox14; - private System.Windows.Forms.DomainUpDown ENRGY2THR_IMAX; + private System.Windows.Forms.NumericUpDown ENRGY2THR_IMAX; private System.Windows.Forms.Label label73; - private System.Windows.Forms.DomainUpDown ENRGY2THR_D; + private System.Windows.Forms.NumericUpDown ENRGY2THR_D; private System.Windows.Forms.Label label74; - private System.Windows.Forms.DomainUpDown ENRGY2THR_I; + private System.Windows.Forms.NumericUpDown ENRGY2THR_I; private System.Windows.Forms.Label label75; - private System.Windows.Forms.DomainUpDown ENRGY2THR_P; + private System.Windows.Forms.NumericUpDown ENRGY2THR_P; private System.Windows.Forms.Label label76; private System.Windows.Forms.GroupBox groupBox13; - private System.Windows.Forms.DomainUpDown ALT2PTCH_IMAX; + private System.Windows.Forms.NumericUpDown ALT2PTCH_IMAX; private System.Windows.Forms.Label label69; - private System.Windows.Forms.DomainUpDown ALT2PTCH_D; + private System.Windows.Forms.NumericUpDown ALT2PTCH_D; private System.Windows.Forms.Label label70; - private System.Windows.Forms.DomainUpDown ALT2PTCH_I; + private System.Windows.Forms.NumericUpDown ALT2PTCH_I; private System.Windows.Forms.Label label71; - private System.Windows.Forms.DomainUpDown ALT2PTCH_P; + private System.Windows.Forms.NumericUpDown ALT2PTCH_P; private System.Windows.Forms.Label label72; private System.Windows.Forms.GroupBox groupBox12; - private System.Windows.Forms.DomainUpDown ARSP2PTCH_IMAX; + private System.Windows.Forms.NumericUpDown ARSP2PTCH_IMAX; private System.Windows.Forms.Label label65; - private System.Windows.Forms.DomainUpDown ARSP2PTCH_D; + private System.Windows.Forms.NumericUpDown ARSP2PTCH_D; private System.Windows.Forms.Label label66; - private System.Windows.Forms.DomainUpDown ARSP2PTCH_I; + private System.Windows.Forms.NumericUpDown ARSP2PTCH_I; private System.Windows.Forms.Label label67; - private System.Windows.Forms.DomainUpDown ARSP2PTCH_P; + private System.Windows.Forms.NumericUpDown ARSP2PTCH_P; private System.Windows.Forms.Label label68; private System.Windows.Forms.GroupBox groupBox11; - private System.Windows.Forms.DomainUpDown HDNG2RLL_IMAX; + private System.Windows.Forms.NumericUpDown HDNG2RLL_IMAX; private System.Windows.Forms.Label label61; - private System.Windows.Forms.DomainUpDown HDNG2RLL_D; + private System.Windows.Forms.NumericUpDown HDNG2RLL_D; private System.Windows.Forms.Label label62; - private System.Windows.Forms.DomainUpDown HDNG2RLL_I; + private System.Windows.Forms.NumericUpDown HDNG2RLL_I; private System.Windows.Forms.Label label63; - private System.Windows.Forms.DomainUpDown HDNG2RLL_P; + private System.Windows.Forms.NumericUpDown HDNG2RLL_P; private System.Windows.Forms.Label label64; private System.Windows.Forms.GroupBox groupBox10; - private System.Windows.Forms.DomainUpDown YW2SRV_IMAX; + private System.Windows.Forms.NumericUpDown YW2SRV_IMAX; private System.Windows.Forms.Label label57; - private System.Windows.Forms.DomainUpDown YW2SRV_D; + private System.Windows.Forms.NumericUpDown YW2SRV_D; private System.Windows.Forms.Label label58; - private System.Windows.Forms.DomainUpDown YW2SRV_I; + private System.Windows.Forms.NumericUpDown YW2SRV_I; private System.Windows.Forms.Label label59; - private System.Windows.Forms.DomainUpDown YW2SRV_P; + private System.Windows.Forms.NumericUpDown YW2SRV_P; private System.Windows.Forms.Label label60; private System.Windows.Forms.GroupBox groupBox9; - private System.Windows.Forms.DomainUpDown PTCH2SRV_IMAX; + private System.Windows.Forms.NumericUpDown PTCH2SRV_IMAX; private System.Windows.Forms.Label label53; - private System.Windows.Forms.DomainUpDown PTCH2SRV_D; + private System.Windows.Forms.NumericUpDown PTCH2SRV_D; private System.Windows.Forms.Label label54; - private System.Windows.Forms.DomainUpDown PTCH2SRV_I; + private System.Windows.Forms.NumericUpDown PTCH2SRV_I; private System.Windows.Forms.Label label55; - private System.Windows.Forms.DomainUpDown PTCH2SRV_P; + private System.Windows.Forms.NumericUpDown PTCH2SRV_P; private System.Windows.Forms.Label label56; private System.Windows.Forms.GroupBox groupBox8; - private System.Windows.Forms.DomainUpDown RLL2SRV_IMAX; + private System.Windows.Forms.NumericUpDown RLL2SRV_IMAX; private System.Windows.Forms.Label label49; - private System.Windows.Forms.DomainUpDown RLL2SRV_D; + private System.Windows.Forms.NumericUpDown RLL2SRV_D; private System.Windows.Forms.Label label50; - private System.Windows.Forms.DomainUpDown RLL2SRV_I; + private System.Windows.Forms.NumericUpDown RLL2SRV_I; private System.Windows.Forms.Label label51; - private System.Windows.Forms.DomainUpDown RLL2SRV_P; + private System.Windows.Forms.NumericUpDown RLL2SRV_P; private System.Windows.Forms.Label label52; private System.Windows.Forms.GroupBox groupBox4; - private System.Windows.Forms.DomainUpDown NAV_LAT_IMAX; + private System.Windows.Forms.NumericUpDown NAV_LAT_IMAX; private System.Windows.Forms.Label label13; - private System.Windows.Forms.DomainUpDown NAV_LAT_I; + private System.Windows.Forms.NumericUpDown NAV_LAT_I; private System.Windows.Forms.Label label15; - private System.Windows.Forms.DomainUpDown NAV_LAT_P; + private System.Windows.Forms.NumericUpDown NAV_LAT_P; private System.Windows.Forms.Label label16; private System.Windows.Forms.GroupBox groupBox6; - private System.Windows.Forms.DomainUpDown XTRACK_IMAX; + private System.Windows.Forms.NumericUpDown XTRACK_IMAX; private System.Windows.Forms.Label label11; - private System.Windows.Forms.DomainUpDown XTRACK_I; + private System.Windows.Forms.NumericUpDown XTRACK_I; private System.Windows.Forms.Label label17; - private System.Windows.Forms.DomainUpDown XTRACK_P; + private System.Windows.Forms.NumericUpDown XTRACK_P; private System.Windows.Forms.Label label18; private System.Windows.Forms.GroupBox groupBox7; - private System.Windows.Forms.DomainUpDown THR_ALT_IMAX; + private System.Windows.Forms.NumericUpDown THR_ALT_IMAX; private System.Windows.Forms.Label label19; - private System.Windows.Forms.DomainUpDown THR_ALT_I; + private System.Windows.Forms.NumericUpDown THR_ALT_I; private System.Windows.Forms.Label label21; - private System.Windows.Forms.DomainUpDown THR_ALT_P; + private System.Windows.Forms.NumericUpDown THR_ALT_P; private System.Windows.Forms.Label label22; private System.Windows.Forms.GroupBox groupBox19; - private System.Windows.Forms.DomainUpDown HLD_LAT_IMAX; + private System.Windows.Forms.NumericUpDown HLD_LAT_IMAX; private System.Windows.Forms.Label label28; - private System.Windows.Forms.DomainUpDown HLD_LAT_I; + private System.Windows.Forms.NumericUpDown HLD_LAT_I; private System.Windows.Forms.Label label30; - private System.Windows.Forms.DomainUpDown HLD_LAT_P; + private System.Windows.Forms.NumericUpDown HLD_LAT_P; private System.Windows.Forms.Label label31; private System.Windows.Forms.GroupBox groupBox20; - private System.Windows.Forms.DomainUpDown STB_YAW_IMAX; + private System.Windows.Forms.NumericUpDown STB_YAW_IMAX; private System.Windows.Forms.Label label32; - private System.Windows.Forms.DomainUpDown STB_YAW_I; + private System.Windows.Forms.NumericUpDown STB_YAW_I; private System.Windows.Forms.Label label34; - private System.Windows.Forms.DomainUpDown STB_YAW_P; + private System.Windows.Forms.NumericUpDown STB_YAW_P; private System.Windows.Forms.Label label35; private System.Windows.Forms.GroupBox groupBox21; - private System.Windows.Forms.DomainUpDown STB_PIT_IMAX; + private System.Windows.Forms.NumericUpDown STB_PIT_IMAX; private System.Windows.Forms.Label label36; - private System.Windows.Forms.DomainUpDown STB_PIT_I; + private System.Windows.Forms.NumericUpDown STB_PIT_I; private System.Windows.Forms.Label label41; - private System.Windows.Forms.DomainUpDown STB_PIT_P; + private System.Windows.Forms.NumericUpDown STB_PIT_P; private System.Windows.Forms.Label label42; private System.Windows.Forms.GroupBox groupBox22; - private System.Windows.Forms.DomainUpDown STB_RLL_IMAX; + private System.Windows.Forms.NumericUpDown STB_RLL_IMAX; private System.Windows.Forms.Label label43; - private System.Windows.Forms.DomainUpDown STB_RLL_I; + private System.Windows.Forms.NumericUpDown STB_RLL_I; private System.Windows.Forms.Label label45; - private System.Windows.Forms.DomainUpDown STB_RLL_P; + private System.Windows.Forms.NumericUpDown STB_RLL_P; private System.Windows.Forms.Label label46; private System.Windows.Forms.GroupBox groupBox23; - private System.Windows.Forms.DomainUpDown RATE_YAW_IMAX; + private System.Windows.Forms.NumericUpDown RATE_YAW_IMAX; private System.Windows.Forms.Label label47; - private System.Windows.Forms.DomainUpDown RATE_YAW_I; + private System.Windows.Forms.NumericUpDown RATE_YAW_I; private System.Windows.Forms.Label label77; - private System.Windows.Forms.DomainUpDown RATE_YAW_P; + private System.Windows.Forms.NumericUpDown RATE_YAW_P; private System.Windows.Forms.Label label82; private System.Windows.Forms.GroupBox groupBox24; - private System.Windows.Forms.DomainUpDown RATE_PIT_IMAX; + private System.Windows.Forms.NumericUpDown RATE_PIT_IMAX; private System.Windows.Forms.Label label84; - private System.Windows.Forms.DomainUpDown RATE_PIT_I; + private System.Windows.Forms.NumericUpDown RATE_PIT_I; private System.Windows.Forms.Label label86; - private System.Windows.Forms.DomainUpDown RATE_PIT_P; + private System.Windows.Forms.NumericUpDown RATE_PIT_P; private System.Windows.Forms.Label label87; private System.Windows.Forms.GroupBox groupBox25; - private System.Windows.Forms.DomainUpDown RATE_RLL_IMAX; + private System.Windows.Forms.NumericUpDown RATE_RLL_IMAX; private System.Windows.Forms.Label label88; - private System.Windows.Forms.DomainUpDown RATE_RLL_I; + private System.Windows.Forms.NumericUpDown RATE_RLL_I; private System.Windows.Forms.Label label90; - private System.Windows.Forms.DomainUpDown RATE_RLL_P; + private System.Windows.Forms.NumericUpDown RATE_RLL_P; private System.Windows.Forms.Label label91; private System.Windows.Forms.TabPage TabPlanner; private System.Windows.Forms.Label label92; @@ -2293,9 +2293,9 @@ private System.Windows.Forms.CheckBox CHK_resetapmonconnect; private System.Windows.Forms.Label label108; private System.Windows.Forms.CheckBox CHK_lockrollpitch; - private System.Windows.Forms.DomainUpDown WP_SPEED_MAX; + private System.Windows.Forms.NumericUpDown WP_SPEED_MAX; private System.Windows.Forms.Label label9; - private System.Windows.Forms.DomainUpDown XTRK_ANGLE_CD1; + private System.Windows.Forms.NumericUpDown XTRK_ANGLE_CD1; private System.Windows.Forms.Label label10; private System.Windows.Forms.CheckBox CHK_speechaltwarning; private System.Windows.Forms.ToolTip toolTip1; @@ -2312,28 +2312,28 @@ private System.Windows.Forms.Label label12; private System.Windows.Forms.CheckBox CHK_GDIPlus; private System.Windows.Forms.GroupBox groupBox5; - private System.Windows.Forms.DomainUpDown THR_RATE_IMAX; - private System.Windows.Forms.DomainUpDown THR_RATE_I; + private System.Windows.Forms.NumericUpDown THR_RATE_IMAX; + private System.Windows.Forms.NumericUpDown THR_RATE_I; private System.Windows.Forms.Label label20; - private System.Windows.Forms.DomainUpDown THR_RATE_P; + private System.Windows.Forms.NumericUpDown THR_RATE_P; private System.Windows.Forms.Label label25; private System.Windows.Forms.ComboBox CMB_videoresolutions; private System.Windows.Forms.Label label109; private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label26; private System.Windows.Forms.GroupBox groupBox17; - private System.Windows.Forms.DomainUpDown ACRO_PIT_IMAX; + private System.Windows.Forms.NumericUpDown ACRO_PIT_IMAX; private System.Windows.Forms.Label label27; - private System.Windows.Forms.DomainUpDown ACRO_PIT_I; + private System.Windows.Forms.NumericUpDown ACRO_PIT_I; private System.Windows.Forms.Label label29; - private System.Windows.Forms.DomainUpDown ACRO_PIT_P; + private System.Windows.Forms.NumericUpDown ACRO_PIT_P; private System.Windows.Forms.Label label33; private System.Windows.Forms.GroupBox groupBox18; - private System.Windows.Forms.DomainUpDown ACRO_RLL_IMAX; + private System.Windows.Forms.NumericUpDown ACRO_RLL_IMAX; private System.Windows.Forms.Label label40; - private System.Windows.Forms.DomainUpDown ACRO_RLL_I; + private System.Windows.Forms.NumericUpDown ACRO_RLL_I; private System.Windows.Forms.Label label44; - private System.Windows.Forms.DomainUpDown ACRO_RLL_P; + private System.Windows.Forms.NumericUpDown ACRO_RLL_P; private System.Windows.Forms.Label label48; } } diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs index 7175193718..42d454a35a 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Configuration.cs @@ -61,6 +61,17 @@ namespace ArdupilotMega.GCSViews { InitializeComponent(); + //this.Width = this.Parent.Width; + //this.Height = this.Parent.Height; + + // fix for dup name + XTRK_ANGLE_CD1.Name = "XTRK_ANGLE_CD"; + } + + private void Configuration_Load(object sender, EventArgs e) + { + startup = true; + // enable disable relevbant hardware tabs if (MainV2.APMFirmware == MainV2.Firmwares.ArduPlane) { @@ -83,12 +94,8 @@ namespace ArdupilotMega.GCSViews param = MainV2.comPort.param; processToScreen(); - // fix for dup name - XTRK_ANGLE_CD1.Name = "XTRK_ANGLE_CD"; - } - private void Configuration_Load(object sender, EventArgs e) - { + // setup up camera button states if (MainV2.cam != null) { @@ -285,6 +292,7 @@ namespace ArdupilotMega.GCSViews internal void processToScreen() { + toolTip1.RemoveAll(); Params.Rows.Clear(); // process hashdefines and update display @@ -303,12 +311,12 @@ namespace ArdupilotMega.GCSViews 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[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()); + //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 { } @@ -319,20 +327,23 @@ namespace ArdupilotMega.GCSViews { try { - ((DomainUpDown)ctl).Items.AddRange(genpids()); - string option = ((float)param[value]).ToString("0.0##"); - int index = ((DomainUpDown)ctl).Items.IndexOf(option); - ((DomainUpDown)ctl).BackColor = Color.FromArgb(0x43, 0x44, 0x45); - Console.WriteLine(name + " " + option + " " + index + " " + ((float)param[value])); - ((DomainUpDown)ctl).Validated += null; - if (index == -1) + NumericUpDown thisctl = ((NumericUpDown)ctl); + thisctl.Maximum = 9000; + thisctl.Minimum = -9000; + thisctl.Value = (decimal)(float)param[value]; + thisctl.Increment = (decimal)0.001; + if (thisctl.Name.EndsWith("_P") || thisctl.Name.EndsWith("_I") || thisctl.Name.EndsWith("_D") || thisctl.Value == 0 || thisctl.Value.ToString("0.###", new System.Globalization.CultureInfo("en-US")).Contains(".")) { - ((DomainUpDown)ctl).Text = ((float)param[value]).ToString("0.0##"); + thisctl.DecimalPlaces = 3; } else { - ((DomainUpDown)ctl).SelectedIndex = index; + thisctl.Increment = (decimal)1; + thisctl.DecimalPlaces = 1; } + + thisctl.BackColor = Color.FromArgb(0x43, 0x44, 0x45); + thisctl.Validated += null; if (tooltips[value] != null) { try @@ -341,7 +352,7 @@ namespace ArdupilotMega.GCSViews } catch { } } - ((DomainUpDown)ctl).Validated += new EventHandler(EEPROM_View_float_TextChanged); + thisctl.Validated += new EventHandler(EEPROM_View_float_TextChanged); } catch { } @@ -475,30 +486,21 @@ namespace ArdupilotMega.GCSViews Params[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.Red; } + // set control as well + Control[] text = this.Controls.Find(Params[0, e.RowIndex].Value.ToString(), true); try { - // set control as well - Control[] text = this.Controls.Find(Params[0, e.RowIndex].Value.ToString(), true); if (text.Length > 0) { - string option = (float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString())).ToString("0.0##", System.Globalization.CultureInfo.CurrentCulture); - int index = ((DomainUpDown)text[0]).Items.IndexOf(option); - if (index != -1) - { - ((DomainUpDown)text[0]).SelectedIndex = index; - ((DomainUpDown)text[0]).BackColor = Color.Green; - } - else - { - ((DomainUpDown)text[0]).Text = option; - ((DomainUpDown)text[0]).BackColor = Color.Green; - } + decimal option = (decimal)(float.Parse(Params[e.ColumnIndex, e.RowIndex].Value.ToString())); + ((NumericUpDown)text[0]).Value = option; + ((NumericUpDown)text[0]).BackColor = Color.Green; } } - catch { } + catch { ((NumericUpDown)text[0]).BackColor = Color.Red; } Params.Focus(); - } + } private void BUT_load_Click(object sender, EventArgs e) { @@ -521,8 +523,10 @@ namespace ArdupilotMega.GCSViews int index = line.IndexOf(','); int index2 = line.IndexOf(',', index + 1); + if (index == -1) continue; + if (index2 != -1) line = line.Replace(',','.'); @@ -600,7 +604,7 @@ namespace ArdupilotMega.GCSViews Control[] text = this.Controls.Find(value, true); if (text.Length > 0) { - ((DomainUpDown)text[0]).BackColor = Color.FromArgb(0x43, 0x44, 0x45); + ((NumericUpDown)text[0]).BackColor = Color.FromArgb(0x43, 0x44, 0x45); } } catch { } @@ -845,10 +849,7 @@ namespace ArdupilotMega.GCSViews ((MyButton)sender).Enabled = true; startup = true; - param = MainV2.comPort.param; - processToScreen(); Configuration_Load(null, null); - startup = false; } private void CHK_speechbattery_CheckedChanged(object sender, EventArgs e) diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs index 08ee1f7940..ba81d91b9e 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightData.cs @@ -112,6 +112,13 @@ namespace ArdupilotMega.GCSViews List list = new List(); //foreach (object obj in Enum.GetValues(typeof(MAVLink.MAV_ACTION))) +#if MAVLINK10 + { + list.Add("LOITER_UNLIM"); + list.Add("RETURN_TO_LAUNCH"); + list.Add("PREFLIGHT_CALIBRATION"); + } +#else { list.Add("RETURN"); list.Add("HALT"); @@ -126,6 +133,7 @@ namespace ArdupilotMega.GCSViews list.Add("TAKEOFF"); list.Add("CALIBRATE_GYRO"); } +#endif CMB_action.DataSource = list; @@ -364,8 +372,8 @@ namespace ArdupilotMega.GCSViews -// if (CB_tuning.Checked == false) // draw if in view - { + // if (CB_tuning.Checked == false) // draw if in view + { if (MainV2.comPort.logreadmode && MainV2.comPort.logplaybackfile != null) { @@ -413,7 +421,7 @@ namespace ArdupilotMega.GCSViews if (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) { - routes.Markers.Add(new GMapMarkerPlane(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing,MainV2.cs.target_bearing)); + routes.Markers.Add(new GMapMarkerPlane(currentloc, MainV2.cs.yaw, MainV2.cs.groundcourse, MainV2.cs.nav_bearing, MainV2.cs.target_bearing)); } else { @@ -445,7 +453,7 @@ namespace ArdupilotMega.GCSViews tracklast = DateTime.Now; } } - catch (Exception ex) { Console.WriteLine("FD Main loop exception "+ ex.ToString()); } + catch (Exception ex) { Console.WriteLine("FD Main loop exception " + ex.ToString()); } } Console.WriteLine("FD Main loop exit"); } @@ -684,7 +692,11 @@ namespace ArdupilotMega.GCSViews try { ((Button)sender).Enabled = false; +#if MAVLINK10 + comPort.doCommand((MAVLink.MAV_CMD)Enum.Parse(typeof(MAVLink.MAV_CMD), CMB_action.Text)); +#else comPort.doAction((MAVLink.MAV_ACTION)Enum.Parse(typeof(MAVLink.MAV_ACTION), "MAV_ACTION_" + CMB_action.Text)); +#endif } catch { MessageBox.Show("The Command failed to execute"); } ((Button)sender).Enabled = true; @@ -961,20 +973,7 @@ namespace ArdupilotMega.GCSViews private void BUT_setmode_Click(object sender, EventArgs e) { - MAVLink.__mavlink_set_nav_mode_t navmode = new MAVLink.__mavlink_set_nav_mode_t(); - - MAVLink.__mavlink_set_mode_t mode = new MAVLink.__mavlink_set_mode_t(); - - if (Common.translateMode(CMB_modes.Text, ref navmode, ref mode)) - { - MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_NAV_MODE, navmode); - System.Threading.Thread.Sleep(10); - MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_NAV_MODE, navmode); - System.Threading.Thread.Sleep(10); - MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); - System.Threading.Thread.Sleep(10); - MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); - } + MainV2.comPort.setMode(CMB_modes.Text); } private void BUT_setwp_Click(object sender, EventArgs e) @@ -1009,7 +1008,11 @@ namespace ArdupilotMega.GCSViews try { ((Button)sender).Enabled = false; +#if MAVLINK10 + MainV2.comPort.setMode("AUTO"); +#else comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_SET_AUTO); +#endif } catch { MessageBox.Show("The Command failed to execute"); } ((Button)sender).Enabled = true; @@ -1020,7 +1023,11 @@ namespace ArdupilotMega.GCSViews try { ((Button)sender).Enabled = false; +#if MAVLINK10 + MainV2.comPort.setMode("RTL"); +#else comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_RETURN); +#endif } catch { MessageBox.Show("The Command failed to execute"); } ((Button)sender).Enabled = true; @@ -1031,7 +1038,11 @@ namespace ArdupilotMega.GCSViews try { ((Button)sender).Enabled = false; +#if MAVLINK10 + MainV2.comPort.setMode("MANUAL"); +#else comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_SET_MANUAL); +#endif } catch { MessageBox.Show("The Command failed to execute"); } ((Button)sender).Enabled = true; @@ -1455,27 +1466,27 @@ namespace ArdupilotMega.GCSViews { list5item = null; zg1.GraphPane.CurveList.Remove(list5curve); - } + } if (list6item != null && list6item.Name == ((CheckBox)sender).Name) { list6item = null; zg1.GraphPane.CurveList.Remove(list6curve); - } + } if (list7item != null && list7item.Name == ((CheckBox)sender).Name) { list7item = null; zg1.GraphPane.CurveList.Remove(list7curve); - } + } if (list8item != null && list8item.Name == ((CheckBox)sender).Name) { list8item = null; zg1.GraphPane.CurveList.Remove(list8curve); - } + } if (list9item != null && list9item.Name == ((CheckBox)sender).Name) { list9item = null; zg1.GraphPane.CurveList.Remove(list9curve); - } + } if (list10item != null && list10item.Name == ((CheckBox)sender).Name) { list10item = null; @@ -1510,6 +1521,7 @@ namespace ArdupilotMega.GCSViews MainV2.comPort.setMountConfigure(MAVLink.MAV_MOUNT_MODE.MAV_MOUNT_MODE_GPS_POINT, true, true, true); MainV2.comPort.setMountControl(gotolocation.Lat, gotolocation.Lng, (int)(intalt / MainV2.cs.multiplierdist), true); + } } } \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs index cdfabc933a..32a355422d 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/FlightPlanner.cs @@ -29,6 +29,7 @@ namespace ArdupilotMega.GCSViews bool quickadd = false; bool isonline = true; bool sethome = false; + bool polygongridmode = false; Hashtable param = new Hashtable(); public static Hashtable hashdefines = new Hashtable(); public static List pointlist = new List(); // used to calc distance @@ -370,6 +371,11 @@ namespace ArdupilotMega.GCSViews /// public void callMe(double lat, double lng, int alt) { + if (polygongridmode) + { + addPolygonPointToolStripMenuItem_Click(null, null); + return; + } if (sethome) { @@ -2171,6 +2177,8 @@ namespace ArdupilotMega.GCSViews private void BUT_grid_Click(object sender, EventArgs e) { + polygongridmode = false; + if (drawnpolygon == null || drawnpolygon.Points.Count == 0) { MessageBox.Show("Right click the map to draw a polygon", "Area", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); @@ -2366,8 +2374,8 @@ namespace ArdupilotMega.GCSViews } } - drawnpolygon.Points.Clear(); - drawnpolygons.Markers.Clear(); + //drawnpolygon.Points.Clear(); + //drawnpolygons.Markers.Clear(); MainMap.Refresh(); } @@ -2460,6 +2468,13 @@ namespace ArdupilotMega.GCSViews private void addPolygonPointToolStripMenuItem_Click(object sender, EventArgs e) { + if (polygongridmode == false) + { + MessageBox.Show("You will remain in polygon mode until you clear the polygon or create a grid"); + } + + polygongridmode = true; + List < PointLatLng > polygonPoints = new List(); if (drawnpolygons.Polygons.Count == 0) { @@ -2479,6 +2494,7 @@ namespace ArdupilotMega.GCSViews private void clearPolygonToolStripMenuItem_Click(object sender, EventArgs e) { + polygongridmode = false; if (drawnpolygon == null) return; drawnpolygon.Points.Clear(); @@ -2591,6 +2607,7 @@ namespace ArdupilotMega.GCSViews setfromGE(end.Lat, end.Lng, (int)float.Parse(TXT_DefaultAlt.Text)); } + private void BUT_Camera_Click(object sender, EventArgs e) { Camera form = new Camera(); diff --git a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs index 1824c1ecb6..64413d2ac4 100644 --- a/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs +++ b/Tools/ArdupilotMegaPlanner/GCSViews/Simulation.cs @@ -684,6 +684,9 @@ namespace ArdupilotMega.GCSViews float oldax =0, olday =0, oldaz = 0; DateTime oldtime = DateTime.Now; +#if MAVLINK10 + ArdupilotMega.MAVLink.__mavlink_gps_raw_int_t oldgps = new MAVLink.__mavlink_gps_raw_int_t(); + #endif ArdupilotMega.MAVLink.__mavlink_attitude_t oldatt = new ArdupilotMega.MAVLink.__mavlink_attitude_t(); @@ -695,10 +698,15 @@ namespace ArdupilotMega.GCSViews /// Com Port private void RECVprocess(byte[] data, int receviedbytes, ArdupilotMega.MAVLink comPort) { +#if MAVLINK10 + ArdupilotMega.MAVLink.__mavlink_hil_state_t hilstate = new ArdupilotMega.MAVLink.__mavlink_hil_state_t(); + ArdupilotMega.MAVLink.__mavlink_gps_raw_int_t gps = new ArdupilotMega.MAVLink.__mavlink_gps_raw_int_t(); +#else + ArdupilotMega.MAVLink.__mavlink_gps_raw_t gps = new ArdupilotMega.MAVLink.__mavlink_gps_raw_t(); +#endif ArdupilotMega.MAVLink.__mavlink_raw_imu_t imu = new ArdupilotMega.MAVLink.__mavlink_raw_imu_t(); - ArdupilotMega.MAVLink.__mavlink_gps_raw_t gps = new ArdupilotMega.MAVLink.__mavlink_gps_raw_t(); ArdupilotMega.MAVLink.__mavlink_attitude_t att = new ArdupilotMega.MAVLink.__mavlink_attitude_t(); @@ -742,7 +750,7 @@ namespace ArdupilotMega.GCSViews float rdiff = (float)((att.roll - oldatt.roll) / timediff.TotalSeconds); float ydiff = (float)((att.yaw - oldatt.yaw) / timediff.TotalSeconds); - //Console.WriteLine("{0:0.00000} {1:0.00000} {2:0.00000} \t {3:0.00000} {4:0.00000} {5:0.00000}", pdiff, rdiff, ydiff, DATA[17][0], DATA[17][1], DATA[17][2]); + //Console.WriteLine("{0:0.00000} {1:0.00000} {2:0.00000} \t {3:0.00000} {4:0.00000} {5:0.00000}", pdiff, rdiff, ydiff, DATA[17][0], DATA[17][1], DATA[17][2]); oldatt = att; @@ -775,8 +783,11 @@ namespace ArdupilotMega.GCSViews oldaz = DATA[4][4]; double head = DATA[18][2] - 90; - - imu.usec = ((ulong)DateTime.Now.ToBinary()); +#if MAVLINK10 + imu.time_usec = ((ulong)DateTime.Now.ToBinary()); + #else + imu.usec = ((ulong)DateTime.Now.ToBinary()); + #endif imu.xgyro = xgyro; // roll - yes imu.xmag = (short)(Math.Sin(head * deg2rad) * 1000); imu.ygyro = ygyro; // pitch - yes @@ -789,7 +800,15 @@ namespace ArdupilotMega.GCSViews imu.zacc = (Int16)(accel3D.Z * 1000); //Console.WriteLine("ax " + imu.xacc + " ay " + imu.yacc + " az " + imu.zacc); - +#if MAVLINK10 + gps.alt = (int)(DATA[20][2] * ft2m * 1000); + gps.fix_type = 3; + gps.cog = (ushort)(DATA[19][2] * 100); + gps.lat = (int)(DATA[20][0] * 1.0e7); + gps.lon = (int)(DATA[20][1] * 1.0e7); + gps.time_usec = ((ulong)0); + gps.vel = (ushort)(DATA[3][7] * 0.44704 * 100); +#else gps.alt = ((float)(DATA[20][2] * ft2m)); gps.fix_type = 3; gps.hdg = ((float)DATA[19][2]); @@ -797,8 +816,7 @@ namespace ArdupilotMega.GCSViews gps.lon = ((float)DATA[20][1]); gps.usec = ((ulong)0); gps.v = ((float)(DATA[3][7] * 0.44704)); - gps.eph = 0; - gps.epv = 0; +#endif asp.airspeed = ((float)(DATA[3][6] * 0.44704)); @@ -826,7 +844,12 @@ namespace ArdupilotMega.GCSViews chkSensor.Checked = true; - imu.usec = ((ulong)DateTime.Now.Ticks); +#if MAVLINK10 + imu.time_usec = ((ulong)DateTime.Now.ToBinary()); + #else + imu.usec = ((ulong)DateTime.Now.ToBinary()); + #endif + imu.xacc = ((Int16)(imudata2.accelX * 9808 / 32.2)); imu.xgyro = ((Int16)(imudata2.rateRoll * 17.453293)); imu.xmag = 0; @@ -836,7 +859,16 @@ namespace ArdupilotMega.GCSViews imu.zacc = ((Int16)(imudata2.accelZ * 9808 / 32.2)); // + 1000 imu.zgyro = ((Int16)(imudata2.rateYaw * 17.453293)); imu.zmag = 0; - + +#if MAVLINK10 + gps.alt = ((int)(imudata2.altitude * ft2m * 1000)); + gps.fix_type = 3; + gps.cog = (ushort)(Math.Atan2(imudata2.velocityE, imudata2.velocityN) * rad2deg * 100); + gps.lat = (int)(imudata2.latitude * 1.0e7); + gps.lon = (int)(imudata2.longitude * 1.0e7); + gps.time_usec = ((ulong)DateTime.Now.Ticks); + gps.vel = (ushort)(Math.Sqrt((imudata2.velocityN * imudata2.velocityN) + (imudata2.velocityE * imudata2.velocityE)) * ft2m * 100); +#else gps.alt = ((float)(imudata2.altitude * ft2m)); gps.fix_type = 3; gps.hdg = ((float)Math.Atan2(imudata2.velocityE, imudata2.velocityN) * rad2deg); @@ -845,6 +877,7 @@ namespace ArdupilotMega.GCSViews gps.usec = ((ulong)DateTime.Now.Ticks); gps.v = ((float)Math.Sqrt((imudata2.velocityN * imudata2.velocityN) + (imudata2.velocityE * imudata2.velocityE)) * ft2m); +#endif //FileStream stream = File.OpenWrite("fgdata.txt"); //stream.Write(data, 0, receviedbytes); //stream.Close(); @@ -867,7 +900,11 @@ namespace ArdupilotMega.GCSViews att.yawspeed = (aeroin.Model_fAngVelZ); - imu.usec = ((ulong)DateTime.Now.ToBinary()); +#if MAVLINK10 + imu.time_usec = ((ulong)DateTime.Now.ToBinary()); + #else + imu.usec = ((ulong)DateTime.Now.ToBinary()); + #endif imu.xgyro = (short)(aeroin.Model_fAngVelX * 1000); // roll - yes //imu.xmag = (short)(Math.Sin(head * deg2rad) * 1000); imu.ygyro = (short)(aeroin.Model_fAngVelY * 1000); // pitch - yes @@ -881,9 +918,17 @@ namespace ArdupilotMega.GCSViews imu.yacc = (Int16)((accel3D.Y + aeroin.Model_fAccelY) * 1000); // roll imu.zacc = (Int16)((accel3D.Z + aeroin.Model_fAccelZ) * 1000); - Console.WriteLine("x {0} y {1} z {2}",imu.xacc,imu.yacc,imu.zacc); - + Console.WriteLine("x {0} y {1} z {2}", imu.xacc, imu.yacc, imu.zacc); +#if MAVLINK10 + gps.alt = ((int)(aeroin.Model_fPosZ) * 1000); + gps.fix_type = 3; + gps.cog = (ushort)(Math.Atan2(aeroin.Model_fVelX, aeroin.Model_fVelY) * rad2deg * 100); + gps.lat = (int)(aeroin.Model_fLatitude * 1.0e7); + gps.lon = (int)(aeroin.Model_fLongitude * 1.0e7); + gps.time_usec = ((ulong)DateTime.Now.Ticks); + gps.vel = (ushort)(Math.Sqrt((aeroin.Model_fVelY * aeroin.Model_fVelY) + (aeroin.Model_fVelX * aeroin.Model_fVelX)) * 100); +#else gps.alt = ((float)(aeroin.Model_fPosZ)); gps.fix_type = 3; gps.hdg = ((float)Math.Atan2(aeroin.Model_fVelX, aeroin.Model_fVelY) * rad2deg); @@ -892,6 +937,7 @@ namespace ArdupilotMega.GCSViews gps.usec = ((ulong)DateTime.Now.Ticks); gps.v = ((float)Math.Sqrt((aeroin.Model_fVelY * aeroin.Model_fVelY) + (aeroin.Model_fVelX * aeroin.Model_fVelX))); +#endif float xvec = aeroin.Model_fVelY - aeroin.Model_fWindVelY; float yvec = aeroin.Model_fVelX - aeroin.Model_fWindVelX; @@ -915,7 +961,11 @@ namespace ArdupilotMega.GCSViews att.pitch = fdm.theta; att.yaw = fdm.psi; - imu.usec = ((ulong)DateTime.Now.ToBinary()); +#if MAVLINK10 + imu.time_usec = ((ulong)DateTime.Now.ToBinary()); + #else + imu.usec = ((ulong)DateTime.Now.ToBinary()); + #endif imu.xgyro = (short)(fdm.phidot * 1150); // roll - yes //imu.xmag = (short)(Math.Sin(head * deg2rad) * 1000); imu.ygyro = (short)(fdm.thetadot * 1150); // pitch - yes @@ -928,7 +978,15 @@ namespace ArdupilotMega.GCSViews imu.zacc = (Int16)Math.Min(Int16.MaxValue, Math.Max(Int16.MinValue, (fdm.A_Z_pilot / 32.2 * 9808))); //Console.WriteLine("ax " + imu.xacc + " ay " + imu.yacc + " az " + imu.zacc); - +#if MAVLINK10 + gps.alt = ((int)(fdm.altitude * ft2m * 1000)); + gps.fix_type = 3; + gps.cog = (ushort)((((Math.Atan2(fdm.v_east, fdm.v_north) * rad2deg) + 360) % 360) * 100); + gps.lat = (int)(fdm.latitude * rad2deg * 1.0e7); + gps.lon = (int)(fdm.longitude * rad2deg * 1.0e7); + gps.time_usec = ((ulong)DateTime.Now.Ticks); + gps.vel = (ushort)(Math.Sqrt((fdm.v_north * fdm.v_north) + (fdm.v_east * fdm.v_east)) * ft2m * 100); +#else gps.alt = ((float)(fdm.altitude * ft2m)); gps.fix_type = 3; gps.hdg = (float)(((Math.Atan2(fdm.v_east, fdm.v_north) * rad2deg) + 360) % 360); @@ -938,6 +996,7 @@ namespace ArdupilotMega.GCSViews gps.usec = ((ulong)DateTime.Now.Ticks); gps.v = ((float)Math.Sqrt((fdm.v_north * fdm.v_north) + (fdm.v_east * fdm.v_east)) * ft2m); +#endif asp.airspeed = fdm.vcas * kts2fps * ft2m; } else @@ -994,7 +1053,15 @@ namespace ArdupilotMega.GCSViews att.pitch = (DATA[18][0]); att.roll = (DATA[18][1]); att.yaw = (DATA[19][2]); - +#if MAVLINK10 + gps.alt = ((int)(DATA[20][2] * ft2m * 1000)); + gps.fix_type = 3; + gps.cog = (ushort)(DATA[18][2] * 100); + gps.lat = (int)(DATA[20][0] * 1.0e7); + gps.lon = (int)(DATA[20][1] * 1.0e7); + gps.time_usec = ((ulong)0); + gps.vel = (ushort)((DATA[3][7] * 0.44704 * 100)); +#else gps.alt = ((float)(DATA[20][2] * ft2m)); gps.fix_type = 3; gps.hdg = ((float)DATA[18][2]); @@ -1002,8 +1069,7 @@ namespace ArdupilotMega.GCSViews gps.lon = ((float)DATA[20][1]); gps.usec = ((ulong)0); gps.v = ((float)(DATA[3][7] * 0.44704)); - gps.eph = 0; - gps.epv = 0; +#endif asp.airspeed = ((float)(DATA[3][6] * 0.44704)); } @@ -1014,25 +1080,62 @@ namespace ArdupilotMega.GCSViews return; } +#if MAVLINK10 + + TimeSpan gpsspan = DateTime.Now - lastgpsupdate; + + if (gpsspan.TotalMilliseconds >= GPS_rate) + { + lastgpsupdate = DateTime.Now; + oldgps = gps; + //comPort.sendPacket(gps); + } + + + hilstate.alt = oldgps.alt; + hilstate.lat = oldgps.lat; + hilstate.lon = oldgps.lon; + hilstate.pitch = att.pitch; + hilstate.pitchspeed = att.pitchspeed; + hilstate.roll = att.roll; + hilstate.rollspeed = att.rollspeed; + hilstate.time_usec = gps.time_usec; + hilstate.vx = (short)(gps.vel * Math.Sin(oldgps.cog / 100.0 * deg2rad)); + hilstate.vy = (short)(gps.vel * Math.Cos(oldgps.cog / 100.0 * deg2rad)); + hilstate.vz = 0; + hilstate.xacc = imu.xacc; + hilstate.yacc = imu.yacc; + hilstate.yaw = att.yaw; + hilstate.yawspeed = att.yawspeed; + hilstate.zacc = imu.zacc; + + comPort.sendPacket(hilstate); + + comPort.sendPacket(asp); + + #else + if (chkSensor.Checked == false) // attitude { - comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_ATTITUDE, att); + comPort.sendPacket( att); - comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_VFR_HUD, asp); + comPort.sendPacket( asp); } else // raw imu { // imudata - comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_RAW_IMU, imu); + comPort.sendPacket( imu); - MAVLink.__mavlink_raw_pressure_t pres = new MAVLink.__mavlink_raw_pressure_t(); - double calc = (101325 * Math.Pow(1 - 2.25577 * Math.Pow(10, -5) * gps.alt, 5.25588)); - pres.press_diff1 = (short)(int)(calc - 101325); // 0 alt is 0 pa + #endif - comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_RAW_PRESSURE, pres); + MAVLink.__mavlink_raw_pressure_t pres = new MAVLink.__mavlink_raw_pressure_t(); + double calc = (101325 * Math.Pow(1 - 2.25577 * Math.Pow(10, -5) * gps.alt, 5.25588)); // updated from valid gps + pres.press_diff1 = (short)(int)(calc - 101325); // 0 alt is 0 pa - comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_VFR_HUD, asp); + comPort.sendPacket(pres); +#if !MAVLINK10 + comPort.sendPacket(asp); } TimeSpan gpsspan = DateTime.Now - lastgpsupdate; @@ -1041,9 +1144,10 @@ namespace ArdupilotMega.GCSViews { lastgpsupdate = DateTime.Now; - comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_GPS_RAW, gps); + comPort.sendPacket(gps); } - } +#endif + } HIL.QuadCopter quad = new HIL.QuadCopter(); diff --git a/Tools/ArdupilotMegaPlanner/HIL/QuadCopter.cs b/Tools/ArdupilotMegaPlanner/HIL/QuadCopter.cs index a780cb4a8a..31e2cc662d 100644 --- a/Tools/ArdupilotMegaPlanner/HIL/QuadCopter.cs +++ b/Tools/ArdupilotMegaPlanner/HIL/QuadCopter.cs @@ -47,26 +47,26 @@ namespace ArdupilotMega.HIL { float min_pwm = 1000; float max_pwm = 2000; - //'''scale a PWM value''' # default to servo range of 1000 to 2000 + //'''scale a PWM value''' # default to servo range of 1000 to 2000 if (MainV2.comPort.param.Count > 0) { min_pwm = int.Parse(MainV2.comPort.param["RC3_MIN"].ToString()); max_pwm = int.Parse(MainV2.comPort.param["RC3_MAX"].ToString()); } - float p = (servo - min_pwm) / (max_pwm - min_pwm); + float p = (servo - min_pwm) / (max_pwm - min_pwm); - float v = min + p * (max - min); + float v = min + p * (max - min); - if (v < min) - v = min ; - if (v > max) - v = max ; - return v; - } + if (v < min) + v = min; + if (v > max) + v = max; + return v; + } public void update(ref double[] servos, ArdupilotMega.GCSViews.Simulation.FGNetFDM fdm) - { + { for (int i = 0; i < servos.Length; i++) { if (servos[i] <= 0.0) @@ -75,7 +75,7 @@ namespace ArdupilotMega.HIL } else { - motor_speed[i] = scale_rc(i,(float)servos[i], 0.0f, 1.0f); + motor_speed[i] = scale_rc(i, (float)servos[i], 0.0f, 1.0f); //servos[i] = motor_speed[i]; } } @@ -90,12 +90,12 @@ namespace ArdupilotMega.HIL yaw_rate = 0; */ -// Console.WriteLine("\nin m {0:0.000000} {1:0.000000} {2:0.000000} {3:0.000000}", m[0], m[1], m[2], m[3]); -// Console.WriteLine("in vel {0:0.000000} {1:0.000000} {2:0.000000}", velocity.X, velocity.Y, velocity.Z); + // Console.WriteLine("\nin m {0:0.000000} {1:0.000000} {2:0.000000} {3:0.000000}", m[0], m[1], m[2], m[3]); + // Console.WriteLine("in vel {0:0.000000} {1:0.000000} {2:0.000000}", velocity.X, velocity.Y, velocity.Z); //Console.WriteLine("in r {0:0.000000} p {1:0.000000} y {2:0.000000} - r {3:0.000000} p {4:0.000000} y {5:0.000000}", roll, pitch, yaw, roll_rate, pitch_rate, yaw_rate); - -// m[0] *= 0.5; + + // m[0] *= 0.5; //# how much time has passed? DateTime t = DateTime.Now; @@ -112,21 +112,21 @@ namespace ArdupilotMega.HIL double pitch_accel = (m[2] - m[3]) * 5000.0; double yaw_accel = -((m[2] + m[3]) - (m[0] + m[1])) * 400.0; - // Console.WriteLine("roll {0} {1} {2}", roll_accel, roll_rate, roll); + // Console.WriteLine("roll {0} {1} {2}", roll_accel, roll_rate, roll); //# update rotational rates roll_rate += roll_accel * delta_time.TotalSeconds; pitch_rate += pitch_accel * delta_time.TotalSeconds; yaw_rate += yaw_accel * delta_time.TotalSeconds; - // Console.WriteLine("roll {0} {1} {2}", roll_accel, roll_rate, roll); + // Console.WriteLine("roll {0} {1} {2}", roll_accel, roll_rate, roll); //# update rotation roll += roll_rate * delta_time.TotalSeconds; pitch += pitch_rate * delta_time.TotalSeconds; yaw += yaw_rate * delta_time.TotalSeconds; -// Console.WriteLine("roll {0} {1} {2}", roll_accel, roll_rate, roll); + // Console.WriteLine("roll {0} {1} {2}", roll_accel, roll_rate, roll); //Console.WriteLine("r {0:0.0} p {1:0.0} y {2:0.0} - r {3:0.0} p {4:0.0} y {5:0.0} ms {6:0.000}", roll, pitch, yaw, roll_rate, pitch_rate, yaw_rate, delta_time.TotalSeconds); @@ -155,7 +155,7 @@ namespace ArdupilotMega.HIL old_position = new Vector3d(position); position += velocity * delta_time.TotalSeconds; -// Console.WriteLine(fdm.agl + " "+ fdm.altitude); + // Console.WriteLine(fdm.agl + " "+ fdm.altitude); //Console.WriteLine("Z {0} halt {1} < gl {2} fh {3}" ,position.Z , home_altitude , ground_level , frame_height); @@ -176,7 +176,7 @@ namespace ArdupilotMega.HIL { if (old_position.Z + home_altitude > ground_level + frame_height) { -// Console.WriteLine("Hit ground at {0} m/s", (-velocity.Z)); + // Console.WriteLine("Hit ground at {0} m/s", (-velocity.Z)); } velocity = new Vector3d(0, 0, 0); roll_rate = 0; @@ -186,14 +186,18 @@ namespace ArdupilotMega.HIL pitch = 0; position = new Vector3d(position.X, position.Y, ground_level + frame_height - home_altitude + 0); - // Console.WriteLine("here " + position.Z); + // Console.WriteLine("here " + position.Z); } //# update lat/lon/altitude update_position(); // send to apm +#if MAVLINK10 + ArdupilotMega.MAVLink.__mavlink_gps_raw_int_t gps = new ArdupilotMega.MAVLink.__mavlink_gps_raw_int_t(); +#else ArdupilotMega.MAVLink.__mavlink_gps_raw_t gps = new ArdupilotMega.MAVLink.__mavlink_gps_raw_t(); +#endif ArdupilotMega.MAVLink.__mavlink_attitude_t att = new ArdupilotMega.MAVLink.__mavlink_attitude_t(); @@ -206,6 +210,19 @@ namespace ArdupilotMega.HIL att.pitchspeed = (float)pitch_rate * deg2rad; att.yawspeed = (float)yaw_rate * deg2rad; +#if MAVLINK10 + + gps.alt = ((int)(altitude * 1000)); + gps.fix_type = 3; + gps.vel = (ushort)(Math.Sqrt((velocity.X * velocity.X) + (velocity.Y * velocity.Y)) * 100); + gps.cog = (ushort)((((Math.Atan2(velocity.Y, velocity.X) * rad2deg) + 360) % 360) * 100); + gps.lat = (int)(latitude* 1.0e7); + gps.lon = (int)(longitude * 1.0e7); + gps.time_usec = ((ulong)DateTime.Now.Ticks); + + asp.airspeed = gps.vel; + +#else gps.alt = ((float)(altitude)); gps.fix_type = 3; gps.v = ((float)Math.Sqrt((velocity.X * velocity.X) + (velocity.Y * velocity.Y))); @@ -215,20 +232,21 @@ namespace ArdupilotMega.HIL gps.usec = ((ulong)DateTime.Now.Ticks); asp.airspeed = gps.v; +#endif - MainV2.comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_ATTITUDE, att); + MainV2.comPort.sendPacket(att); MAVLink.__mavlink_raw_pressure_t pres = new MAVLink.__mavlink_raw_pressure_t(); double calc = (101325 * Math.Pow(1 - 2.25577 * Math.Pow(10, -5) * gps.alt, 5.25588)); pres.press_diff1 = (short)(int)(calc); // 0 alt is 0 pa - MainV2.comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_RAW_PRESSURE, pres); + MainV2.comPort.sendPacket(pres); - MainV2.comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_VFR_HUD, asp); + MainV2.comPort.sendPacket(asp); if (framecount % 10 == 0) {// 50 / 10 = 5 hz - MainV2.comPort.generatePacket(ArdupilotMega.MAVLink.MAVLINK_MSG_ID_GPS_RAW, gps); + MainV2.comPort.sendPacket(gps); //Console.WriteLine(DateTime.Now.Millisecond + " GPS" ); } @@ -260,4 +278,4 @@ namespace ArdupilotMega.HIL return Q; } } -} +} \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/Joystick.cs b/Tools/ArdupilotMegaPlanner/Joystick.cs index a41f31fa85..2339b6fbb4 100644 --- a/Tools/ArdupilotMegaPlanner/Joystick.cs +++ b/Tools/ArdupilotMegaPlanner/Joystick.cs @@ -326,20 +326,8 @@ namespace ArdupilotMega { try { - MAVLink.__mavlink_set_nav_mode_t navmode = new MAVLink.__mavlink_set_nav_mode_t(); + MainV2.comPort.setMode(but.mode); - MAVLink.__mavlink_set_mode_t mode = new MAVLink.__mavlink_set_mode_t(); - - if (Common.translateMode(but.mode, ref navmode, ref mode)) - { - MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_NAV_MODE, navmode); - System.Threading.Thread.Sleep(10); - MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_NAV_MODE, navmode); - System.Threading.Thread.Sleep(10); - MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); - System.Threading.Thread.Sleep(10); - MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); - } } catch { System.Windows.Forms.MessageBox.Show("Failed to change Modes"); } }); diff --git a/Tools/ArdupilotMegaPlanner/JoystickSetup.cs b/Tools/ArdupilotMegaPlanner/JoystickSetup.cs index 7548c4935a..4478ffa93a 100644 --- a/Tools/ArdupilotMegaPlanner/JoystickSetup.cs +++ b/Tools/ArdupilotMegaPlanner/JoystickSetup.cs @@ -162,11 +162,11 @@ namespace ArdupilotMega rc.chan7_raw = 0; rc.chan8_raw = 0; - MainV2.comPort.generatePacket(MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, rc); + MainV2.comPort.sendPacket(rc); System.Threading.Thread.Sleep(20); - MainV2.comPort.generatePacket(MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, rc); + MainV2.comPort.sendPacket(rc); System.Threading.Thread.Sleep(20); - MainV2.comPort.generatePacket(MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, rc); + MainV2.comPort.sendPacket(rc); //timer1.Stop(); MainV2.joystick.enabled = false; diff --git a/Tools/ArdupilotMegaPlanner/MAVLink.cs b/Tools/ArdupilotMegaPlanner/MAVLink.cs index 3c539fbd23..fdfeeae1f7 100644 --- a/Tools/ArdupilotMegaPlanner/MAVLink.cs +++ b/Tools/ArdupilotMegaPlanner/MAVLink.cs @@ -198,7 +198,7 @@ namespace ArdupilotMega } } - frm.Controls[0].Text = "Getting Params.. (sysid " + sysid + " compid "+compid+") "; + frm.Controls[0].Text = "Getting Params.. (sysid " + sysid + " compid " + compid + ") "; frm.Refresh(); if (getparams == true) getParamList(); @@ -214,7 +214,7 @@ namespace ArdupilotMega packetslost = 0; } - public static byte[] StructureToByteArrayEndian(params object[] list) + byte[] StructureToByteArrayEndian(params object[] list) { // The copy is made becuase SetValue won't work on a struct. // Boxing was used because SetValue works on classes/objects. @@ -346,12 +346,26 @@ namespace ArdupilotMega } } + public void sendPacket(object indata) + { + byte a = 0; + foreach (Type ty in mavstructs) + { + if (ty == indata.GetType()) + { + generatePacket(a, indata); + return; + } + a++; + } + } + /// /// Generate a Mavlink Packet and write to serial /// /// type number /// struct of data - public void generatePacket(byte messageType, object indata) + void generatePacket(byte messageType, object indata) { byte[] data; @@ -378,7 +392,11 @@ namespace ArdupilotMega packet[1] = (byte)data.Length; packet[2] = packetcount; packet[3] = 255; // this is always 255 - MYGCS - packet[4] = (byte)MAV_COMPONENT.MAV_COMP_ID_WAYPOINTPLANNER; +#if MAVLINK10 + packet[4] = (byte)MAV_COMPONENT.MAV_COMP_ID_MISSIONPLANNER; +#else + packet[4] = (byte)MAV_COMPONENT.MAV_COMP_ID_WAYPOINTPLANNER; +#endif packet[5] = messageType; int i = 6; @@ -470,9 +488,11 @@ namespace ArdupilotMega byte[] temp = ASCIIEncoding.ASCII.GetBytes(paramname); modifyParamForDisplay(false, paramname, ref value); - - Array.Resize(ref temp, 15); - +#if MAVLINK10 + Array.Resize(ref temp, 16); +#else +Array.Resize(ref temp, 15); +#endif req.param_id = temp; req.param_value = (value); @@ -523,7 +543,7 @@ namespace ArdupilotMega if (st != paramname) { - Console.WriteLine("MAVLINK bad param responce - {0} vs {1}",paramname,st); + Console.WriteLine("MAVLINK bad param responce - {0} vs {1}", paramname, st); continue; } @@ -539,12 +559,6 @@ namespace ArdupilotMega } } - public struct _param - { - public string name; - public float value; - } - /// /// Get param list from apm /// @@ -593,6 +607,7 @@ namespace ArdupilotMega generatePacket(MAVLINK_MSG_ID_PARAM_REQUEST_READ, rereq); restart = DateTime.Now; } + System.Windows.Forms.Application.DoEvents(); byte[] buffer = readPacket(); if (buffer.Length > 5) @@ -614,8 +629,6 @@ namespace ArdupilotMega z = (par.param_count); - Console.WriteLine(DateTime.Now.Millisecond + " got param " + (par.param_index) + " of " + (z - 1)); - if (nextid == (par.param_index)) { nextid++; @@ -644,6 +657,8 @@ namespace ArdupilotMega st = st.Substring(0, pos); } + Console.WriteLine(DateTime.Now.Millisecond + " got param " + (par.param_index) + " of " + (z - 1) + " name: " + st); + modifyParamForDisplay(true, st, ref par.param_value); param[st] = (par.param_value); @@ -668,7 +683,8 @@ namespace ArdupilotMega || paramname.ToUpper().EndsWith("XTRK_ANGLE_CD") || paramname.ToUpper().EndsWith("LIM_PITCH_MAX") || paramname.ToUpper().EndsWith("LIM_PITCH_MIN") || paramname.ToUpper().EndsWith("LIM_ROLL_CD") || paramname.ToUpper().EndsWith("PITCH_MAX") || paramname.ToUpper().EndsWith("WP_SPEED_MAX")) { - if (paramname.ToUpper().EndsWith("THR_HOLD_IMAX")) { + if (paramname.ToUpper().EndsWith("THR_HOLD_IMAX")) + { return; } @@ -721,16 +737,138 @@ namespace ArdupilotMega public void setWPACK() { +#if MAVLINK10 + MAVLink.__mavlink_mission_ack_t req = new MAVLink.__mavlink_mission_ack_t(); + req.target_system = sysid; + req.target_component = compid; + req.type = 0; + + generatePacket(MAVLINK_MSG_ID_MISSION_ACK, req); +#else MAVLink.__mavlink_waypoint_ack_t req = new MAVLink.__mavlink_waypoint_ack_t(); req.target_system = sysid; req.target_component = compid; req.type = 0; - generatePacket(MAVLINK_MSG_ID_WAYPOINT_ACK, req); + generatePacket(MAVLINK_MSG_ID_WAYPOINT_ACK, req); +#endif } public bool setWPCurrent(ushort index) { +#if MAVLINK10 + MainV2.givecomport = true; + byte[] buffer; + + __mavlink_mission_set_current_t req = new __mavlink_mission_set_current_t(); + + req.target_system = sysid; + req.target_component = compid; + req.seq = index; + + generatePacket(MAVLINK_MSG_ID_MISSION_SET_CURRENT, req); + + DateTime start = DateTime.Now; + int retrys = 5; + + while (true) + { + if (!(start.AddMilliseconds(2000) > DateTime.Now)) + { + if (retrys > 0) + { + Console.WriteLine("setWPCurrent Retry " + retrys); + generatePacket(MAVLINK_MSG_ID_MISSION_SET_CURRENT, req); + start = DateTime.Now; + retrys--; + continue; + } + MainV2.givecomport = false; + throw new Exception("Timeout on read - setWPCurrent"); + } + + buffer = readPacket(); + if (buffer.Length > 5) + { + if (buffer[5] == MAVLINK_MSG_ID_MISSION_CURRENT) + { + MainV2.givecomport = false; + return true; + } + } + } + } + + public bool doCommand(MAV_CMD actionid) + { + + MainV2.givecomport = true; + byte[] buffer; + + __mavlink_command_long_t req = new __mavlink_command_long_t(); + + req.target_system = sysid; + req.target_component = compid; + + req.command = (ushort)actionid; + + generatePacket(MAVLINK_MSG_ID_COMMAND_LONG, req); + + DateTime start = DateTime.Now; + int retrys = 3; + + int timeout = 2000; + + // imu calib take a little while + if (actionid == MAV_CMD.PREFLIGHT_CALIBRATION) + { + retrys = 1; + timeout = 6000; + } + + while (true) + { + if (!(start.AddMilliseconds(timeout) > DateTime.Now)) + { + if (retrys > 0) + { + Console.WriteLine("doAction Retry " + retrys); + generatePacket(MAVLINK_MSG_ID_COMMAND_LONG, req); + start = DateTime.Now; + retrys--; + continue; + } + MainV2.givecomport = false; + throw new Exception("Timeout on read - doAction"); + } + + buffer = readPacket(); + if (buffer.Length > 5) + { + if (buffer[5] == MAVLINK_MSG_ID_COMMAND_ACK) + { + __mavlink_command_ack_t ack = new __mavlink_command_ack_t(); + + object temp = (object)ack; + + ByteArrayToStructure(buffer, ref temp, 6); + + ack = (__mavlink_command_ack_t)(temp); + + if (ack.result == (byte)MAV_RESULT.MAV_RESULT_ACCEPTED) + { + MainV2.givecomport = false; + return true; + } + else + { + MainV2.givecomport = false; + return false; + } + } + } + } +#else MainV2.givecomport = true; byte[] buffer; @@ -837,6 +975,8 @@ namespace ArdupilotMega } } } + +#endif } public void requestDatastream(byte id, byte hzrate) @@ -983,6 +1123,60 @@ namespace ArdupilotMega { MainV2.givecomport = true; byte[] buffer; +#if MAVLINK10 + __mavlink_mission_request_list_t req = new __mavlink_mission_request_list_t(); + + req.target_system = sysid; + req.target_component = compid; + + // request list + generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST_LIST, req); + + DateTime start = DateTime.Now; + int retrys = 6; + + while (true) + { + if (!(start.AddMilliseconds(500) > DateTime.Now)) + { + if (retrys > 0) + { + Console.WriteLine("getWPCount Retry " + retrys + " - giv com " + MainV2.givecomport); + generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST_LIST, req); + start = DateTime.Now; + retrys--; + continue; + } + MainV2.givecomport = false; + //return (byte)int.Parse(param["WP_TOTAL"].ToString()); + throw new Exception("Timeout on read - getWPCount"); + } + + buffer = readPacket(); + if (buffer.Length > 5) + { + if (buffer[5] == MAVLINK_MSG_ID_MISSION_COUNT) + { + __mavlink_mission_count_t count = new __mavlink_mission_count_t(); + + object temp = (object)count; + + ByteArrayToStructure(buffer, ref temp, 6); + + count = (__mavlink_mission_count_t)(temp); + + + Console.WriteLine("wpcount: " + count.count); + MainV2.givecomport = false; + return (byte)count.count; // should be ushort, but apm has limited wp count < byte + } + else + { + Console.WriteLine(DateTime.Now + " PC wpcount " + buffer[5] + " need " + MAVLINK_MSG_ID_MISSION_COUNT + " " + this.BaseStream.BytesToRead); + } + } + } + #else __mavlink_waypoint_request_list_t req = new __mavlink_waypoint_request_list_t(); @@ -1028,6 +1222,8 @@ namespace ArdupilotMega } } } + + #endif } /// /// Gets specfied WP @@ -1038,6 +1234,56 @@ namespace ArdupilotMega { MainV2.givecomport = true; Locationwp loc = new Locationwp(); +#if MAVLINK10 + __mavlink_mission_request_t req = new __mavlink_mission_request_t(); + + req.target_system = sysid; + req.target_component = compid; + + req.seq = index; + + //Console.WriteLine("getwp req "+ DateTime.Now.Millisecond); + + // request + generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST, req); + + DateTime start = DateTime.Now; + int retrys = 5; + + while (true) + { + if (!(start.AddMilliseconds(800) > DateTime.Now)) // apm times out after 1000ms + { + if (retrys > 0) + { + Console.WriteLine("getWP Retry " + retrys); + generatePacket(MAVLINK_MSG_ID_MISSION_REQUEST, req); + start = DateTime.Now; + retrys--; + continue; + } + MainV2.givecomport = false; + throw new Exception("Timeout on read - getWP"); + } + //Console.WriteLine("getwp read " + DateTime.Now.Millisecond); + byte[] buffer = readPacket(); + //Console.WriteLine("getwp readend " + DateTime.Now.Millisecond); + if (buffer.Length > 5) + { + if (buffer[5] == MAVLINK_MSG_ID_MISSION_ITEM) + { + //Console.WriteLine("getwp ans " + DateTime.Now.Millisecond); + __mavlink_mission_item_t wp = new __mavlink_mission_item_t(); + + object temp = (object)wp; + + //Array.Copy(buffer, 6, buffer, 0, buffer.Length - 6); + + ByteArrayToStructure(buffer, ref temp, 6); + + wp = (__mavlink_mission_item_t)(temp); + +#else __mavlink_waypoint_request_t req = new __mavlink_waypoint_request_t(); @@ -1087,6 +1333,8 @@ namespace ArdupilotMega wp = (__mavlink_waypoint_t)(temp); +#endif + loc.options = (byte)(wp.frame & 0x1); loc.id = (byte)(wp.command); loc.p1 = (byte)(wp.param1); @@ -1108,7 +1356,7 @@ namespace ArdupilotMega case (byte)MAV_CMD.LOITER_TURNS: case (byte)MAV_CMD.TAKEOFF: case (byte)MAV_CMD.DO_SET_HOME: - case (byte)MAV_CMD.DO_SET_ROI: + //case (byte)MAV_CMD.DO_SET_ROI: loc.alt = (int)((wp.z) * 100); loc.lat = (int)((wp.x) * 10000000); loc.lng = (int)((wp.y) * 10000000); @@ -1254,6 +1502,65 @@ namespace ArdupilotMega /// public void setWPTotal(ushort wp_total) { +#if MAVLINK10 + MainV2.givecomport = true; + __mavlink_mission_count_t req = new __mavlink_mission_count_t(); + + req.target_system = sysid; + req.target_component = compid; // MAVLINK_MSG_ID_MISSION_COUNT + + req.count = wp_total; + + generatePacket(MAVLINK_MSG_ID_MISSION_COUNT, req); + + DateTime start = DateTime.Now; + int retrys = 3; + + while (true) + { + if (!(start.AddMilliseconds(700) > DateTime.Now)) + { + if (retrys > 0) + { + Console.WriteLine("setWPTotal Retry " + retrys); + generatePacket(MAVLINK_MSG_ID_MISSION_COUNT, req); + start = DateTime.Now; + retrys--; + continue; + } + MainV2.givecomport = false; + throw new Exception("Timeout on read - setWPTotal"); + } + byte[] buffer = readPacket(); + if (buffer.Length > 9) + { + if (buffer[5] == MAVLINK_MSG_ID_MISSION_REQUEST) + { + __mavlink_mission_request_t request = new __mavlink_mission_request_t(); + + object temp = (object)request; + + ByteArrayToStructure(buffer, ref temp, 6); + + request = (__mavlink_mission_request_t)(temp); + + if (request.seq == 0) + { + if (param["WP_TOTAL"] != null) + param["WP_TOTAL"] = (float)wp_total - 1; + if (param["CMD_TOTAL"] != null) + param["CMD_TOTAL"] = (float)wp_total - 1; + MainV2.givecomport = false; + return; + } + } + else + { + //Console.WriteLine(DateTime.Now + " PC getwp " + buffer[5]); + } + } + } +#else MainV2.givecomport = true; __mavlink_waypoint_count_t req = new __mavlink_waypoint_count_t(); @@ -1285,12 +1592,25 @@ namespace ArdupilotMega byte[] buffer = readPacket(); if (buffer.Length > 9) { - if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_REQUEST && buffer[9] == 0) + if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_REQUEST) { - param["WP_TOTAL"] = (float)wp_total - 1; - param["CMD_TOTAL"] = (float)wp_total - 1; - MainV2.givecomport = false; - return; + __mavlink_waypoint_request_t request = new __mavlink_waypoint_request_t(); + + object temp = (object)request; + + ByteArrayToStructure(buffer, ref temp, 6); + + request = (__mavlink_waypoint_request_t)(temp); + + if (request.seq == 0) + { + if (param["WP_TOTAL"] != null) + param["WP_TOTAL"] = (float)wp_total - 1; + if (param["CMD_TOTAL"] != null) + param["CMD_TOTAL"] = (float)wp_total - 1; + MainV2.givecomport = false; + return; + } } else { @@ -1298,6 +1618,8 @@ namespace ArdupilotMega } } } + +#endif } /// @@ -1310,10 +1632,14 @@ namespace ArdupilotMega public void setWP(Locationwp loc, ushort index, MAV_FRAME frame, byte current) { MainV2.givecomport = true; - __mavlink_waypoint_t req = new __mavlink_waypoint_t(); + #if MAVLINK10 + __mavlink_mission_item_t req = new __mavlink_mission_item_t(); + #else + __mavlink_waypoint_t req = new __mavlink_waypoint_t(); + #endif req.target_system = sysid; - req.target_component = compid; // MAVLINK_MSG_ID_WAYPOINT + req.target_component = compid; // MAVLINK_MSG_ID_MISSION_ITEM req.command = loc.id; req.param1 = loc.p1; @@ -1390,7 +1716,11 @@ namespace ArdupilotMega Console.WriteLine("setWP {6} frame {0} cmd {1} p1 {2} x {3} y {4} z {5}", req.frame, req.command, req.param1, req.x, req.y, req.z, index); // request - generatePacket(MAVLINK_MSG_ID_WAYPOINT, req); + #if MAVLINK10 + generatePacket(MAVLINK_MSG_ID_MISSION_ITEM, req); + #else + generatePacket(MAVLINK_MSG_ID_WAYPOINT, req); + #endif DateTime start = DateTime.Now; int retrys = 6; @@ -1402,7 +1732,11 @@ namespace ArdupilotMega if (retrys > 0) { Console.WriteLine("setWP Retry " + retrys); - generatePacket(MAVLINK_MSG_ID_WAYPOINT, req); + #if MAVLINK10 + generatePacket(MAVLINK_MSG_ID_MISSION_ITEM, req); + #else + generatePacket(MAVLINK_MSG_ID_WAYPOINT, req); + #endif start = DateTime.Now; retrys--; continue; @@ -1413,7 +1747,48 @@ namespace ArdupilotMega byte[] buffer = readPacket(); if (buffer.Length > 5) { - if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_ACK) + #if MAVLINK10 + if (buffer[5] == MAVLINK_MSG_ID_MISSION_ACK) + { + __mavlink_mission_ack_t ans = new __mavlink_mission_ack_t(); + + object temp = (object)ans; + + ByteArrayToStructure(buffer, ref temp, 6); + + ans = (__mavlink_mission_ack_t)(temp); + + Console.WriteLine("set wp " + index + " ACK 47 : " + buffer[5] + " ans " + Enum.Parse(typeof(MAV_MISSION_RESULT), ans.type.ToString())); + break; + } + else if (buffer[5] == MAVLINK_MSG_ID_MISSION_REQUEST) + { + __mavlink_mission_request_t ans = new __mavlink_mission_request_t(); + + object temp = (object)ans; + + ByteArrayToStructure(buffer, ref temp, 6); + + ans = (__mavlink_mission_request_t)(temp); + + if (ans.seq == (index + 1)) + { + Console.WriteLine("set wp doing " + index + " req " + ans.seq + " REQ 40 : " + buffer[5]); + MainV2.givecomport = false; + break; + } + else + { + Console.WriteLine("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; + } + } + else + { + //Console.WriteLine(DateTime.Now + " PC setwp " + buffer[5]); + } + #else + if (buffer[5] == MAVLINK_MSG_ID_WAYPOINT_ACK) { //__mavlink_waypoint_request_t Console.WriteLine("set wp " + index + " ACK 47 : " + buffer[5]); break; @@ -1446,11 +1821,12 @@ namespace ArdupilotMega { //Console.WriteLine(DateTime.Now + " PC setwp " + buffer[5]); } + #endif } } } - public void setMountConfigure(MAV_MOUNT_MODE mountmode,bool stabroll,bool stabpitch,bool stabyaw) + public void setMountConfigure(MAV_MOUNT_MODE mountmode, bool stabroll, bool stabpitch, bool stabyaw) { __mavlink_mount_configure_t req = new __mavlink_mount_configure_t(); @@ -1466,7 +1842,7 @@ namespace ArdupilotMega generatePacket(MAVLINK_MSG_ID_MOUNT_CONFIGURE, req); } - public void setMountControl(double pa,double pb,double pc,bool islatlng) + public void setMountControl(double pa, double pb, double pc, bool islatlng) { __mavlink_mount_control_t req = new __mavlink_mount_control_t(); @@ -1492,6 +1868,20 @@ namespace ArdupilotMega public void setMode(string modein) { +#if MAVLINK10 + try + { + MAVLink.__mavlink_set_mode_t mode = new MAVLink.__mavlink_set_mode_t(); + + if (Common.translateMode(modein, ref mode)) + { + MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); + System.Threading.Thread.Sleep(10); + MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode); + } + } + catch { System.Windows.Forms.MessageBox.Show("Failed to change Modes"); } +#else try { MAVLink.__mavlink_set_nav_mode_t navmode = new MAVLink.__mavlink_set_nav_mode_t(); @@ -1510,6 +1900,8 @@ namespace ArdupilotMega } } catch { System.Windows.Forms.MessageBox.Show("Failed to change Modes"); } + +#endif } /// @@ -1661,7 +2053,7 @@ namespace ArdupilotMega if (bpstime.Second != DateTime.Now.Second && !logreadmode) { - Console.WriteLine("bps {0} loss {1} left {2} mem {3}", bps1, synclost, BaseStream.BytesToRead,System.GC.GetTotalMemory(false)); + Console.WriteLine("bps {0} loss {1} left {2} mem {3}", bps1, synclost, BaseStream.BytesToRead, System.GC.GetTotalMemory(false)); bps2 = bps1; // prev sec bps1 = 0; // current sec bpstime = DateTime.Now; @@ -1683,6 +2075,12 @@ namespace ArdupilotMega crc = crc_accumulate(MAVLINK_MESSAGE_CRCS[temp[5]], crc); } + if (temp.Length > 5 && temp[1] != MAVLINK_MESSAGE_LENGTHS[temp[5]]) + { + Console.WriteLine("Mavlink Bad Packet (Len Fail) len {0} pkno {1}", temp.Length, temp[5]); + return new byte[0]; + } + if (temp.Length < 5 || temp[temp.Length - 1] != (crc >> 8) || temp[temp.Length - 2] != (crc & 0xff)) { int packetno = 0; @@ -1743,12 +2141,31 @@ namespace ArdupilotMega if (temp[5] == MAVLink.MAVLINK_MSG_ID_STATUSTEXT) // status text { - string logdata = DateTime.Now.Millisecond + " " + Encoding.ASCII.GetString(temp, 6, temp.Length - 6); + string logdata = DateTime.Now + " " + Encoding.ASCII.GetString(temp, 6, temp.Length - 6); int ind = logdata.IndexOf('\0'); if (ind != -1) logdata = logdata.Substring(0, ind); Console.WriteLine(logdata); } +#if MAVLINK10 + if (temp[5] == MAVLINK_MSG_ID_MISSION_COUNT) + { + // clear old + wps = new PointLatLngAlt[wps.Length]; + } + + if (temp[5] == MAVLink.MAVLINK_MSG_ID_MISSION_ITEM) + { + __mavlink_mission_item_t wp = new __mavlink_mission_item_t(); + + object structtemp = (object)wp; + + //Array.Copy(buffer, 6, buffer, 0, buffer.Length - 6); + + ByteArrayToStructure(temp, ref structtemp, 6); + + wp = (__mavlink_mission_item_t)(structtemp); +#else if (temp[5] == MAVLINK_MSG_ID_WAYPOINT_COUNT) { @@ -1768,7 +2185,8 @@ namespace ArdupilotMega wp = (__mavlink_waypoint_t)(structtemp); - wps[wp.seq] = new PointLatLngAlt(wp.x,wp.y,wp.z,wp.seq.ToString()); +#endif + wps[wp.seq] = new PointLatLngAlt(wp.x, wp.y, wp.z, wp.seq.ToString()); } try @@ -1873,7 +2291,7 @@ namespace ArdupilotMega while (a < length) { temp[a] = (byte)logplaybackfile.ReadByte(); - if (temp[0] != 'U') + if (temp[0] != 'U' && temp[0] != 254) { Console.WriteLine("lost sync byte {0} pos {1}", temp[0], logplaybackfile.BaseStream.Position); a = 0; @@ -1927,7 +2345,7 @@ namespace ArdupilotMega } - public static byte[] StructureToByteArray(object obj) + byte[] StructureToByteArray(object obj) { int len = Marshal.SizeOf(obj); diff --git a/Tools/ArdupilotMegaPlanner/MAVLinkTypes.cs b/Tools/ArdupilotMegaPlanner/MAVLinkTypes.cs index 9d16f0c04d..3001bb8d4f 100644 --- a/Tools/ArdupilotMegaPlanner/MAVLinkTypes.cs +++ b/Tools/ArdupilotMegaPlanner/MAVLinkTypes.cs @@ -5,10 +5,12 @@ using System.Runtime.InteropServices; namespace ArdupilotMega { +#if MAVLINK10 partial class MAVLink { - 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[] {9, 31, 12, 0, 14, 28, 3, 32, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 25, 23, 30, 101, 22, 26, 16, 14, 28, 32, 28, 28, 22, 22, 21, 6, 6, 37, 4, 4, 2, 2, 4, 2, 2, 3, 13, 12, 19, 17, 15, 15, 27, 25, 18, 18, 20, 20, 0, 0, 26, 0, 36, 0, 6, 4, 0, 21, 18, 0, 0, 0, 20, 0, 33, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 42, 33, 0, 0, 0, 0, 0, 0, 0, 18, 32, 32, 20, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 36, 30, 18, 18, 51, 9, 3}; + public byte[] MAVLINK_MESSAGE_CRCS = new byte[] {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 214, 223, 141, 33, 15, 3, 100, 24, 239, 238, 0, 0, 183, 0, 130, 0, 148, 21, 0, 52, 124, 0, 0, 0, 20, 0, 152, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 63, 54, 0, 0, 0, 0, 0, 0, 0, 19, 102, 158, 208, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 219, 208, 188, 84, 22, 19, 21, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 49, 170, 44, 83, 46, 247}; public enum MAV_MOUNT_MODE { MAV_MOUNT_MODE_RETRACT=0, /* Load and keep safe position (Roll,Pitch,Yaw) from EEPROM and stop stabilization | */ @@ -19,154 +21,19 @@ 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| */ - LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time |Empty| Empty| Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ - LOITER_TURNS=18, /* Loiter around this waypoint for X turns |Turns| Empty| Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ - LOITER_TIME=19, /* Loiter around this waypoint for X seconds |Seconds (decimal)| Empty| Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + WAYPOINT=16, /* 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| */ + LOITER_UNLIM=17, /* 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| */ + LOITER_TURNS=18, /* 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| */ + LOITER_TIME=19, /* 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| */ RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ LAND=21, /* Land at location |Empty| Empty| Empty| Desired yaw angle.| Latitude| Longitude| Altitude| */ TAKEOFF=22, /* 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| */ ROI=80, /* 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)| Waypoint 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| */ + 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| */ PATHPLANNING=81, /* 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| */ LAST=95, /* 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| */ CONDITION_DELAY=112, /* Delay mission state machine. |Delay in seconds (decimal)| Empty| Empty| Empty| Empty| Empty| Empty| */ @@ -183,20 +50,289 @@ namespace ArdupilotMega DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cyles with a desired period. |Relay number| Cycle count| Cycle time (seconds, decimal)| Empty| Empty| Empty| Empty| */ DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Empty| Empty| Empty| Empty| Empty| */ DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Cycle count| Cycle time (seconds)| Empty| Empty| Empty| */ - DO_CONTROL_VIDEO=200, /* Control onboard camera capturing. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds (decimal)| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ - DO_SET_ROI=201, /* 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 - devices such as cameras. - |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_CONTROL_VIDEO=200, /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds (decimal)| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ 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| */ + PREFLIGHT_SET_SENSOR_OFFSETS=242, /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Reserved| Reserved| Empty| Empty| Empty| */ - ENUM_END=246, /* | */ + PREFLIGHT_REBOOT_SHUTDOWN=246, /* Request the reboot or shutdown of system components. |0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot.| 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer.| Reserved| Reserved| Empty| Empty| Empty| */ + OVERRIDE_GOTO=252, /* Hold / continue the current action |MAV_GOTO_DO_HOLD: hold MAV_GOTO_DO_CONTINUE: continue with next item in mission plan| MAV_GOTO_HOLD_AT_CURRENT_POSITION: Hold at current position MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position| MAV_FRAME coordinate frame of hold point| Desired yaw angle in degrees| Latitude / X position| Longitude / Y position| Altitude / Z position| */ + MISSION_START=300, /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| */ + ENUM_END=301, /* | */ + }; + + 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 float extra_value; /// Correspondent value to given extra_param + public ushort shutter_speed; /// Divisor number //e.g. 1000 means 1/1000 (0 means ignore) + 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 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 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 float extra_value; /// Correspondent value to given extra_param + 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 const byte MAVLINK_MSG_ID_DIGICAM_CONTROL_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_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 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 target_system; /// System ID + public byte target_component; /// Component ID + 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 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 byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + 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 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 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_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 short mag_ofs_x; /// magnetometer X offset + public short mag_ofs_y; /// magnetometer Y offset + public short mag_ofs_z; /// magnetometer Z offset + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + public const byte MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN = 8; + 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, /* | */ + }; + + public enum MAV_MODE_FLAG_DECODE_POSITION + { + MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE=1, /* Eighth bit: 00000001 | */ + MAV_MODE_FLAG_DECODE_POSITION_TEST=2, /* Seventh bit: 00000010 | */ + MAV_MODE_FLAG_DECODE_POSITION_AUTO=4, /* Sixt bit: 00000100 | */ + MAV_MODE_FLAG_DECODE_POSITION_GUIDED=8, /* Fifth bit: 00001000 | */ + MAV_MODE_FLAG_DECODE_POSITION_STABILIZE=16, /* Fourth bit: 00010000 | */ + MAV_MODE_FLAG_DECODE_POSITION_HIL=32, /* Third bit: 00100000 | */ + MAV_MODE_FLAG_DECODE_POSITION_MANUAL=64, /* Second bit: 01000000 | */ + MAV_MODE_FLAG_DECODE_POSITION_SAFETY=128, /* First bit: 10000000 | */ + MAV_MODE_FLAG_DECODE_POSITION_ENUM_END=129, /* | */ + }; + + public enum MAV_GOTO + { + MAV_GOTO_DO_HOLD=0, /* Hold at the current position. | */ + MAV_GOTO_DO_CONTINUE=1, /* Continue with the next item in mission execution. | */ + MAV_GOTO_HOLD_AT_CURRENT_POSITION=2, /* Hold at the current position of the system | */ + MAV_GOTO_HOLD_AT_SPECIFIED_POSITION=3, /* Hold at the position specified in the parameters of the DO_HOLD action | */ + MAV_GOTO_ENUM_END=4, /* | */ + }; + + public enum MAV_MODE + { + MAV_MODE_PREFLIGHT=0, /* System is not ready to fly, booting, calibrating, etc. No flag is set. | */ + MAV_MODE_MANUAL_DISARMED=64, /* System is allowed to be active, under manual (RC) control, no stabilization | */ + MAV_MODE_TEST_DISARMED=66, /* UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. | */ + MAV_MODE_STABILIZE_DISARMED=80, /* System is allowed to be active, under assisted RC control. | */ + MAV_MODE_GUIDED_DISARMED=88, /* System is allowed to be active, under autonomous control, manual setpoint | */ + MAV_MODE_AUTO_DISARMED=92, /* System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by MISSIONs) | */ + MAV_MODE_MANUAL_ARMED=192, /* System is allowed to be active, under manual (RC) control, no stabilization | */ + MAV_MODE_TEST_ARMED=194, /* UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. | */ + MAV_MODE_STABILIZE_ARMED=208, /* System is allowed to be active, under assisted RC control. | */ + MAV_MODE_GUIDED_ARMED=216, /* System is allowed to be active, under autonomous control, manual setpoint | */ + MAV_MODE_AUTO_ARMED=220, /* System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by MISSIONs) | */ + MAV_MODE_ENUM_END=221, /* | */ + }; + + public enum MAV_STATE + { + MAV_STATE_UNINIT=0, /* Uninitialized system, state is unknown. | */ + MAV_STATE_BOOT=1, /* System is booting up. | */ + MAV_STATE_CALIBRATING=2, /* System is calibrating and not flight-ready. | */ + MAV_STATE_STANDBY=3, /* System is grounded and on standby. It can be launched any time. | */ + MAV_STATE_ACTIVE=4, /* System is active and might be already airborne. Motors are engaged. | */ + MAV_STATE_CRITICAL=5, /* System is in a non-normal flight mode. It can however still navigate. | */ + MAV_STATE_EMERGENCY=6, /* 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. | */ + MAV_STATE_POWEROFF=7, /* System just initialized its power-down sequence, will shut down now. | */ + MAV_STATE_ENUM_END=8, /* | */ + }; + + public enum MAV_TYPE + { + MAV_TYPE_GENERIC=0, /* Generic micro air vehicle. | */ + MAV_TYPE_FIXED_WING=1, /* Fixed wing aircraft. | */ + MAV_TYPE_QUADROTOR=2, /* Quadrotor | */ + MAV_TYPE_COAXIAL=3, /* Coaxial helicopter | */ + MAV_TYPE_HELICOPTER=4, /* Normal helicopter with tail rotor. | */ + MAV_TYPE_ANTENNA_TRACKER=5, /* Ground installation | */ + MAV_TYPE_GCS=6, /* Operator control unit / ground control station | */ + MAV_TYPE_AIRSHIP=7, /* Airship, controlled | */ + MAV_TYPE_FREE_BALLOON=8, /* Free balloon, uncontrolled | */ + MAV_TYPE_ROCKET=9, /* Rocket | */ + MAV_TYPE_GROUND_ROVER=10, /* Ground rover | */ + MAV_TYPE_SURFACE_BOAT=11, /* Surface vessel, boat, ship | */ + MAV_TYPE_SUBMARINE=12, /* Submarine | */ + MAV_TYPE_HEXAROTOR=13, /* Hexarotor | */ + MAV_TYPE_OCTOROTOR=14, /* Octorotor | */ + MAV_TYPE_TRICOPTER=15, /* Octorotor | */ + MAV_TYPE_FLAPPING_WING=16, /* Flapping wing | */ + MAV_TYPE_ENUM_END=17, /* | */ + }; + + public enum MAV_COMPONENT + { + MAV_COMP_ID_ALL=0, /* | */ + MAV_COMP_ID_CAMERA=100, /* | */ + MAV_COMP_ID_SERVO1=140, /* | */ + MAV_COMP_ID_SERVO2=141, /* | */ + MAV_COMP_ID_SERVO3=142, /* | */ + MAV_COMP_ID_SERVO4=143, /* | */ + MAV_COMP_ID_SERVO5=144, /* | */ + MAV_COMP_ID_SERVO6=145, /* | */ + MAV_COMP_ID_SERVO7=146, /* | */ + MAV_COMP_ID_SERVO8=147, /* | */ + MAV_COMP_ID_SERVO9=148, /* | */ + MAV_COMP_ID_SERVO10=149, /* | */ + MAV_COMP_ID_SERVO11=150, /* | */ + MAV_COMP_ID_SERVO12=151, /* | */ + MAV_COMP_ID_SERVO13=152, /* | */ + MAV_COMP_ID_SERVO14=153, /* | */ + MAV_COMP_ID_MAPPER=180, /* | */ + MAV_COMP_ID_MISSIONPLANNER=190, /* | */ + MAV_COMP_ID_PATHPLANNER=195, /* | */ + MAV_COMP_ID_IMU=200, /* | */ + MAV_COMP_ID_IMU_2=201, /* | */ + MAV_COMP_ID_IMU_3=202, /* | */ + MAV_COMP_ID_GPS=220, /* | */ + MAV_COMP_ID_UDP_BRIDGE=240, /* | */ + MAV_COMP_ID_UART_BRIDGE=241, /* | */ + MAV_COMP_ID_SYSTEM_CONTROL=250, /* | */ + MAV_COMPONENT_ENUM_END=251, /* | */ + }; + + public enum MAV_FRAME + { + MAV_FRAME_GLOBAL=0, /* Global coordinate frame, WGS84 coordinate system. First value / x: latitude, second value / y: longitude, third value / z: positive altitude over mean sea level (MSL) | */ + MAV_FRAME_LOCAL_NED=1, /* Local coordinate frame, Z-up (x: north, y: east, z: down). | */ + MAV_FRAME_MISSION=2, /* NOT a coordinate frame, indicates a mission command. | */ + MAV_FRAME_GLOBAL_RELATIVE_ALT=3, /* 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. | */ + MAV_FRAME_LOCAL_ENU=4, /* Local coordinate frame, Z-down (x: east, y: north, z: up) | */ + MAV_FRAME_ENUM_END=5, /* | */ }; public enum MAV_DATA_STREAM @@ -216,39 +352,74 @@ namespace ArdupilotMega public enum MAV_ROI { MAV_ROI_NONE=0, /* No region of interest. | */ - MAV_ROI_WPNEXT=1, /* Point toward next waypoint. | */ - MAV_ROI_WPINDEX=2, /* Point toward given waypoint. | */ + MAV_ROI_WPNEXT=1, /* Point toward next MISSION. | */ + MAV_ROI_WPINDEX=2, /* Point toward given MISSION. | */ MAV_ROI_LOCATION=3, /* Point toward fixed location. | */ MAV_ROI_TARGET=4, /* Point toward of given id. | */ MAV_ROI_ENUM_END=5, /* | */ }; - public const byte MAVLINK_MSG_ID_ACTION = 10; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_action_t + public enum ACK { - public byte target; /// The system executing the action - public byte target_component; /// The component executing the action - public byte action; /// The action id + ACK_OK=1, /* Command / mission item is ok. | */ + ACK_ERR_FAIL=2, /* Generic error message if none of the other reasons fails or if no detailed error reporting is implemented. | */ + ACK_ERR_ACCESS_DENIED=3, /* The system is refusing to accept this command from this source / communication partner. | */ + ACK_ERR_NOT_SUPPORTED=4, /* Command or mission item is not supported, other commands would be accepted. | */ + ACK_ERR_COORDINATE_FRAME_NOT_SUPPORTED=5, /* The coordinate frame of this command / mission item is not supported. | */ + ACK_ERR_COORDINATES_OUT_OF_RANGE=6, /* 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. | */ + ACK_ERR_X_LAT_OUT_OF_RANGE=7, /* The X or latitude value is out of range. | */ + ACK_ERR_Y_LON_OUT_OF_RANGE=8, /* The Y or longitude value is out of range. | */ + ACK_ERR_Z_ALT_OUT_OF_RANGE=9, /* The Z or altitude value is out of range. | */ + ACK_ENUM_END=10, /* | */ }; - 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 + public enum MAV_VAR { - public byte action; /// The action id - public byte result; /// 0: Action DENIED, 1: Action executed + MAV_VAR_FLOAT=0, /* 32 bit float | */ + MAV_VAR_UINT8=1, /* 8 bit unsigned integer | */ + MAV_VAR_INT8=2, /* 8 bit signed integer | */ + MAV_VAR_UINT16=3, /* 16 bit unsigned integer | */ + MAV_VAR_INT16=4, /* 16 bit signed integer | */ + MAV_VAR_UINT32=5, /* 32 bit unsigned integer | */ + MAV_VAR_INT32=6, /* 32 bit signed integer | */ + MAV_VAR_ENUM_END=7, /* | */ + }; + + public enum MAV_RESULT + { + MAV_RESULT_ACCEPTED=0, /* Command ACCEPTED and EXECUTED | */ + MAV_RESULT_TEMPORARILY_REJECTED=1, /* Command TEMPORARY REJECTED/DENIED | */ + MAV_RESULT_DENIED=2, /* Command PERMANENTLY DENIED | */ + MAV_RESULT_UNSUPPORTED=3, /* Command UNKNOWN/UNSUPPORTED | */ + MAV_RESULT_FAILED=4, /* Command executed, but failed | */ + MAV_RESULT_ENUM_END=5, /* | */ + }; + + public enum MAV_MISSION_RESULT + { + MAV_MISSION_ACCEPTED=0, /* mission accepted OK | */ + MAV_MISSION_ERROR=1, /* generic error / not accepting mission commands at all right now | */ + MAV_MISSION_UNSUPPORTED_FRAME=2, /* coordinate frame is not supported | */ + MAV_MISSION_UNSUPPORTED=3, /* command is not supported | */ + MAV_MISSION_NO_SPACE=4, /* mission item exceeds storage space | */ + MAV_MISSION_INVALID=5, /* one of the parameters has an invalid value | */ + MAV_MISSION_INVALID_PARAM1=6, /* param1 has an invalid value | */ + MAV_MISSION_INVALID_PARAM2=7, /* param2 has an invalid value | */ + MAV_MISSION_INVALID_PARAM3=8, /* param3 has an invalid value | */ + MAV_MISSION_INVALID_PARAM4=9, /* param4 has an invalid value | */ + MAV_MISSION_INVALID_PARAM5_X=10, /* x/param5 has an invalid value | */ + MAV_MISSION_INVALID_PARAM6_Y=11, /* y/param6 has an invalid value | */ + MAV_MISSION_INVALID_PARAM7=12, /* param7 has an invalid value | */ + MAV_MISSION_INVALID_SEQUENCE=13, /* received waypoint out of sequence | */ + MAV_MISSION_DENIED=14, /* not accepting any mission commands from this communication partner | */ + MAV_MISSION_RESULT_ENUM_END=15, /* | */ }; - 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 { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public uint time_boot_ms; /// Timestamp (milliseconds since system boot) public float roll; /// Roll angle (rad) public float pitch; /// Pitch angle (rad) public float yaw; /// Yaw angle (rad) @@ -257,34 +428,22 @@ namespace ArdupilotMega public float yawspeed; /// Yaw angular speed (rad/s) }; - 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; + public const byte MAVLINK_MSG_ID_ATTITUDE_LEN = 28; + public const byte MAVLINK_MSG_ID_ATTITUDE_QUATERNION = 31; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_attitude_controller_output_t + public struct __mavlink_attitude_quaternion_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_ATTITUDE_NEW = 30; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_attitude_new_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 uint time_boot_ms; /// Timestamp (milliseconds since system boot) + public float q1; /// Quaternion component 1 + public float q2; /// Quaternion component 2 + public float q3; /// Quaternion component 3 + public float q4; /// Quaternion component 4 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 const byte MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN = 32; public const byte MAVLINK_MSG_ID_AUTH_KEY = 7; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_auth_key_t @@ -292,20 +451,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 - { - public uint version; /// The onboard software version - }; - - 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 @@ -316,11 +465,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 @@ -331,186 +479,148 @@ 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; + public const byte MAVLINK_MSG_ID_COMMAND_ACK = 77; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_command_t + public struct __mavlink_command_ack_t + { + public ushort command; /// Command ID, as defined by MAV_CMD enum. + public byte result; /// See MAV_RESULT enum + }; + + public const byte MAVLINK_MSG_ID_COMMAND_ACK_LEN = 3; + public const byte MAVLINK_MSG_ID_COMMAND_LONG = 76; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_command_long_t { - public byte target_system; /// System which should execute the command - public byte target_component; /// Component which should execute the command, 0 for all components - public byte command; /// Command ID, as defined by MAV_CMD enum. - public byte confirmation; /// 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) public float param1; /// Parameter 1, as defined by MAV_CMD enum. public float param2; /// Parameter 2, as defined by MAV_CMD enum. public float param3; /// Parameter 3, as defined by MAV_CMD enum. public float param4; /// Parameter 4, as defined by MAV_CMD enum. + public float param5; /// Parameter 5, as defined by MAV_CMD enum. + public float param6; /// Parameter 6, as defined by MAV_CMD enum. + public float param7; /// Parameter 7, as defined by MAV_CMD enum. + public ushort command; /// Command ID, as defined by MAV_CMD enum. + public byte target_system; /// System which should execute the command + public byte target_component; /// Component which should execute the command, 0 for all components + public byte confirmation; /// 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) }; - 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; + public const byte MAVLINK_MSG_ID_COMMAND_LONG_LEN = 33; + public const byte MAVLINK_MSG_ID_DATA_STREAM = 67; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_command_ack_t + public struct __mavlink_data_stream_t { - public float command; /// Current airspeed in m/s - public float result; /// 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION + public ushort message_rate; /// The requested interval between two messages of this type + public byte stream_id; /// The ID of the requested data stream + public byte on_off; /// 1 stream is enabled, 0 stream is stopped. }; - 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 - { - public byte position_fix; /// Position fix: 0: lost, 2: 2D position fix, 3: 3D position fix - public byte vision_fix; /// Vision position fix: 0: lost, 1: 2D local position hold, 2: 2D global position fix, 3: 3D global position fix - public byte gps_fix; /// GPS position fix: 0: no reception, 1: Minimum 1 satellite, but no position fix, 2: 2D position fix, 3: 3D position fix - public byte ahrs_health; /// Attitude estimation health: 0: poor, 255: excellent - public byte control_att; /// 0: Attitude control disabled, 1: enabled - public byte control_pos_xy; /// 0: X, Y position control disabled, 1: enabled - public byte control_pos_z; /// 0: Z position control disabled, 1: enabled - public byte control_pos_yaw; /// 0: Yaw angle control disabled, 1: enabled - }; - - 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; + public const byte MAVLINK_MSG_ID_DATA_STREAM_LEN = 4; + public const byte MAVLINK_MSG_ID_DEBUG = 254; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_debug_t { - public byte ind; /// index of debug variable + public uint time_boot_ms; /// Timestamp (milliseconds since system boot) public float value; /// DEBUG value + public byte ind; /// index of debug variable }; - 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; + public const byte MAVLINK_MSG_ID_DEBUG_LEN = 9; + public const byte MAVLINK_MSG_ID_DEBUG_VECT = 250; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_debug_vect_t { - [MarshalAs( - UnmanagedType.ByValArray, - SizeConst=10)] - char name; /// Name - public ulong usec; /// Timestamp + public ulong time_usec; /// Timestamp public float x; /// x public float y; /// y public float z; /// z + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=10)] + public byte[] name; /// Name }; 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; + public const byte MAVLINK_MSG_ID_EXTENDED_MESSAGE = 255; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_full_state_t + public struct __mavlink_extended_message_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 byte target_system; /// System which should execute the command + public byte target_component; /// Component which should execute the command, 0 for all components + public byte protocol_flags; /// Retransmission / ACK flags }; - public const byte MAVLINK_MSG_ID_GLOBAL_POSITION = 33; - [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_global_position_t - { - public ulong usec; /// Timestamp (microseconds since unix epoch) - public float lat; /// Latitude, in degrees - public float lon; /// Longitude, in degrees - public float alt; /// Absolute altitude, in meters - public float vx; /// X Speed (in Latitude direction, positive: going north) - public float vy; /// Y Speed (in Longitude direction, positive: going east) - public float vz; /// Z Speed (in Altitude direction, positive: going up) - }; - - 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; + public const byte MAVLINK_MSG_ID_EXTENDED_MESSAGE_LEN = 3; + public const byte MAVLINK_MSG_ID_GLOBAL_POSITION_INT = 33; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_global_position_int_t { + public uint time_boot_ms; /// Timestamp (milliseconds since system boot) 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 int alt; /// Altitude in meters, expressed as * 1000 (millimeters), above MSL + public int relative_alt; /// Altitude above ground 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 ushort hdg; /// Compass heading in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 }; - 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; + public const byte MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN = 28; + public const byte MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT = 52; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_gps_local_origin_set_t + public struct __mavlink_global_position_setpoint_int_t + { + public int latitude; /// WGS84 Latitude position in degrees * 1E7 + public int longitude; /// WGS84 Longitude position in degrees * 1E7 + public int altitude; /// WGS84 Altitude in meters * 1000 (positive for up) + public short yaw; /// Desired yaw angle in degrees * 100 + public byte coordinate_frame; /// Coordinate frame - valid values are only MAV_FRAME_GLOBAL or MAV_FRAME_GLOBAL_RELATIVE_ALT + }; + + public const byte MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN = 15; + public const byte MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE = 101; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_global_vision_position_estimate_t + { + public ulong usec; /// Timestamp (milliseconds) + public float x; /// Global X position + public float y; /// Global Y position + public float z; /// Global Z position + public float roll; /// Roll angle in rad + public float pitch; /// Pitch angle in rad + public float yaw; /// Yaw angle in rad + }; + + public const byte MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_LEN = 32; + public const byte MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN = 49; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_gps_global_origin_t { public int latitude; /// Latitude (WGS84), expressed as * 1E7 public int longitude; /// Longitude (WGS84), expressed as * 1E7 public int altitude; /// Altitude(WGS84), expressed as * 1000 }; - 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 - { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) - public byte fix_type; /// 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. - public float lat; /// Latitude in degrees - public float lon; /// Longitude in degrees - public float alt; /// Altitude in meters - public float eph; /// GPS HDOP - public float epv; /// GPS VDOP - public float v; /// GPS ground speed - public float hdg; /// Compass heading in degrees, 0..360 degrees - }; - - 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; + public const byte MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN = 12; + public const byte MAVLINK_MSG_ID_GPS_RAW_INT = 24; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_gps_raw_int_t { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) - public byte fix_type; /// 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + public ulong time_usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) public int lat; /// Latitude in 1E7 degrees public int lon; /// Longitude in 1E7 degrees - public int alt; /// Altitude in 1E3 meters (millimeters) - public float eph; /// GPS HDOP - public float epv; /// GPS VDOP - public float v; /// GPS ground speed (m/s) - public float hdg; /// Compass heading in degrees, 0..360 degrees + public int alt; /// Altitude in 1E3 meters (millimeters) above MSL + public ushort eph; /// GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + public ushort epv; /// GPS VDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + public ushort vel; /// GPS ground speed (m/s * 100). If unknown, set to: 65535 + public ushort cog; /// Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 + public byte fix_type; /// 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + public byte satellites_visible; /// Number of satellites visible. If unknown, set to 255 }; - 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 - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public int latitude; /// global position * 1E7 - public int longitude; /// global position * 1E7 - public int altitude; /// global position * 1000 - }; - - 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; + public const byte MAVLINK_MSG_ID_GPS_RAW_INT_LEN = 30; + public const byte MAVLINK_MSG_ID_GPS_STATUS = 25; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_gps_status_t { @@ -538,38 +648,63 @@ 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 { + public uint custom_mode; /// Navigation mode bitfield, see MAV_AUTOPILOT_CUSTOM_MODE ENUM for some examples. This field is autopilot-specific. public byte type; /// Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) - public byte autopilot; /// Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + public byte autopilot; /// Autopilot type / class. defined in MAV_CLASS ENUM + public byte base_mode; /// System mode bitfield, see MAV_MODE_FLAGS ENUM in mavlink/include/mavlink_types.h + public byte system_status; /// System status flag, see MAV_STATUS ENUM public byte mavlink_version; /// MAVLink version }; - 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; + public const byte MAVLINK_MSG_ID_HEARTBEAT_LEN = 9; + public const byte MAVLINK_MSG_ID_HIL_CONTROLS = 91; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_hil_controls_t { - public ulong time_us; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) - public float roll_ailerons; /// Control output -3 .. 1 + public ulong time_usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public float roll_ailerons; /// Control output -1 .. 1 public float pitch_elevator; /// Control output -1 .. 1 public float yaw_rudder; /// Control output -1 .. 1 public float throttle; /// Throttle 0 .. 1 + public float aux1; /// Aux 1, -1 .. 1 + public float aux2; /// Aux 2, -1 .. 1 + public float aux3; /// Aux 3, -1 .. 1 + public float aux4; /// Aux 4, -1 .. 1 public byte mode; /// System mode (MAV_MODE) public byte nav_mode; /// Navigation mode (MAV_NAV_MODE) }; - 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; + public const byte MAVLINK_MSG_ID_HIL_CONTROLS_LEN = 42; + public const byte MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW = 92; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_hil_rc_inputs_raw_t + { + public ulong time_usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public ushort chan1_raw; /// RC channel 1 value, in microseconds + public ushort chan2_raw; /// RC channel 2 value, in microseconds + public ushort chan3_raw; /// RC channel 3 value, in microseconds + public ushort chan4_raw; /// RC channel 4 value, in microseconds + public ushort chan5_raw; /// RC channel 5 value, in microseconds + public ushort chan6_raw; /// RC channel 6 value, in microseconds + public ushort chan7_raw; /// RC channel 7 value, in microseconds + public ushort chan8_raw; /// RC channel 8 value, in microseconds + public ushort chan9_raw; /// RC channel 9 value, in microseconds + public ushort chan10_raw; /// RC channel 10 value, in microseconds + public ushort chan11_raw; /// RC channel 11 value, in microseconds + public ushort chan12_raw; /// RC channel 12 value, in microseconds + public byte rssi; /// Receive signal strength indicator, 0: 0%, 255: 100% + }; + + public const byte MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_LEN = 33; + public const byte MAVLINK_MSG_ID_HIL_STATE = 90; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_hil_state_t { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public ulong time_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) @@ -588,12 +723,11 @@ 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; + public const byte MAVLINK_MSG_ID_LOCAL_POSITION_NED = 32; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_local_position_t + public struct __mavlink_local_position_ned_t { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public uint time_boot_ms; /// Timestamp (milliseconds since system boot) public float x; /// X Position public float y; /// Y Position public float z; /// Z Position @@ -602,8 +736,7 @@ namespace ArdupilotMega public float vz; /// Z Speed }; - 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_NED_LEN = 28; public const byte MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT = 51; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_local_position_setpoint_t @@ -612,33 +745,19 @@ namespace ArdupilotMega public float y; /// y position public float z; /// z position public float yaw; /// Desired yaw angle + public byte coordinate_frame; /// Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU }; - 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 - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public float x; /// x position - public float y; /// y position - public float z; /// z position - public float yaw; /// Desired yaw angle - }; - - 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_LOCAL_POSITION_SETPOINT_LEN = 17; public const byte MAVLINK_MSG_ID_MANUAL_CONTROL = 69; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_manual_control_t { - public byte target; /// The system to be controlled public float roll; /// roll public float pitch; /// pitch public float yaw; /// yaw public float thrust; /// thrust + public byte target; /// The system to be controlled public byte roll_manual; /// roll control enabled auto:0, manual:1 public byte pitch_manual; /// pitch auto:0, manual:1 public byte yaw_manual; /// yaw auto:0, manual:1 @@ -646,81 +765,191 @@ 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; + public const byte MAVLINK_MSG_ID_MEMORY_VECT = 249; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_memory_vect_t + { + public ushort address; /// Starting address of the debug variables + public byte ver; /// Version code of the type variable. 0=unknown, type ignored and assumed public short. 1=as below + public byte type; /// Type code of the memory variables. for ver = 1: 0=16 x public short, 1=16 x public ushort, 2=16 x Q15, 3=16 x 1Q14 + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=32)] + public byte[] value; /// Memory contents at specified address + }; + + public const byte MAVLINK_MSG_ID_MEMORY_VECT_LEN = 36; + public const byte MAVLINK_MSG_ID_MISSION_ACK = 47; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_ack_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte type; /// See MAV_MISSION_RESULT enum + }; + + public const byte MAVLINK_MSG_ID_MISSION_ACK_LEN = 3; + public const byte MAVLINK_MSG_ID_MISSION_CLEAR_ALL = 45; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_clear_all_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + public const byte MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN = 2; + public const byte MAVLINK_MSG_ID_MISSION_COUNT = 44; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_count_t + { + public ushort count; /// Number of mission items in the sequence + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + public const byte MAVLINK_MSG_ID_MISSION_COUNT_LEN = 4; + public const byte MAVLINK_MSG_ID_MISSION_CURRENT = 42; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_current_t + { + public ushort seq; /// Sequence + }; + + public const byte MAVLINK_MSG_ID_MISSION_CURRENT_LEN = 2; + public const byte MAVLINK_MSG_ID_MISSION_ITEM = 39; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_item_t + { + public float param1; /// PARAM1 / For NAV command MISSIONs: Radius in which the MISSION is accepted as reached, in meters + public float param2; /// PARAM2 / For NAV command MISSIONs: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds + public float param3; /// PARAM3 / For LOITER command MISSIONs: Orbit to circle around the MISSION, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise. + public float param4; /// PARAM4 / For NAV and LOITER command MISSIONs: Yaw orientation in degrees, [0..360] 0 = NORTH + public float x; /// PARAM5 / local: x position, global: latitude + public float y; /// PARAM6 / y position: global: longitude + public float z; /// PARAM7 / z position: global: altitude + public ushort seq; /// Sequence + public ushort command; /// The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte frame; /// The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h + public byte current; /// false:0, true:1 + public byte autocontinue; /// autocontinue to next wp + }; + + public const byte MAVLINK_MSG_ID_MISSION_ITEM_LEN = 37; + public const byte MAVLINK_MSG_ID_MISSION_ITEM_REACHED = 46; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_item_reached_t + { + public ushort seq; /// Sequence + }; + + public const byte MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN = 2; + public const byte MAVLINK_MSG_ID_MISSION_REQUEST = 40; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_request_t + { + public ushort seq; /// Sequence + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + public const byte MAVLINK_MSG_ID_MISSION_REQUEST_LEN = 4; + public const byte MAVLINK_MSG_ID_MISSION_REQUEST_LIST = 43; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_request_list_t + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + public const byte MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN = 2; + public const byte MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST = 37; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_request_partial_list_t + { + public short start_index; /// Start index, 0 by default + public short end_index; /// End index, -1 by default (-1: send list to end). Else a valid index of the list + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + public const byte MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_LEN = 6; + public const byte MAVLINK_MSG_ID_MISSION_SET_CURRENT = 41; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_set_current_t + { + public ushort seq; /// Sequence + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + public const byte MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN = 4; + public const byte MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST = 38; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_mission_write_partial_list_t + { + public short start_index; /// Start index, 0 by default and smaller / equal to the largest index of the current onboard list. + public short end_index; /// End index, equal or greater than start index. + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + public const byte MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_LEN = 6; + public const byte MAVLINK_MSG_ID_NAMED_VALUE_FLOAT = 251; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_named_value_float_t { + public uint time_boot_ms; /// Timestamp (milliseconds since system boot) + public float value; /// Floating point value [MarshalAs( UnmanagedType.ByValArray, SizeConst=10)] - char name; /// Name of the debug variable - public float value; /// Floating point value + public byte[] name; /// Name of the debug variable }; - 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; + public const byte MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN = 18; + public const byte MAVLINK_MSG_ID_NAMED_VALUE_INT = 252; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_named_value_int_t { + public uint time_boot_ms; /// Timestamp (milliseconds since system boot) + public int value; /// Signed integer value [MarshalAs( UnmanagedType.ByValArray, SizeConst=10)] - char name; /// Name of the debug variable - public int value; /// Signed integer value + public byte[] name; /// Name of the debug variable }; - 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_NAMED_VALUE_INT_LEN = 18; public const byte MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT = 62; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_nav_controller_output_t { public float nav_roll; /// Current desired roll in degrees public float nav_pitch; /// Current desired pitch in degrees - public short nav_bearing; /// Current desired heading in degrees - public short target_bearing; /// Bearing to current waypoint/target in degrees - public ushort wp_dist; /// Distance to active waypoint in meters public float alt_error; /// Current altitude error in meters public float aspd_error; /// Current airspeed error in meters/second public float xtrack_error; /// Current crosstrack error on x-y plane in meters + public short nav_bearing; /// Current desired heading in degrees + public short target_bearing; /// Bearing to current MISSION/target in degrees + public ushort wp_dist; /// Distance to active MISSION in meters }; 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 - { - public uint time; /// Timestamp in milliseconds since system boot - public ushort object_id; /// Object ID - public byte type; /// Object type: 0: image, 1: letter, 2: ground vehicle, 3: air vehicle, 4: surface vehicle, 5: sub-surface vehicle, 6: human, 7: animal - [MarshalAs( - UnmanagedType.ByValArray, - SizeConst=20)] - char 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 { - public ulong time; /// Timestamp (UNIX) - public byte sensor_id; /// Sensor ID + public ulong time_usec; /// Timestamp (UNIX) + public float ground_distance; /// Ground distance in meters public short flow_x; /// Flow in pixels in x-sensor direction public short flow_y; /// Flow in pixels in y-sensor direction + public byte sensor_id; /// Sensor ID public byte quality; /// Optical flow quality / confidence. 0: bad, 255: maximum quality - public float ground_distance; /// Ground distance in meters }; 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 @@ -730,93 +959,66 @@ 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 { + public short param_index; /// Parameter index. Send -1 to use the param ID field as identifier public byte target_system; /// System ID public byte target_component; /// Component ID [MarshalAs( UnmanagedType.ByValArray, - SizeConst=15)] + SizeConst=16)] public byte[] param_id; /// Onboard parameter id - public short param_index; /// Parameter index. Send -1 to use the param ID field as identifier }; - 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_REQUEST_READ_LEN = 20; public const byte MAVLINK_MSG_ID_PARAM_SET = 23; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_param_set_t { + public float param_value; /// Onboard parameter value public byte target_system; /// System ID public byte target_component; /// Component ID [MarshalAs( UnmanagedType.ByValArray, - SizeConst=15)] + SizeConst=16)] public byte[] param_id; /// Onboard parameter id - public float param_value; /// Onboard parameter value + public byte param_type; /// Onboard parameter type: see MAV_VAR enum }; - 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_SET_LEN = 23; public const byte MAVLINK_MSG_ID_PARAM_VALUE = 22; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_param_value_t { - [MarshalAs( - UnmanagedType.ByValArray, - SizeConst=15)] - public byte[] param_id; /// Onboard parameter id public float param_value; /// Onboard parameter value public ushort param_count; /// Total number of onboard parameters public ushort param_index; /// Index of this onboard parameter + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=16)] + public byte[] param_id; /// Onboard parameter id + public byte param_type; /// Onboard parameter type: see MAV_VAR enum }; - 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; + public const byte MAVLINK_MSG_ID_PARAM_VALUE_LEN = 25; + public const byte MAVLINK_MSG_ID_PING = 4; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_ping_t { + public ulong time_usec; /// Unix timestamp in microseconds public uint seq; /// PING sequence public byte target_system; /// 0: request ping from all receiving systems, if greater than 0: message is a ping response and number is the system id of the requesting system public byte target_component; /// 0: request ping from all receiving components, if greater than 0: message is a ping response and number is the system id of the requesting system - public ulong time; /// Unix timestamp in microseconds }; 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 - { - public float x; /// x position - public float y; /// y position - public float z; /// z position - public float yaw; /// yaw orientation in radians, 0 = NORTH - }; - - 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; + public const byte MAVLINK_MSG_ID_RAW_IMU = 27; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_raw_imu_t { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public ulong time_usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) public short xacc; /// X acceleration (raw) public short yacc; /// Y acceleration (raw) public short zacc; /// Z acceleration (raw) @@ -829,12 +1031,11 @@ 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; + public const byte MAVLINK_MSG_ID_RAW_PRESSURE = 28; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_raw_pressure_t { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public ulong time_usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) public short press_abs; /// Absolute pressure (raw) public short press_diff1; /// Differential pressure 1 (raw) public short press_diff2; /// Differential pressure 2 (raw) @@ -842,13 +1043,10 @@ 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 { - public byte target_system; /// System ID - public byte target_component; /// Component ID public ushort chan1_raw; /// RC channel 1 value, in microseconds public ushort chan2_raw; /// RC channel 2 value, in microseconds public ushort chan3_raw; /// RC channel 3 value, in microseconds @@ -857,14 +1055,16 @@ namespace ArdupilotMega public ushort chan6_raw; /// RC channel 6 value, in microseconds public ushort chan7_raw; /// RC channel 7 value, in microseconds public ushort chan8_raw; /// RC channel 8 value, in microseconds + public byte target_system; /// System ID + public byte target_component; /// Component ID }; 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 { + public uint time_boot_ms; /// Timestamp (milliseconds since system boot) public ushort chan1_raw; /// RC channel 1 value, in microseconds public ushort chan2_raw; /// RC channel 2 value, in microseconds public ushort chan3_raw; /// RC channel 3 value, in microseconds @@ -873,15 +1073,16 @@ namespace ArdupilotMega public ushort chan6_raw; /// RC channel 6 value, in microseconds public ushort chan7_raw; /// RC channel 7 value, in microseconds public ushort chan8_raw; /// RC channel 8 value, in microseconds + public byte port; /// Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos. public byte rssi; /// Receive signal strength indicator, 0: 0%, 255: 100% }; - 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; + public const byte MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN = 22; + public const byte MAVLINK_MSG_ID_RC_CHANNELS_SCALED = 34; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_rc_channels_scaled_t { + public uint time_boot_ms; /// Timestamp (milliseconds since system boot) public short chan1_scaled; /// RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 public short chan2_scaled; /// RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 public short chan3_scaled; /// RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 @@ -890,109 +1091,82 @@ namespace ArdupilotMega public short chan6_scaled; /// RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 public short chan7_scaled; /// RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 public short chan8_scaled; /// RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 + public byte port; /// Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos. public byte rssi; /// Receive signal strength indicator, 0: 0%, 255: 100% }; - 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_RC_CHANNELS_SCALED_LEN = 22; public const byte MAVLINK_MSG_ID_REQUEST_DATA_STREAM = 66; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_request_data_stream_t { + public ushort req_message_rate; /// The requested interval between two messages of this type public byte target_system; /// The target requested to send the message stream. public byte target_component; /// The target requested to send the message stream. - public byte req_stream_id; /// The ID of the requested message type - public ushort req_message_rate; /// Update rate in Hertz + public byte req_stream_id; /// The ID of the requested data stream public byte start_stop; /// 1 to start sending, 0 to stop sending. }; 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; + public const byte MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT = 59; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_roll_pitch_yaw_speed_thrust_setpoint_t { - public ulong time_us; /// Timestamp in micro seconds since unix epoch + public uint time_boot_ms; /// Timestamp in milliseconds since system boot 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 float thrust; /// Collective thrust, normalized to 0 .. 1 }; - 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; + public const byte MAVLINK_MSG_ID_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT_LEN = 20; + public const byte MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT = 58; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_roll_pitch_yaw_thrust_setpoint_t { - public ulong time_us; /// Timestamp in micro seconds since unix epoch + public uint time_boot_ms; /// Timestamp in milliseconds since system boot 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 float thrust; /// Collective thrust, normalized to 0 .. 1 }; - 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; + public const byte MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT_LEN = 20; + public const byte MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA = 55; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_safety_allowed_area_t { - public byte frame; /// Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. public float p1x; /// x position 1 / Latitude 1 public float p1y; /// y position 1 / Longitude 1 public float p1z; /// z position 1 / Altitude 1 public float p2x; /// x position 2 / Latitude 2 public float p2y; /// y position 2 / Longitude 2 public float p2z; /// z position 2 / Altitude 2 + public byte frame; /// Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. }; 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; + public const byte MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA = 54; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_safety_set_allowed_area_t { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public byte frame; /// Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. public float p1x; /// x position 1 / Latitude 1 public float p1y; /// y position 1 / Longitude 1 public float p1z; /// z position 1 / Altitude 1 public float p2x; /// x position 2 / Latitude 2 public float p2y; /// y position 2 / Longitude 2 public float p2z; /// z position 2 / Altitude 2 + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte frame; /// Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. }; 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 { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public uint time_boot_ms; /// Timestamp (milliseconds since system boot) public short xacc; /// X acceleration (mg) public short yacc; /// Y acceleration (mg) public short zacc; /// Z acceleration (mg) @@ -1004,24 +1178,23 @@ namespace ArdupilotMega public short zmag; /// Z Magnetic field (milli tesla) }; - 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; + public const byte MAVLINK_MSG_ID_SCALED_IMU_LEN = 22; + public const byte MAVLINK_MSG_ID_SCALED_PRESSURE = 29; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_scaled_pressure_t { - public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public uint time_boot_ms; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) public float press_abs; /// Absolute pressure (hectopascal) public float press_diff; /// Differential pressure 1 (hectopascal) public short temperature; /// Temperature measurement (0.01 degrees celsius) }; - 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; + public const byte MAVLINK_MSG_ID_SCALED_PRESSURE_LEN = 14; + public const byte MAVLINK_MSG_ID_SERVO_OUTPUT_RAW = 36; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_servo_output_raw_t { + public uint time_usec; /// Timestamp (since UNIX epoch or microseconds since system boot) public ushort servo1_raw; /// Servo output 1 value, in microseconds public ushort servo2_raw; /// Servo output 2 value, in microseconds public ushort servo3_raw; /// Servo output 3 value, in microseconds @@ -1030,92 +1203,83 @@ namespace ArdupilotMega public ushort servo6_raw; /// Servo output 6 value, in microseconds public ushort servo7_raw; /// Servo output 7 value, in microseconds public ushort servo8_raw; /// Servo output 8 value, in microseconds + public byte port; /// Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos. }; - 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; + public const byte MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_LEN = 21; + public const byte MAVLINK_MSG_ID_SET_GLOBAL_POSITION_SETPOINT_INT = 53; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_set_altitude_t + public struct __mavlink_set_global_position_setpoint_int_t { - public byte target; /// The system setting the altitude - public uint mode; /// The new altitude in meters + public int latitude; /// WGS84 Latitude position in degrees * 1E7 + public int longitude; /// WGS84 Longitude position in degrees * 1E7 + public int altitude; /// WGS84 Altitude in meters * 1000 (positive for up) + public short yaw; /// Desired yaw angle in degrees * 100 + public byte coordinate_frame; /// Coordinate frame - valid values are only MAV_FRAME_GLOBAL or MAV_FRAME_GLOBAL_RELATIVE_ALT }; - 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_GLOBAL_POSITION_SETPOINT_INT_LEN = 15; + public const byte MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN = 48; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_set_gps_global_origin_t + { + public int latitude; /// global position * 1E7 + public int longitude; /// global position * 1E7 + public int altitude; /// global position * 1000 + public byte target_system; /// System ID + }; + + public const byte MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN = 13; + public const byte MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT = 50; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_set_local_position_setpoint_t + { + public float x; /// x position + public float y; /// y position + public float z; /// z position + public float yaw; /// Desired yaw angle + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte coordinate_frame; /// Coordinate frame - valid values are only MAV_FRAME_LOCAL_NED or MAV_FRAME_LOCAL_ENU + }; + + public const byte MAVLINK_MSG_ID_SET_LOCAL_POSITION_SETPOINT_LEN = 19; public const byte MAVLINK_MSG_ID_SET_MODE = 11; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_set_mode_t { - public byte target; /// The system setting the mode - public byte mode; /// The new mode + public uint custom_mode; /// The new autopilot-specific mode. This field can be ignored by an autopilot. + public byte target_system; /// The system setting the mode + public byte base_mode; /// The new base mode }; - 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 - { - public byte target; /// The system setting the mode - public byte nav_mode; /// The new navigation mode - }; - - 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; + public const byte MAVLINK_MSG_ID_SET_MODE_LEN = 6; + public const byte MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_SPEED_THRUST = 57; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_set_roll_pitch_yaw_speed_thrust_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 float thrust; /// Collective thrust, normalized to 0 .. 1 + public byte target_system; /// System ID + public byte target_component; /// Component ID }; 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; + public const byte MAVLINK_MSG_ID_SET_ROLL_PITCH_YAW_THRUST = 56; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_set_roll_pitch_yaw_thrust_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 float thrust; /// Collective thrust, normalized to 0 .. 1 + public byte target_system; /// System ID + public byte target_component; /// Component ID }; 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 @@ -1132,8 +1296,7 @@ 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; + public const byte MAVLINK_MSG_ID_STATUSTEXT = 253; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_statustext_t { @@ -1145,173 +1308,79 @@ namespace ArdupilotMega }; 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; + public const byte MAVLINK_MSG_ID_SYS_STATUS = 1; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_sys_status_t { - public byte mode; /// System mode, see MAV_MODE ENUM in mavlink/include/mavlink_types.h - public byte nav_mode; /// Navigation mode, see MAV_NAV_MODE ENUM - public byte status; /// System status flag, see MAV_STATUS ENUM + public uint onboard_control_sensors_present; /// Bitmask showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. Indices: 0: 3D gyro, 1: 3D acc, 2: 3D mag, 3: absolute pressure, 4: differential pressure, 5: GPS, 6: optical flow, 7: computer vision position, 8: laser based position, 9: external ground-truth (Vicon or Leica). Controllers: 10: 3D angular rate control 11: attitude stabilization, 12: yaw position, 13: z/altitude control, 14: x/y position control, 15: motor outputs / control + public uint onboard_control_sensors_enabled; /// Bitmask showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. Indices: 0: 3D gyro, 1: 3D acc, 2: 3D mag, 3: absolute pressure, 4: differential pressure, 5: GPS, 6: optical flow, 7: computer vision position, 8: laser based position, 9: external ground-truth (Vicon or Leica). Controllers: 10: 3D angular rate control 11: attitude stabilization, 12: yaw position, 13: z/altitude control, 14: x/y position control, 15: motor outputs / control + public uint onboard_control_sensors_health; /// Bitmask showing which onboard controllers and sensors are operational or have an error: Value of 0: not enabled. Value of 1: enabled. Indices: 0: 3D gyro, 1: 3D acc, 2: 3D mag, 3: absolute pressure, 4: differential pressure, 5: GPS, 6: optical flow, 7: computer vision position, 8: laser based position, 9: external ground-truth (Vicon or Leica). Controllers: 10: 3D angular rate control 11: attitude stabilization, 12: yaw position, 13: z/altitude control, 14: x/y position control, 15: motor outputs / control public ushort load; /// Maximum usage in percent of the mainloop time, (0%: 0, 100%: 1000) should be always below 1000 - public ushort vbat; /// Battery voltage, in millivolts (1 = 1 millivolt) - public ushort battery_remaining; /// Remaining battery energy: (0%: 0, 100%: 1000) - public ushort packet_drop; /// Dropped packets (packets that were corrupted on reception on the MAV) + public ushort voltage_battery; /// Battery voltage, in millivolts (1 = 1 millivolt) + public short current_battery; /// Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current + public ushort drop_rate_comm; /// Communication drops in percent, (0%: 0, 100%: 10'000), (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) + public ushort errors_comm; /// Communication errors (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) + public ushort errors_count1; /// Autopilot-specific errors + public ushort errors_count2; /// Autopilot-specific errors + public ushort errors_count3; /// Autopilot-specific errors + public ushort errors_count4; /// Autopilot-specific errors + public byte battery_remaining; /// Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot estimate the remaining battery }; - 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_SYS_STATUS_LEN = 31; public const byte MAVLINK_MSG_ID_VFR_HUD = 74; [StructLayout(LayoutKind.Sequential,Pack=1)] public struct __mavlink_vfr_hud_t { public float airspeed; /// Current airspeed in m/s public float groundspeed; /// Current ground speed in m/s - public short heading; /// Current heading in degrees, in compass units (0..360, 0=north) - public ushort throttle; /// Current throttle setting in integer percent, 0 to 100 public float alt; /// Current altitude (MSL), in meters public float climb; /// Current climb rate in meters/second + public short heading; /// Current heading in degrees, in compass units (0..360, 0=north) + public ushort throttle; /// Current throttle setting in integer percent, 0 to 100 }; 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; + public const byte MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE = 104; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_waypoint_t + public struct __mavlink_vicon_position_estimate_t { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public ushort seq; /// Sequence - public byte frame; /// The coordinate system of the waypoint. see MAV_FRAME in mavlink_types.h - public byte command; /// The scheduled action for the waypoint. see MAV_COMMAND in common.xml MAVLink specs - public byte current; /// false:0, true:1 - public byte autocontinue; /// autocontinue to next wp - public float param1; /// PARAM1 / For NAV command waypoints: Radius in which the waypoint is accepted as reached, in meters - public float param2; /// PARAM2 / For NAV command waypoints: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds - public float param3; /// PARAM3 / For LOITER command waypoints: Orbit to circle around the waypoint, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise. - public float param4; /// PARAM4 / For NAV and LOITER command waypoints: Yaw orientation in degrees, [0..360] 0 = NORTH - public float x; /// PARAM5 / local: x position, global: latitude - public float y; /// PARAM6 / y position: global: longitude - public float z; /// PARAM7 / z position: global: altitude + public ulong usec; /// Timestamp (milliseconds) + public float x; /// Global X position + public float y; /// Global Y position + public float z; /// Global Z position + public float roll; /// Roll angle in rad + public float pitch; /// Pitch angle in rad + public float yaw; /// Yaw angle in rad }; - 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; + public const byte MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_LEN = 32; + public const byte MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE = 102; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_waypoint_ack_t + public struct __mavlink_vision_position_estimate_t { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public byte type; /// 0: OK, 1: Error + public ulong usec; /// Timestamp (milliseconds) + public float x; /// Global X position + public float y; /// Global Y position + public float z; /// Global Z position + public float roll; /// Roll angle in rad + public float pitch; /// Pitch angle in rad + public float yaw; /// Yaw angle in rad }; - 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; + public const byte MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_LEN = 32; + public const byte MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE = 103; [StructLayout(LayoutKind.Sequential,Pack=1)] - public struct __mavlink_waypoint_clear_all_t + public struct __mavlink_vision_speed_estimate_t { - public byte target_system; /// System ID - public byte target_component; /// Component ID - }; - - 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 - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public ushort count; /// Number of Waypoints in the Sequence - }; - - 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 - { - public ushort seq; /// Sequence - }; - - 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 - { - public ushort seq; /// Sequence - }; - - 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 - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public ushort seq; /// Sequence - }; - - 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 - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - }; - - 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 - { - public byte target_system; /// System ID - public byte target_component; /// Component ID - public ushort seq; /// Sequence - }; - - 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 - 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 ulong usec; /// Timestamp (milliseconds) + public float x; /// Global X speed + public float y; /// Global Y speed + public float z; /// Global Z speed }; + public const byte MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_LEN = 20; public enum MAV_ACTION { MAV_ACTION_HOLD = 0, @@ -1360,100 +1429,9 @@ namespace ArdupilotMega 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 - }; - -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_new_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_sys_status_t) ,null ,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 ,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_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) ,null ,}; } + #endif } diff --git a/Tools/ArdupilotMegaPlanner/MAVLinkTypes0.9.cs b/Tools/ArdupilotMegaPlanner/MAVLinkTypes0.9.cs new file mode 100644 index 0000000000..9736a4dd6c --- /dev/null +++ b/Tools/ArdupilotMegaPlanner/MAVLinkTypes0.9.cs @@ -0,0 +1,1494 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.InteropServices; + +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 enum MAV_MOUNT_MODE + { + MAV_MOUNT_MODE_RETRACT=0, /* Load and keep safe position (Roll,Pitch,Yaw) from EEPROM and stop stabilization | */ + MAV_MOUNT_MODE_NEUTRAL=1, /* Load and keep neutral position (Roll,Pitch,Yaw) from EEPROM. | */ + MAV_MOUNT_MODE_MAVLINK_TARGETING=2, /* Load neutral position and start MAVLink Roll,Pitch,Yaw control with stabilization | */ + MAV_MOUNT_MODE_RC_TARGETING=3, /* Load neutral position and start RC Roll,Pitch,Yaw control with stabilization | */ + MAV_MOUNT_MODE_GPS_POINT=4, /* Load neutral position and start to point to Lat,Lon,Alt | */ + 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| */ + LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time |Empty| Empty| Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + LOITER_TURNS=18, /* Loiter around this waypoint for X turns |Turns| Empty| Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + LOITER_TIME=19, /* Loiter around this waypoint for X seconds |Seconds (decimal)| Empty| Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + LAND=21, /* Land at location |Empty| Empty| Empty| Desired yaw angle.| Latitude| Longitude| Altitude| */ + TAKEOFF=22, /* 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| */ + ROI=80, /* 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)| Waypoint 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| */ + PATHPLANNING=81, /* 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| */ + LAST=95, /* 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| */ + CONDITION_DELAY=112, /* Delay mission state machine. |Delay in seconds (decimal)| Empty| Empty| Empty| Empty| Empty| Empty| */ + CONDITION_CHANGE_ALT=113, /* Ascend/descend at rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate (m/s)| Empty| Empty| Empty| Empty| Empty| Finish Altitude| */ + CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance (meters)| Empty| Empty| Empty| Empty| Empty| Empty| */ + CONDITION_YAW=115, /* Reach a certain target angle. |target angle: [0-360], 0 is north| speed during yaw change:[deg per second]| direction: negative: counter clockwise, positive: clockwise [-1,1]| relative offset or absolute angle: [ 1,0]| Empty| Empty| Empty| */ + CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + DO_SET_MODE=176, /* Set system mode. |Mode, as defined by ENUM MAV_MODE| Empty| Empty| Empty| Empty| Empty| Empty| */ + DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ + DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed)| Speed (m/s, -1 indicates no change)| Throttle ( Percent, -1 indicates no change)| Empty| Empty| Empty| Empty| */ + DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ + DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ + DO_SET_RELAY=181, /* Set a relay to a condition. |Relay number| Setting (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ + DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cyles with a desired period. |Relay number| Cycle count| Cycle time (seconds, decimal)| Empty| Empty| Empty| Empty| */ + DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Empty| Empty| Empty| Empty| Empty| */ + DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Cycle count| Cycle time (seconds)| Empty| Empty| Empty| */ + DO_CONTROL_VIDEO=200, /* Control onboard camera capturing. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds (decimal)| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ + DO_SET_ROI=201, /* 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 + devices such as cameras. + |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_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| */ + PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Reserved| Reserved| Empty| Empty| Empty| */ + ENUM_END=246, /* | */ + }; + + 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, /* | */ + }; + + public enum MAV_ROI + { + MAV_ROI_NONE=0, /* No region of interest. | */ + MAV_ROI_WPNEXT=1, /* Point toward next waypoint. | */ + MAV_ROI_WPINDEX=2, /* Point toward given waypoint. | */ + MAV_ROI_LOCATION=3, /* Point toward fixed location. | */ + MAV_ROI_TARGET=4, /* Point toward of given id. | */ + MAV_ROI_ENUM_END=5, /* | */ + }; + + public const byte MAVLINK_MSG_ID_ACTION = 10; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_action_t + { + public byte target; /// The system executing the action + public byte target_component; /// The component executing the action + public byte action; /// The action id + }; + + 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 + { + public byte action; /// The action id + public byte result; /// 0: Action DENIED, 1: Action executed + }; + + 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 + { + 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 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_ATTITUDE_NEW = 30; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_attitude_new_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 const byte MAVLINK_MSG_ID_AUTH_KEY = 7; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_auth_key_t + { + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=32)] + char 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 + { + public uint version; /// The onboard software version + }; + + 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 + { + public byte target_system; /// System the GCS requests control for + public byte control_request; /// 0: request control of this MAV, 1: Release control of this MAV + public byte version; /// 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch. + [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 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 + { + public byte gcs_system_id; /// ID of the GCS this message + public byte control_request; /// 0: request control of this MAV, 1: Release control of this MAV + public byte ack; /// 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control + }; + + 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 + { + public byte target_system; /// System which should execute the command + public byte target_component; /// Component which should execute the command, 0 for all components + public byte command; /// Command ID, as defined by MAV_CMD enum. + public byte confirmation; /// 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) + public float param1; /// Parameter 1, as defined by MAV_CMD enum. + public float param2; /// Parameter 2, as defined by MAV_CMD enum. + public float param3; /// Parameter 3, as defined by MAV_CMD enum. + public float param4; /// Parameter 4, as defined by MAV_CMD enum. + }; + + 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 + { + public float command; /// Current airspeed in m/s + public float result; /// 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION + }; + + 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 + { + public byte position_fix; /// Position fix: 0: lost, 2: 2D position fix, 3: 3D position fix + public byte vision_fix; /// Vision position fix: 0: lost, 1: 2D local position hold, 2: 2D global position fix, 3: 3D global position fix + public byte gps_fix; /// GPS position fix: 0: no reception, 1: Minimum 1 satellite, but no position fix, 2: 2D position fix, 3: 3D position fix + public byte ahrs_health; /// Attitude estimation health: 0: poor, 255: excellent + public byte control_att; /// 0: Attitude control disabled, 1: enabled + public byte control_pos_xy; /// 0: X, Y position control disabled, 1: enabled + public byte control_pos_z; /// 0: Z position control disabled, 1: enabled + public byte control_pos_yaw; /// 0: Yaw angle control disabled, 1: enabled + }; + + 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 + { + public byte ind; /// index of debug variable + public float value; /// DEBUG value + }; + + 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 + { + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=10)] + char name; /// Name + public ulong usec; /// Timestamp + public float x; /// x + public float y; /// y + public float z; /// z + }; + + 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 + { + public ulong usec; /// Timestamp (microseconds since unix epoch) + public float lat; /// Latitude, in degrees + public float lon; /// Longitude, in degrees + public float alt; /// Absolute altitude, in meters + public float vx; /// X Speed (in Latitude direction, positive: going north) + public float vy; /// Y Speed (in Longitude direction, positive: going east) + public float vz; /// Z Speed (in Altitude direction, positive: going up) + }; + + 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 + { + 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 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 + { + public int latitude; /// Latitude (WGS84), expressed as * 1E7 + public int longitude; /// Longitude (WGS84), expressed as * 1E7 + public int altitude; /// Altitude(WGS84), expressed as * 1000 + }; + + 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 + { + public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public byte fix_type; /// 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + public float lat; /// Latitude in degrees + public float lon; /// Longitude in degrees + public float alt; /// Altitude in meters + public float eph; /// GPS HDOP + public float epv; /// GPS VDOP + public float v; /// GPS ground speed + public float hdg; /// Compass heading in degrees, 0..360 degrees + }; + + 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 + { + public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public byte fix_type; /// 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + public int lat; /// Latitude in 1E7 degrees + public int lon; /// Longitude in 1E7 degrees + public int alt; /// Altitude in 1E3 meters (millimeters) + public float eph; /// GPS HDOP + public float epv; /// GPS VDOP + public float v; /// GPS ground speed (m/s) + public float hdg; /// Compass heading in degrees, 0..360 degrees + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public int latitude; /// global position * 1E7 + public int longitude; /// global position * 1E7 + public int altitude; /// global position * 1000 + }; + + 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 + { + public byte satellites_visible; /// Number of satellites visible + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=20)] + public byte[] satellite_prn; /// Global satellite ID + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=20)] + public byte[] satellite_used; /// 0: Satellite not used, 1: used for localization + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=20)] + public byte[] satellite_elevation; /// Elevation (0: right on top of receiver, 90: on the horizon) of satellite + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=20)] + public byte[] satellite_azimuth; /// Direction of satellite, 0: 0 deg, 255: 360 deg. + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=20)] + public byte[] satellite_snr; /// Signal to noise ratio of satellite + }; + + 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 + { + public byte type; /// Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + public byte autopilot; /// Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM + public byte mavlink_version; /// MAVLink version + }; + + 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 + { + public ulong time_us; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public float roll_ailerons; /// Control output -3 .. 1 + public float pitch_elevator; /// Control output -1 .. 1 + public float yaw_rudder; /// Control output -1 .. 1 + public float throttle; /// Throttle 0 .. 1 + public byte mode; /// System mode (MAV_MODE) + public byte nav_mode; /// Navigation mode (MAV_NAV_MODE) + }; + + 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 + { + 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_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 + { + public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public float x; /// X Position + public float y; /// Y Position + public float z; /// Z Position + public float vx; /// X Speed + public float vy; /// Y Speed + public float vz; /// Z Speed + }; + + 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 + { + public float x; /// x position + public float y; /// y position + public float z; /// z position + public float yaw; /// Desired yaw angle + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public float x; /// x position + public float y; /// y position + public float z; /// z position + public float yaw; /// Desired yaw angle + }; + + 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 + { + public byte target; /// The system to be controlled + public float roll; /// roll + public float pitch; /// pitch + public float yaw; /// yaw + public float thrust; /// thrust + public byte roll_manual; /// roll control enabled auto:0, manual:1 + public byte pitch_manual; /// pitch auto:0, manual:1 + public byte yaw_manual; /// yaw auto:0, manual:1 + public byte thrust_manual; /// thrust auto:0, manual:1 + }; + + 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 + { + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=10)] + char 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 + { + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=10)] + char 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 + { + public float nav_roll; /// Current desired roll in degrees + public float nav_pitch; /// Current desired pitch in degrees + public short nav_bearing; /// Current desired heading in degrees + public short target_bearing; /// Bearing to current waypoint/target in degrees + public ushort wp_dist; /// Distance to active waypoint in meters + public float alt_error; /// Current altitude error in meters + public float aspd_error; /// Current airspeed error in meters/second + public float xtrack_error; /// Current crosstrack error on x-y plane in meters + }; + + 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 + { + public uint time; /// Timestamp in milliseconds since system boot + public ushort object_id; /// Object ID + public byte type; /// Object type: 0: image, 1: letter, 2: ground vehicle, 3: air vehicle, 4: surface vehicle, 5: sub-surface vehicle, 6: human, 7: animal + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=20)] + char 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 + { + public ulong time; /// Timestamp (UNIX) + public byte sensor_id; /// Sensor ID + public short flow_x; /// Flow in pixels in x-sensor direction + public short flow_y; /// Flow in pixels in y-sensor direction + public byte quality; /// Optical flow quality / confidence. 0: bad, 255: maximum quality + public float ground_distance; /// Ground distance in meters + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=15)] + public byte[] param_id; /// Onboard parameter id + public short param_index; /// Parameter index. Send -1 to use the param ID field as identifier + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=15)] + public byte[] param_id; /// Onboard parameter id + public float param_value; /// Onboard parameter value + }; + + 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 + { + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=15)] + public byte[] param_id; /// Onboard parameter id + public float param_value; /// Onboard parameter value + public ushort param_count; /// Total number of onboard parameters + public ushort param_index; /// Index of this onboard parameter + }; + + 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 + { + public uint seq; /// PING sequence + public byte target_system; /// 0: request ping from all receiving systems, if greater than 0: message is a ping response and number is the system id of the requesting system + public byte target_component; /// 0: request ping from all receiving components, if greater than 0: message is a ping response and number is the system id of the requesting system + public ulong time; /// Unix timestamp in microseconds + }; + + 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 + { + public float x; /// x position + public float y; /// y position + public float z; /// z position + public float yaw; /// yaw orientation in radians, 0 = NORTH + }; + + 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 + { + public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public short xacc; /// X acceleration (raw) + public short yacc; /// Y acceleration (raw) + public short zacc; /// Z acceleration (raw) + public short xgyro; /// Angular speed around X axis (raw) + public short ygyro; /// Angular speed around Y axis (raw) + public short zgyro; /// Angular speed around Z axis (raw) + public short xmag; /// X Magnetic field (raw) + public short ymag; /// Y Magnetic field (raw) + public short zmag; /// Z Magnetic field (raw) + }; + + 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 + { + public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public short press_abs; /// Absolute pressure (raw) + public short press_diff1; /// Differential pressure 1 (raw) + public short press_diff2; /// Differential pressure 2 (raw) + public short temperature; /// Raw Temperature measurement (raw) + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public ushort chan1_raw; /// RC channel 1 value, in microseconds + public ushort chan2_raw; /// RC channel 2 value, in microseconds + public ushort chan3_raw; /// RC channel 3 value, in microseconds + public ushort chan4_raw; /// RC channel 4 value, in microseconds + public ushort chan5_raw; /// RC channel 5 value, in microseconds + public ushort chan6_raw; /// RC channel 6 value, in microseconds + public ushort chan7_raw; /// RC channel 7 value, in microseconds + public ushort chan8_raw; /// RC channel 8 value, in microseconds + }; + + 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 + { + public ushort chan1_raw; /// RC channel 1 value, in microseconds + public ushort chan2_raw; /// RC channel 2 value, in microseconds + public ushort chan3_raw; /// RC channel 3 value, in microseconds + public ushort chan4_raw; /// RC channel 4 value, in microseconds + public ushort chan5_raw; /// RC channel 5 value, in microseconds + public ushort chan6_raw; /// RC channel 6 value, in microseconds + public ushort chan7_raw; /// RC channel 7 value, in microseconds + public ushort chan8_raw; /// RC channel 8 value, in microseconds + public byte rssi; /// Receive signal strength indicator, 0: 0%, 255: 100% + }; + + 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 + { + public short chan1_scaled; /// RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 + public short chan2_scaled; /// RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 + public short chan3_scaled; /// RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 + public short chan4_scaled; /// RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 + public short chan5_scaled; /// RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 + public short chan6_scaled; /// RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 + public short chan7_scaled; /// RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 + public short chan8_scaled; /// RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000 + public byte rssi; /// Receive signal strength indicator, 0: 0%, 255: 100% + }; + + 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 + { + public byte target_system; /// The target requested to send the message stream. + public byte target_component; /// The target requested to send the message stream. + public byte req_stream_id; /// The ID of the requested message type + public ushort req_message_rate; /// Update rate in Hertz + public byte start_stop; /// 1 to start sending, 0 to stop sending. + }; + + 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 + { + public ulong time_us; /// Timestamp in micro seconds since unix epoch + 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 float thrust; /// Collective thrust, normalized to 0 .. 1 + }; + + 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 + { + public ulong time_us; /// Timestamp in micro seconds since unix epoch + 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 float thrust; /// Collective thrust, normalized to 0 .. 1 + }; + + 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 + { + public byte frame; /// Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. + public float p1x; /// x position 1 / Latitude 1 + public float p1y; /// y position 1 / Longitude 1 + public float p1z; /// z position 1 / Altitude 1 + public float p2x; /// x position 2 / Latitude 2 + public float p2y; /// y position 2 / Longitude 2 + public float p2z; /// z position 2 / Altitude 2 + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte frame; /// Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. + public float p1x; /// x position 1 / Latitude 1 + public float p1y; /// y position 1 / Longitude 1 + public float p1z; /// z position 1 / Altitude 1 + public float p2x; /// x position 2 / Latitude 2 + public float p2y; /// y position 2 / Longitude 2 + public float p2z; /// z position 2 / Altitude 2 + }; + + 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 + { + public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public short xacc; /// X acceleration (mg) + public short yacc; /// Y acceleration (mg) + public short zacc; /// Z acceleration (mg) + public short xgyro; /// Angular speed around X axis (millirad /sec) + public short ygyro; /// Angular speed around Y axis (millirad /sec) + public short zgyro; /// Angular speed around Z axis (millirad /sec) + public short xmag; /// X Magnetic field (milli tesla) + public short ymag; /// Y Magnetic field (milli tesla) + public short zmag; /// Z Magnetic field (milli tesla) + }; + + 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 + { + public ulong usec; /// Timestamp (microseconds since UNIX epoch or microseconds since system boot) + public float press_abs; /// Absolute pressure (hectopascal) + public float press_diff; /// Differential pressure 1 (hectopascal) + public short temperature; /// Temperature measurement (0.01 degrees celsius) + }; + + 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 + { + public ushort servo1_raw; /// Servo output 1 value, in microseconds + public ushort servo2_raw; /// Servo output 2 value, in microseconds + public ushort servo3_raw; /// Servo output 3 value, in microseconds + public ushort servo4_raw; /// Servo output 4 value, in microseconds + public ushort servo5_raw; /// Servo output 5 value, in microseconds + public ushort servo6_raw; /// Servo output 6 value, in microseconds + public ushort servo7_raw; /// Servo output 7 value, in microseconds + public ushort servo8_raw; /// Servo output 8 value, in microseconds + }; + + 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 + { + public byte target; /// The system setting the altitude + public uint mode; /// The new altitude in meters + }; + + 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 + { + public byte target; /// The system setting the mode + public byte mode; /// The new mode + }; + + 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 + { + public byte target; /// The system setting the mode + public byte nav_mode; /// The new navigation mode + }; + + 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 + { + 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 float thrust; /// Collective thrust, normalized to 0 .. 1 + }; + + 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 + { + 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 float thrust; /// Collective thrust, normalized to 0 .. 1 + }; + + 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 + { + public float xErr; /// x position error + public float yErr; /// y position error + public float zErr; /// z position error + public float rollErr; /// roll error (radians) + public float pitchErr; /// pitch error (radians) + public float yawErr; /// yaw error (radians) + public float vxErr; /// x velocity + public float vyErr; /// y velocity + public float vzErr; /// z velocity + }; + + 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 + { + public byte severity; /// Severity of status, 0 = info message, 255 = critical fault + [MarshalAs( + UnmanagedType.ByValArray, + SizeConst=50)] + public byte[] text; /// Status text message, without null termination character + }; + + 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; + [StructLayout(LayoutKind.Sequential,Pack=1)] + public struct __mavlink_sys_status_t + { + public byte mode; /// System mode, see MAV_MODE ENUM in mavlink/include/mavlink_types.h + public byte nav_mode; /// Navigation mode, see MAV_NAV_MODE ENUM + public byte status; /// System status flag, see MAV_STATUS ENUM + public ushort load; /// Maximum usage in percent of the mainloop time, (0%: 0, 100%: 1000) should be always below 1000 + public ushort vbat; /// Battery voltage, in millivolts (1 = 1 millivolt) + public ushort battery_remaining; /// Remaining battery energy: (0%: 0, 100%: 1000) + public ushort packet_drop; /// Dropped packets (packets that were corrupted on reception on the MAV) + }; + + 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 + { + public float airspeed; /// Current airspeed in m/s + public float groundspeed; /// Current ground speed in m/s + public short heading; /// Current heading in degrees, in compass units (0..360, 0=north) + public ushort throttle; /// Current throttle setting in integer percent, 0 to 100 + public float alt; /// Current altitude (MSL), in meters + public float climb; /// Current climb rate in meters/second + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public ushort seq; /// Sequence + public byte frame; /// The coordinate system of the waypoint. see MAV_FRAME in mavlink_types.h + public byte command; /// The scheduled action for the waypoint. see MAV_COMMAND in common.xml MAVLink specs + public byte current; /// false:0, true:1 + public byte autocontinue; /// autocontinue to next wp + public float param1; /// PARAM1 / For NAV command waypoints: Radius in which the waypoint is accepted as reached, in meters + public float param2; /// PARAM2 / For NAV command waypoints: Time that the MAV should stay inside the PARAM1 radius before advancing, in milliseconds + public float param3; /// PARAM3 / For LOITER command waypoints: Orbit to circle around the waypoint, in meters. If positive the orbit direction should be clockwise, if negative the orbit direction should be counter-clockwise. + public float param4; /// PARAM4 / For NAV and LOITER command waypoints: Yaw orientation in degrees, [0..360] 0 = NORTH + public float x; /// PARAM5 / local: x position, global: latitude + public float y; /// PARAM6 / y position: global: longitude + public float z; /// PARAM7 / z position: global: altitude + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public byte type; /// 0: OK, 1: Error + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public ushort count; /// Number of Waypoints in the Sequence + }; + + 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 + { + public ushort seq; /// Sequence + }; + + 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 + { + public ushort seq; /// Sequence + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public ushort seq; /// Sequence + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + }; + + 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 + { + public byte target_system; /// System ID + public byte target_component; /// Component ID + public ushort seq; /// Sequence + }; + + 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 + 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 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 + }; + +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_new_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 ,}; + + } + #endif +} + diff --git a/Tools/ArdupilotMegaPlanner/MainV2.cs b/Tools/ArdupilotMegaPlanner/MainV2.cs index 0d9cf00b0f..18336eda58 100644 --- a/Tools/ArdupilotMegaPlanner/MainV2.cs +++ b/Tools/ArdupilotMegaPlanner/MainV2.cs @@ -58,6 +58,13 @@ namespace ArdupilotMega public static List threads = new List(); public static MainV2 instance = null; + /* + * "PITCH_KP", +"PITCH_KI", +"PITCH_LIM", + + */ + public enum Firmwares { ArduPlane, @@ -233,7 +240,7 @@ namespace ArdupilotMega string name = "ss" + DateTime.Now.ToString("hhmmss") + ".jpg"; bitmap.Save(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + name, System.Drawing.Imaging.ImageFormat.Jpeg); MessageBox.Show("Screenshot saved to " + name); - } + } } @@ -468,7 +475,6 @@ namespace ArdupilotMega private void MenuConfiguration_Click(object sender, EventArgs e) { - MyView.SuspendLayout(); MyView.Controls.Clear(); GCSViews.Terminal.threadrun = false; @@ -499,11 +505,11 @@ namespace ArdupilotMega temp.BackColor = Color.FromArgb(0x26, 0x27, 0x28); - temp.ResumeLayout(); + temp.Size = MyView.Size; + + //temp.Parent = MyView; MyView.Controls.Add(temp); - - MyView.ResumeLayout(); } private void MenuSimulation_Click(object sender, EventArgs e) @@ -619,14 +625,14 @@ namespace ArdupilotMega comPort.BaseStream = new TcpSerial(); } else - if (CMB_serialport.Text == "UDP") - { - comPort.BaseStream = new UdpSerial(); - } - else - { - comPort.BaseStream = new SerialPort(); - } + if (CMB_serialport.Text == "UDP") + { + comPort.BaseStream = new UdpSerial(); + } + else + { + comPort.BaseStream = new SerialPort(); + } try { comPort.BaseStream.BaudRate = int.Parse(CMB_baudrate.Text); @@ -684,10 +690,13 @@ namespace ArdupilotMega this.MenuConnect.BackgroundImage = global::ArdupilotMega.Properties.Resources.disconnect; } - catch (Exception ex) { - try { - comPort.Close(); - } catch { } + catch (Exception ex) + { + try + { + comPort.Close(); + } + catch { } try { string version = ArduinoDetect.DetectVersion(comPort.BaseStream.PortName); @@ -723,8 +732,8 @@ namespace ArdupilotMega } } catch { } - MessageBox.Show("Is your CLI switch in Flight position?\n(this is required for MAVlink comms)\n\n" + ex.ToString()); - return; + MessageBox.Show("Is your CLI switch in Flight position?\n(this is required for MAVlink comms)\n\n" + ex.ToString()); + return; } } } @@ -940,7 +949,7 @@ namespace ArdupilotMega if (lastjoystick.AddMilliseconds(50) < DateTime.Now) { // Console.WriteLine(DateTime.Now.Millisecond + " {0} {1} {2} {3} ", rc.chan1_raw, rc.chan2_raw, rc.chan3_raw, rc.chan4_raw); - comPort.generatePacket(MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE, rc); + comPort.sendPacket(rc); lastjoystick = DateTime.Now; } @@ -1064,18 +1073,25 @@ 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.mavlink_version = 3; +#else htb.type = (byte)MAVLink.MAV_TYPE.MAV_GENERIC; htb.autopilot = (byte)MAVLink.MAV_AUTOPILOT_TYPE.MAV_AUTOPILOT_ARDUPILOTMEGA; htb.mavlink_version = 2; +#endif - comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_HEARTBEAT, htb); + comPort.sendPacket(htb); heatbeatsend = DateTime.Now; } // data loss warning if ((DateTime.Now - comPort.lastvalidpacket).TotalSeconds > 10) { - if (speechenable && talk != null) { + if (speechenable && talk != null) + { if (MainV2.talk.State == SynthesizerState.Ready) MainV2.talk.SpeakAsync("WARNING No Data for " + (int)(DateTime.Now - comPort.lastvalidpacket).TotalSeconds + " Seconds"); } @@ -1086,7 +1102,8 @@ namespace ArdupilotMega while (comPort.BaseStream.BytesToRead > minbytes && givecomport == false) comPort.readPacket(); } - catch (Exception e) { + catch (Exception e) + { Console.WriteLine("Serial Reader fail :" + e.Message); try { @@ -1160,7 +1177,7 @@ namespace ArdupilotMega { Name = "motion jpg stream", IsBackground = true - }; + }; // wait for tcp connections t13.Start(); } @@ -1195,7 +1212,7 @@ namespace ArdupilotMega { listener.Start(); } - catch { Console.WriteLine("do you have the planner open already");return; } // in use + catch { Console.WriteLine("do you have the planner open already"); return; } // in use // Enter the listening loop. while (true) { @@ -1252,7 +1269,7 @@ namespace ArdupilotMega stream.WriteByte(0x00); writer.WriteLine("test from planner"); stream.WriteByte(0xff); - + //break; } @@ -1260,19 +1277,22 @@ namespace ArdupilotMega //message stream.WriteByte(0xff); } - } else if (url.Contains(".html")) { - BinaryReader file = new BinaryReader(File.Open("hud.html",FileMode.Open,FileAccess.Read,FileShare.Read)); + } + else if (url.Contains(".html")) + { + BinaryReader file = new BinaryReader(File.Open("hud.html", FileMode.Open, FileAccess.Read, FileShare.Read)); byte[] buffer = new byte[1024]; - while (file.PeekChar() != -1) { - - int leng = file.Read(buffer,0,buffer.Length); + while (file.PeekChar() != -1) + { - stream.Write(buffer,0,leng); + int leng = file.Read(buffer, 0, buffer.Length); + + stream.Write(buffer, 0, leng); } file.Close(); stream.Close(); } - else if (url.ToLower().Contains("hud") || url.ToLower().Contains("map")) + else if (url.ToLower().Contains("hud.jpg") || url.ToLower().Contains("map.jpg") || url.ToLower().Contains("both.jpg")) { string header = "HTTP/1.1 200 OK\r\nContent-Type: multipart/x-mixed-replace;boundary=APMPLANNER\n\n--APMPLANNER\r\n"; byte[] temp = encoding.GetBytes(header); @@ -1496,7 +1516,7 @@ namespace ArdupilotMega if (fi.Length != response.ContentLength) // && response.Headers[HttpResponseHeader.ETag] != "0") { - StreamWriter sw = new StreamWriter(path+".etag"); + StreamWriter sw = new StreamWriter(path + ".etag"); sw.WriteLine(response.Headers[HttpResponseHeader.ETag]); sw.Close(); getfile = true; @@ -1622,7 +1642,12 @@ namespace ArdupilotMega } if (keyData == (Keys.Control | Keys.Y)) // for ryan beall { - MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_STORAGE_WRITE); +#if MAVLINK10 + int fixme; + //MainV2.comPort.doCommand(MAVLink.MAV_ACTION.MAV_ACTION_STORAGE_WRITE); +#else + MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_STORAGE_WRITE); +#endif MessageBox.Show("Done MAV_ACTION_STORAGE_WRITE"); return true; } @@ -1731,7 +1756,7 @@ namespace ArdupilotMega comPort.logfile.Close(); } catch { } - + } public static string getConfig(string paramname) diff --git a/Tools/ArdupilotMegaPlanner/Program.cs b/Tools/ArdupilotMegaPlanner/Program.cs index 148f07202c..9cbd88d96c 100644 --- a/Tools/ArdupilotMegaPlanner/Program.cs +++ b/Tools/ArdupilotMegaPlanner/Program.cs @@ -22,12 +22,19 @@ namespace ArdupilotMega Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); + Application.Idle += new EventHandler(Application_Idle); + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Camera()); Application.Run(new MainV2()); } + static void Application_Idle(object sender, EventArgs e) + { + //Console.WriteLine("Idle"); + } + static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { Exception ex = e.Exception; diff --git a/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs b/Tools/ArdupilotMegaPlanner/Properties/AssemblyInfo.cs index 7458e314c0..604c2a7441 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.0.89")] +[assembly: AssemblyFileVersion("1.0.90")] [assembly: NeutralResourcesLanguageAttribute("")] diff --git a/Tools/ArdupilotMegaPlanner/Setup/Setup.cs b/Tools/ArdupilotMegaPlanner/Setup/Setup.cs index e6080503e7..5d028719d6 100644 --- a/Tools/ArdupilotMegaPlanner/Setup/Setup.cs +++ b/Tools/ArdupilotMegaPlanner/Setup/Setup.cs @@ -221,7 +221,7 @@ namespace ArdupilotMega.Setup } catch { MessageBox.Show("Failed to set Channel " + (a + 1).ToString()); } - data = data +"CH" + (a+1) + " " + rcmin[a] + " | " + rcmax[a] + "\n"; + data = data + "CH" + (a + 1) + " " + rcmin[a] + " | " + rcmax[a] + "\n"; } MainV2.cs.raterc = oldrc; @@ -470,7 +470,7 @@ namespace ArdupilotMega.Setup MainV2.comPort.setParam("FLTMODE5", (float)(int)Enum.Parse(typeof(Common.ac2modes), CMB_fmode5.Text)); MainV2.comPort.setParam("FLTMODE6", (float)(int)Enum.Parse(typeof(Common.ac2modes), CMB_fmode6.Text)); - float value = (float)(CB_simple1.Checked ? 1 : 0) + (CB_simple2.Checked ? 1 << 1 : 0) + (CB_simple3.Checked ? 1 <<2 : 0) + float value = (float)(CB_simple1.Checked ? 1 : 0) + (CB_simple2.Checked ? 1 << 1 : 0) + (CB_simple3.Checked ? 1 << 2 : 0) + (CB_simple4.Checked ? 1 << 3 : 0) + (CB_simple5.Checked ? 1 << 4 : 0) + (CB_simple6.Checked ? 1 << 5 : 0); if (MainV2.comPort.param.ContainsKey("SIMPLE")) MainV2.comPort.setParam("SIMPLE", value); @@ -570,7 +570,7 @@ namespace ArdupilotMega.Setup { if (MainV2.comPort.param["ARSPD_ENABLE"] == null) { - MessageBox.Show("Not Available on "+ MainV2.cs.firmware.ToString()); + MessageBox.Show("Not Available on " + MainV2.cs.firmware.ToString()); } else { @@ -646,7 +646,7 @@ namespace ArdupilotMega.Setup if (startup || ((TextBox)sender).Enabled == false) return; try - { + { if (MainV2.comPort.param["INPUT_VOLTS"] == null) { MessageBox.Show("Not Available"); @@ -803,7 +803,7 @@ namespace ArdupilotMega.Setup System.Threading.Thread.Sleep(1); } Console.WriteLine("sleep out"); - } + } private void pictureBoxQuad_Click(object sender, EventArgs e) { @@ -1022,14 +1022,19 @@ namespace ArdupilotMega.Setup MainV2.comPort.setParam("HS4_MIN", HS4.minline); MainV2.comPort.setParam("HS4_MAX", HS4.maxline); } - catch { MessageBox.Show("Failed to set min/max"); } + catch { MessageBox.Show("Failed to set min/max"); } } private void BUT_levelac2_Click(object sender, EventArgs e) { try { +#if MAVLINK10 + int fixme; + // MainV2.comPort.doCommand(MAVLink.MAV_ACTION.MAV_ACTION_CALIBRATE_ACC); +#else MainV2.comPort.doAction(MAVLink.MAV_ACTION.MAV_ACTION_CALIBRATE_ACC); +#endif BUT_levelac2.Text = "Complete"; } @@ -1049,15 +1054,17 @@ namespace ArdupilotMega.Setup catch { MessageBox.Show("Webpage open failed... do you have a virus?\nhttp://www.magnetic-declination.com/"); } } - void reverseChannel(string name,bool normalreverse,Control progressbar) + void reverseChannel(string name, bool normalreverse, Control progressbar) { if (normalreverse == true) { + ((HorizontalProgressBar2)progressbar).reverse = true; ((HorizontalProgressBar2)progressbar).BackgroundColor = Color.FromArgb(148, 193, 31); ((HorizontalProgressBar2)progressbar).ValueColor = Color.FromArgb(0x43, 0x44, 0x45); } else { + ((HorizontalProgressBar2)progressbar).reverse = false; ((HorizontalProgressBar2)progressbar).BackgroundColor = Color.FromArgb(0x43, 0x44, 0x45); ((HorizontalProgressBar2)progressbar).ValueColor = Color.FromArgb(148, 193, 31); } @@ -1083,22 +1090,22 @@ namespace ArdupilotMega.Setup private void CHK_revch1_CheckedChanged(object sender, EventArgs e) { - reverseChannel("RC1_REV", ((CheckBox)sender).Checked,BARroll); + reverseChannel("RC1_REV", ((CheckBox)sender).Checked, BARroll); } private void CHK_revch2_CheckedChanged(object sender, EventArgs e) { - reverseChannel("RC2_REV", ((CheckBox)sender).Checked,BARpitch); + reverseChannel("RC2_REV", ((CheckBox)sender).Checked, BARpitch); } private void CHK_revch3_CheckedChanged(object sender, EventArgs e) { - reverseChannel("RC3_REV", ((CheckBox)sender).Checked,BARthrottle); + reverseChannel("RC3_REV", ((CheckBox)sender).Checked, BARthrottle); } private void CHK_revch4_CheckedChanged(object sender, EventArgs e) { - reverseChannel("RC4_REV", ((CheckBox)sender).Checked,BARyaw); + reverseChannel("RC4_REV", ((CheckBox)sender).Checked, BARyaw); } } -} +} \ No newline at end of file diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application index 18b47c1d5b..83a884928b 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application +++ b/Tools/ArdupilotMegaPlanner/bin/Release/ArdupilotMegaPlanner.application @@ -11,7 +11,7 @@ - nmdAqsMY8QQaIQ5jETLjlb/P7G8= + asA4p3xM8idcyyuyecIXR3bVsug= diff --git a/Tools/ArdupilotMegaPlanner/bin/Release/dataflashlog.xml b/Tools/ArdupilotMegaPlanner/bin/Release/dataflashlog.xml index 430e3cc231..186d8d32da 100644 --- a/Tools/ArdupilotMegaPlanner/bin/Release/dataflashlog.xml +++ b/Tools/ArdupilotMegaPlanner/bin/Release/dataflashlog.xml @@ -36,23 +36,23 @@ Yaw Sensor Nav Yaw Yaw Error - Throttle Out - Sonar Alt - Baro Alt - Next WP Alt - Throttle I + Sonar Alt + Baro Alt + Next WP Alt + Nav Throttle + Angle boost + Manual boost + rc3 servo out + alt hold int + thro int - loop time - Main count - G_Dt_max - Gyro Sat - adc constr - renorm_sqrt - renorm_blowup - gps_fix count - imu_health - Throttle Sum + control mode + yaw mode + r p mode + thro mode + thro cruise + thro int Gyro X diff --git a/Tools/ArdupilotMegaPlanner/dataflashlog.xml b/Tools/ArdupilotMegaPlanner/dataflashlog.xml index 430e3cc231..186d8d32da 100644 --- a/Tools/ArdupilotMegaPlanner/dataflashlog.xml +++ b/Tools/ArdupilotMegaPlanner/dataflashlog.xml @@ -36,23 +36,23 @@ Yaw Sensor Nav Yaw Yaw Error - Throttle Out - Sonar Alt - Baro Alt - Next WP Alt - Throttle I + Sonar Alt + Baro Alt + Next WP Alt + Nav Throttle + Angle boost + Manual boost + rc3 servo out + alt hold int + thro int - loop time - Main count - G_Dt_max - Gyro Sat - adc constr - renorm_sqrt - renorm_blowup - gps_fix count - imu_health - Throttle Sum + control mode + yaw mode + r p mode + thro mode + thro cruise + thro int Gyro X diff --git a/Tools/ArdupilotMegaPlanner/mavlinklist.pl b/Tools/ArdupilotMegaPlanner/mavlinklist.pl index ba4f5a59dd..d5aade1b3d 100644 --- a/Tools/ArdupilotMegaPlanner/mavlinklist.pl +++ b/Tools/ArdupilotMegaPlanner/mavlinklist.pl @@ -2,8 +2,8 @@ $dir = "C:/Users/hog/Documents/Arduino/libraries/GCS_MAVLink/include/common/"; $dir2 = "C:/Users/hog/Documents/Arduino/libraries/GCS_MAVLink/include/ardupilotmega/"; # mavlink 1.0 with old structs -$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/"; +$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/"; opendir(DIR,$dir) || die print $!; @files2 = readdir(DIR); @@ -59,8 +59,12 @@ foreach $file (@files) { } if ($line =~ /#define (MAVLINK_MSG_ID[^\s]+)\s+([0-9]+)/) { - print OUT "\t\tpublic const byte ".$1 . " = " . $2 . ";\n"; - $no = $2; + if ($line =~ /MAVLINK_MSG_ID_([0-9]+)_LEN/) { + next; + } else { + print OUT "\t\tpublic const byte ".$1 . " = " . $2 . ";\n"; + $no = $2; + } } if ($line =~ /typedef struct(.*)/) { if ($1 =~ /__mavlink_system|param_union/) { @@ -81,6 +85,7 @@ foreach $file (@files) { $line =~ s/typedef/public/; $line =~ s/uint8_t/public byte/; $line =~ s/int8_t/public byte/; + $line =~ s/char/public byte/; $line =~ s/^\s+float/public float/; $line =~ s/uint16_t/public ushort/; $line =~ s/uint32_t/public uint/;