mirror of https://github.com/ArduPilot/ardupilot
APM Planner 1.1.64
work on CodeGen fix messagebox wrap modify arducopter loiter options fix setmode function update dataflash log format- thanks randy remove config.xml - this causes overwriting user settings
This commit is contained in:
parent
8f0bc57967
commit
64a1c45dcd
|
@ -4,6 +4,7 @@ using System.Management;
|
|||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using System.Globalization;
|
||||
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{76374F95-C343-4ACC-B86F-7ECFDD668F46} = {76374F95-C343-4ACC-B86F-7ECFDD668F46}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{E64A1A41-A5B0-458E-8284-BB63705354DA}"
|
||||
EndProject
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace ArdupilotMega
|
|||
return answer;
|
||||
}
|
||||
|
||||
static CodeDomProvider CreateCompiler()
|
||||
public static CodeDomProvider CreateCompiler()
|
||||
{
|
||||
//Create an instance of the C# compiler
|
||||
CodeDomProvider codeProvider = CodeDomProvider.CreateProvider("CSharp");
|
||||
|
@ -61,7 +61,7 @@ namespace ArdupilotMega
|
|||
/// Creawte parameters for compiling
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
static CompilerParameters CreateCompilerParameters()
|
||||
public static CompilerParameters CreateCompilerParameters()
|
||||
{
|
||||
//add compiler parameters and assembly references
|
||||
CompilerParameters compilerParams = new CompilerParameters();
|
||||
|
@ -71,7 +71,9 @@ namespace ArdupilotMega
|
|||
compilerParams.IncludeDebugInformation = false;
|
||||
compilerParams.ReferencedAssemblies.Add("mscorlib.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("System.dll");
|
||||
compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
|
||||
compilerParams.ReferencedAssemblies.Add(Application.ExecutablePath);
|
||||
|
||||
compilerParams.ReferencedAssemblies.Add("");
|
||||
|
||||
//add any aditional references needed
|
||||
// foreach (string refAssembly in code.References)
|
||||
|
@ -87,7 +89,7 @@ namespace ArdupilotMega
|
|||
/// <param name="parms"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
static private CompilerResults CompileCode(CodeDomProvider compiler, CompilerParameters parms, string source)
|
||||
public static CompilerResults CompileCode(CodeDomProvider compiler, CompilerParameters parms, string source)
|
||||
{
|
||||
//actually compile the code
|
||||
CompilerResults results = compiler.CompileAssemblyFromSource(
|
||||
|
@ -109,7 +111,7 @@ namespace ArdupilotMega
|
|||
/// </summary>
|
||||
/// <param name="eval">evaluation expression</param>
|
||||
/// <returns></returns>
|
||||
static string RefineEvaluationString(string eval)
|
||||
public static string RefineEvaluationString(string eval)
|
||||
{
|
||||
// look for regular expressions with only letters
|
||||
Regex regularExpression = new Regex("[a-zA-Z_]+");
|
||||
|
@ -140,7 +142,7 @@ namespace ArdupilotMega
|
|||
/// Compiles the c# into an assembly if there are no syntax errors
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
static private CompilerResults CompileAssembly()
|
||||
public static CompilerResults CompileAssembly()
|
||||
{
|
||||
// create a compiler
|
||||
CodeDomProvider compiler = CreateCompiler();
|
||||
|
@ -155,7 +157,7 @@ namespace ArdupilotMega
|
|||
static ArrayList _mathMembers = new ArrayList();
|
||||
static Hashtable _mathMembersMap = new Hashtable();
|
||||
|
||||
static void GetMathMemberNames()
|
||||
public static void GetMathMemberNames()
|
||||
{
|
||||
// get a reflected assembly of the System assembly
|
||||
Assembly systemAssembly = Assembly.GetAssembly(typeof(System.Math));
|
||||
|
@ -200,7 +202,7 @@ namespace ArdupilotMega
|
|||
/// Runs the Calculate method in our on-the-fly assembly
|
||||
/// </summary>
|
||||
/// <param name="results"></param>
|
||||
static private string RunCode(CompilerResults results)
|
||||
public static string RunCode(CompilerResults results)
|
||||
{
|
||||
Assembly executingAssembly = results.CompiledAssembly;
|
||||
try
|
||||
|
@ -238,13 +240,13 @@ namespace ArdupilotMega
|
|||
}
|
||||
|
||||
|
||||
static CodeMemberField FieldVariable(string fieldName, string typeName, MemberAttributes accessLevel)
|
||||
public static CodeMemberField FieldVariable(string fieldName, string typeName, MemberAttributes accessLevel)
|
||||
{
|
||||
CodeMemberField field = new CodeMemberField(typeName, fieldName);
|
||||
field.Attributes = accessLevel;
|
||||
return field;
|
||||
}
|
||||
static CodeMemberField FieldVariable(string fieldName, Type type, MemberAttributes accessLevel)
|
||||
public static CodeMemberField FieldVariable(string fieldName, Type type, MemberAttributes accessLevel)
|
||||
{
|
||||
CodeMemberField field = new CodeMemberField(type, fieldName);
|
||||
field.Attributes = accessLevel;
|
||||
|
@ -258,7 +260,7 @@ namespace ArdupilotMega
|
|||
/// <param name="internalName"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
static CodeMemberProperty MakeProperty(string propertyName, string internalName, Type type)
|
||||
public static CodeMemberProperty MakeProperty(string propertyName, string internalName, Type type)
|
||||
{
|
||||
CodeMemberProperty myProperty = new CodeMemberProperty();
|
||||
myProperty.Name = propertyName;
|
||||
|
@ -285,7 +287,7 @@ namespace ArdupilotMega
|
|||
/// <summary>
|
||||
/// Main driving routine for building a class
|
||||
/// </summary>
|
||||
static void BuildClass(string expression)
|
||||
public static void BuildClass(string expression)
|
||||
{
|
||||
// need a string to put the code into
|
||||
_source = new StringBuilder();
|
||||
|
@ -300,6 +302,8 @@ namespace ArdupilotMega
|
|||
myNamespace.Imports.Add(new CodeNamespaceImport("System"));
|
||||
myNamespace.Imports.Add(new CodeNamespaceImport("System.Windows.Forms"));
|
||||
|
||||
myNamespace.Imports.Add(new CodeNamespaceImport("ArdupilotMega"));
|
||||
|
||||
//Build the class declaration and member variables
|
||||
CodeTypeDeclaration classDeclaration = new CodeTypeDeclaration();
|
||||
classDeclaration.IsClass = true;
|
||||
|
@ -312,12 +316,16 @@ namespace ArdupilotMega
|
|||
defaultConstructor.Attributes = MemberAttributes.Public;
|
||||
defaultConstructor.Comments.Add(new CodeCommentStatement("Default Constructor for class", true));
|
||||
defaultConstructor.Statements.Add(new CodeSnippetStatement("//TODO: implement default constructor"));
|
||||
|
||||
classDeclaration.Members.Add(defaultConstructor);
|
||||
|
||||
|
||||
|
||||
//property
|
||||
classDeclaration.Members.Add(MakeProperty("Answer", "answer", typeof(object)));
|
||||
|
||||
//Our Calculate Method
|
||||
/*
|
||||
CodeMemberMethod myMethod = new CodeMemberMethod();
|
||||
myMethod.Name = "Calculate";
|
||||
myMethod.ReturnType = new CodeTypeReference(typeof(object));
|
||||
|
@ -328,11 +336,24 @@ namespace ArdupilotMega
|
|||
myMethod.Statements.Add(
|
||||
new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "Answer")));
|
||||
classDeclaration.Members.Add(myMethod);
|
||||
*/
|
||||
|
||||
classDeclaration.Members.Add(FieldVariable("customforusenumber", typeof(double), MemberAttributes.Public));
|
||||
classDeclaration.Members.Add(FieldVariable("customforuseobject", typeof(object), MemberAttributes.Public));
|
||||
|
||||
CodeSnippetTypeMember myMethod = new CodeSnippetTypeMember();
|
||||
|
||||
myMethod.Text = expression;
|
||||
|
||||
classDeclaration.Members.Add(myMethod);
|
||||
|
||||
//write code
|
||||
myNamespace.Types.Add(classDeclaration);
|
||||
generator.GenerateCodeFromNamespace(myNamespace, sw, codeOpts);
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
|
||||
Console.Write(sw.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using ArdupilotMega.Controls;
|
||||
//using ArdupilotMega.Controls;
|
||||
using System.Text;
|
||||
using ArdupilotMega;
|
||||
|
||||
|
@ -141,6 +141,11 @@ namespace System.Windows.Forms
|
|||
sb.Append(Environment.NewLine);
|
||||
currentLinePosition = 0;
|
||||
}
|
||||
// reset line lnegth counter on existing new line
|
||||
if (text[textIndex] == Environment.NewLine[Environment.NewLine.Length -1])
|
||||
{
|
||||
currentLinePosition = 0;
|
||||
}
|
||||
// If we have just started a new line, skip all the whitespace.
|
||||
if (currentLinePosition == 0)
|
||||
while (textIndex < text.Length && char.IsWhiteSpace(text[textIndex]))
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using ArdupilotMega.Mavlink;
|
||||
using log4net;
|
||||
|
||||
namespace ArdupilotMega
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Configuration));
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.Params = new System.Windows.Forms.DataGridView();
|
||||
this.Command = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
|
@ -181,10 +181,6 @@
|
|||
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.NumericUpDown();
|
||||
this.label28 = new System.Windows.Forms.Label();
|
||||
this.HLD_LAT_I = new System.Windows.Forms.NumericUpDown();
|
||||
this.label30 = new System.Windows.Forms.Label();
|
||||
this.HLD_LAT_P = new System.Windows.Forms.NumericUpDown();
|
||||
this.label31 = new System.Windows.Forms.Label();
|
||||
this.groupBox20 = new System.Windows.Forms.GroupBox();
|
||||
|
@ -291,6 +287,13 @@
|
|||
this.BUT_load = new ArdupilotMega.MyButton();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.BUT_compare = new ArdupilotMega.MyButton();
|
||||
this.groupBox17 = new System.Windows.Forms.GroupBox();
|
||||
this.LOITER_LAT_D = new System.Windows.Forms.NumericUpDown();
|
||||
this.label28 = new System.Windows.Forms.Label();
|
||||
this.LOITER_LAT_I = new System.Windows.Forms.NumericUpDown();
|
||||
this.label30 = new System.Windows.Forms.Label();
|
||||
this.LOITER_LAT_P = new System.Windows.Forms.NumericUpDown();
|
||||
this.label40 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.Params)).BeginInit();
|
||||
this.ConfigTabs.SuspendLayout();
|
||||
this.TabAP.SuspendLayout();
|
||||
|
@ -371,8 +374,6 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.THR_ALT_I)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.THR_ALT_P)).BeginInit();
|
||||
this.groupBox19.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.HLD_LAT_IMAX)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.HLD_LAT_I)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.HLD_LAT_P)).BeginInit();
|
||||
this.groupBox20.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.STB_YAW_IMAX)).BeginInit();
|
||||
|
@ -404,6 +405,10 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.RATE_RLL_P)).BeginInit();
|
||||
this.TabPlanner.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUM_tracklength)).BeginInit();
|
||||
this.groupBox17.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LOITER_LAT_D)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LOITER_LAT_I)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LOITER_LAT_P)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// Params
|
||||
|
@ -411,14 +416,14 @@
|
|||
this.Params.AllowUserToAddRows = false;
|
||||
this.Params.AllowUserToDeleteRows = false;
|
||||
resources.ApplyResources(this.Params, "Params");
|
||||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.Maroon;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle1.ForeColor = System.Drawing.Color.White;
|
||||
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Params.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
|
||||
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle3.BackColor = System.Drawing.Color.Maroon;
|
||||
dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle3.ForeColor = System.Drawing.Color.White;
|
||||
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Params.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.Params.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.Params.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Command,
|
||||
|
@ -427,14 +432,14 @@
|
|||
this.mavScale,
|
||||
this.RawValue});
|
||||
this.Params.Name = "Params";
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.ActiveCaption;
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Params.RowHeadersDefaultCellStyle = dataGridViewCellStyle2;
|
||||
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.ActiveCaption;
|
||||
dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Params.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.Params.RowHeadersVisible = false;
|
||||
this.Params.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.Params_CellValueChanged);
|
||||
this.Params.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Params_KeyDown);
|
||||
|
@ -1097,14 +1102,7 @@
|
|||
//
|
||||
// TabAC
|
||||
//
|
||||
this.TabAC.Controls.Add(this.myLabel4);
|
||||
this.TabAC.Controls.Add(this.myLabel3);
|
||||
this.TabAC.Controls.Add(this.TUNE_LOW);
|
||||
this.TabAC.Controls.Add(this.TUNE_HIGH);
|
||||
this.TabAC.Controls.Add(this.myLabel2);
|
||||
this.TabAC.Controls.Add(this.TUNE);
|
||||
this.TabAC.Controls.Add(this.myLabel1);
|
||||
this.TabAC.Controls.Add(this.CH7_OPT);
|
||||
this.TabAC.Controls.Add(this.groupBox17);
|
||||
this.TabAC.Controls.Add(this.groupBox5);
|
||||
this.TabAC.Controls.Add(this.CHK_lockrollpitch);
|
||||
this.TabAC.Controls.Add(this.groupBox4);
|
||||
|
@ -1393,36 +1391,18 @@
|
|||
//
|
||||
// groupBox19
|
||||
//
|
||||
this.groupBox19.Controls.Add(this.HLD_LAT_IMAX);
|
||||
this.groupBox19.Controls.Add(this.LOITER_LAT_D);
|
||||
this.groupBox19.Controls.Add(this.label28);
|
||||
this.groupBox19.Controls.Add(this.HLD_LAT_I);
|
||||
this.groupBox19.Controls.Add(this.LOITER_LAT_I);
|
||||
this.groupBox19.Controls.Add(this.label30);
|
||||
this.groupBox19.Controls.Add(this.LOITER_LAT_P);
|
||||
this.groupBox19.Controls.Add(this.label40);
|
||||
this.groupBox19.Controls.Add(this.HLD_LAT_P);
|
||||
this.groupBox19.Controls.Add(this.label31);
|
||||
resources.ApplyResources(this.groupBox19, "groupBox19");
|
||||
this.groupBox19.Name = "groupBox19";
|
||||
this.groupBox19.TabStop = false;
|
||||
//
|
||||
// HLD_LAT_IMAX
|
||||
//
|
||||
resources.ApplyResources(this.HLD_LAT_IMAX, "HLD_LAT_IMAX");
|
||||
this.HLD_LAT_IMAX.Name = "HLD_LAT_IMAX";
|
||||
//
|
||||
// label28
|
||||
//
|
||||
resources.ApplyResources(this.label28, "label28");
|
||||
this.label28.Name = "label28";
|
||||
//
|
||||
// HLD_LAT_I
|
||||
//
|
||||
resources.ApplyResources(this.HLD_LAT_I, "HLD_LAT_I");
|
||||
this.HLD_LAT_I.Name = "HLD_LAT_I";
|
||||
//
|
||||
// label30
|
||||
//
|
||||
resources.ApplyResources(this.label30, "label30");
|
||||
this.label30.Name = "label30";
|
||||
//
|
||||
// HLD_LAT_P
|
||||
//
|
||||
resources.ApplyResources(this.HLD_LAT_P, "HLD_LAT_P");
|
||||
|
@ -2173,6 +2153,50 @@
|
|||
this.BUT_compare.UseVisualStyleBackColor = true;
|
||||
this.BUT_compare.Click += new System.EventHandler(this.BUT_compare_Click);
|
||||
//
|
||||
// groupBox17
|
||||
//
|
||||
this.groupBox17.Controls.Add(this.myLabel2);
|
||||
this.groupBox17.Controls.Add(this.myLabel4);
|
||||
this.groupBox17.Controls.Add(this.CH7_OPT);
|
||||
this.groupBox17.Controls.Add(this.myLabel3);
|
||||
this.groupBox17.Controls.Add(this.myLabel1);
|
||||
this.groupBox17.Controls.Add(this.TUNE_LOW);
|
||||
this.groupBox17.Controls.Add(this.TUNE);
|
||||
this.groupBox17.Controls.Add(this.TUNE_HIGH);
|
||||
resources.ApplyResources(this.groupBox17, "groupBox17");
|
||||
this.groupBox17.Name = "groupBox17";
|
||||
this.groupBox17.TabStop = false;
|
||||
//
|
||||
// LOITER_LAT_D
|
||||
//
|
||||
resources.ApplyResources(this.LOITER_LAT_D, "LOITER_LAT_D");
|
||||
this.LOITER_LAT_D.Name = "LOITER_LAT_D";
|
||||
//
|
||||
// label28
|
||||
//
|
||||
resources.ApplyResources(this.label28, "label28");
|
||||
this.label28.Name = "label28";
|
||||
//
|
||||
// LOITER_LAT_I
|
||||
//
|
||||
resources.ApplyResources(this.LOITER_LAT_I, "LOITER_LAT_I");
|
||||
this.LOITER_LAT_I.Name = "LOITER_LAT_I";
|
||||
//
|
||||
// label30
|
||||
//
|
||||
resources.ApplyResources(this.label30, "label30");
|
||||
this.label30.Name = "label30";
|
||||
//
|
||||
// LOITER_LAT_P
|
||||
//
|
||||
resources.ApplyResources(this.LOITER_LAT_P, "LOITER_LAT_P");
|
||||
this.LOITER_LAT_P.Name = "LOITER_LAT_P";
|
||||
//
|
||||
// label40
|
||||
//
|
||||
resources.ApplyResources(this.label40, "label40");
|
||||
this.label40.Name = "label40";
|
||||
//
|
||||
// Configuration
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
|
@ -2268,8 +2292,6 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.THR_ALT_I)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.THR_ALT_P)).EndInit();
|
||||
this.groupBox19.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.HLD_LAT_IMAX)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.HLD_LAT_I)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.HLD_LAT_P)).EndInit();
|
||||
this.groupBox20.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.STB_YAW_IMAX)).EndInit();
|
||||
|
@ -2301,6 +2323,10 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.RATE_RLL_P)).EndInit();
|
||||
this.TabPlanner.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUM_tracklength)).EndInit();
|
||||
this.groupBox17.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.LOITER_LAT_D)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LOITER_LAT_I)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LOITER_LAT_P)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -2432,10 +2458,6 @@
|
|||
private System.Windows.Forms.NumericUpDown THR_ALT_P;
|
||||
private System.Windows.Forms.Label label22;
|
||||
private System.Windows.Forms.GroupBox groupBox19;
|
||||
private System.Windows.Forms.NumericUpDown HLD_LAT_IMAX;
|
||||
private System.Windows.Forms.Label label28;
|
||||
private System.Windows.Forms.NumericUpDown HLD_LAT_I;
|
||||
private System.Windows.Forms.Label label30;
|
||||
private System.Windows.Forms.NumericUpDown HLD_LAT_P;
|
||||
private System.Windows.Forms.Label label31;
|
||||
private System.Windows.Forms.GroupBox groupBox20;
|
||||
|
@ -2566,5 +2588,12 @@
|
|||
private System.Windows.Forms.ComboBox CMB_ratesensors;
|
||||
private MyLabel myLabel4;
|
||||
private MyLabel myLabel3;
|
||||
private System.Windows.Forms.GroupBox groupBox17;
|
||||
private System.Windows.Forms.NumericUpDown LOITER_LAT_D;
|
||||
private System.Windows.Forms.Label label28;
|
||||
private System.Windows.Forms.NumericUpDown LOITER_LAT_I;
|
||||
private System.Windows.Forms.Label label30;
|
||||
private System.Windows.Forms.NumericUpDown LOITER_LAT_P;
|
||||
private System.Windows.Forms.Label label40;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -512,6 +512,19 @@ namespace ArdupilotMega.GCSViews
|
|||
}
|
||||
}
|
||||
}
|
||||
// keep nav_lat and nav_lon paired
|
||||
if (name.Contains("LOITER_LAT_"))
|
||||
{
|
||||
string newname = name.Replace("LOITER_LAT_", "LOITER_LON_");
|
||||
foreach (DataGridViewRow row in Params.Rows)
|
||||
{
|
||||
if (row.Cells[0].Value.ToString() == newname)
|
||||
{
|
||||
row.Cells[1].Value = float.Parse(((Control)sender).Text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1002,6 +1002,16 @@ namespace ArdupilotMega.GCSViews
|
|||
|
||||
private void BUT_loadtelem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MainV2.comPort.logplaybackfile != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
MainV2.comPort.logplaybackfile.Close();
|
||||
MainV2.comPort.logplaybackfile = null;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
OpenFileDialog fd = new OpenFileDialog();
|
||||
fd.AddExtension = true;
|
||||
fd.Filter = "Ardupilot Telemtry log (*.tlog)|*.tlog|Mavlink Log (*.mavlog)|*.mavlog";
|
||||
|
|
|
@ -12,7 +12,6 @@ using System.Runtime.InteropServices; // dll imports
|
|||
using log4net;
|
||||
using ZedGraph; // Graphs
|
||||
using ArdupilotMega;
|
||||
using ArdupilotMega.Mavlink;
|
||||
using System.Reflection;
|
||||
|
||||
using System.Drawing.Drawing2D;
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace ArdupilotMega.HIL
|
|||
delta_time = new TimeSpan(0, 0, 0, 0, 20);
|
||||
}
|
||||
|
||||
// rotational acceleration, in degrees/s/s, in body frame
|
||||
// rotational acceleration, in degrees/s/s, in body frame
|
||||
double roll_accel = 0.0;
|
||||
double pitch_accel = 0.0;
|
||||
double yaw_accel = 0.0;
|
||||
|
@ -228,7 +228,7 @@ namespace ArdupilotMega.HIL
|
|||
thrust += m[i] * self.thrust_scale; // newtons
|
||||
}
|
||||
|
||||
// rotational resistance
|
||||
// rotational resistance
|
||||
roll_accel -= (self.pDeg / self.terminal_rotation_rate) * 5000.0;
|
||||
pitch_accel -= (self.qDeg / self.terminal_rotation_rate) * 5000.0;
|
||||
yaw_accel -= (self.rDeg / self.terminal_rotation_rate) * 400.0;
|
||||
|
@ -236,23 +236,23 @@ namespace ArdupilotMega.HIL
|
|||
//Console.WriteLine("roll {0} {1} {2}", roll_accel, roll_rate, roll);
|
||||
|
||||
//# update rotational rates in body frame
|
||||
self.pDeg += roll_accel * delta_time.TotalSeconds;
|
||||
self.qDeg += pitch_accel * delta_time.TotalSeconds;
|
||||
self.rDeg += yaw_accel * delta_time.TotalSeconds;
|
||||
self.pDeg += roll_accel * delta_time.TotalSeconds;
|
||||
self.qDeg += pitch_accel * delta_time.TotalSeconds;
|
||||
self.rDeg += yaw_accel * delta_time.TotalSeconds;
|
||||
|
||||
// Console.WriteLine("roll {0} {1} {2}", roll_accel, roll_rate, roll);
|
||||
|
||||
// calculate rates in earth frame
|
||||
|
||||
var answer = BodyRatesToEarthRates(self.roll, self.pitch, self.yaw,
|
||||
self.pDeg, self.qDeg, self.rDeg);
|
||||
self.roll_rate = answer.Item1;
|
||||
self.pitch_rate = answer.Item2;
|
||||
self.yaw_rate = answer.Item3;
|
||||
|
||||
//self.roll_rate = pDeg;
|
||||
//self.pitch_rate = qDeg;
|
||||
//self.yaw_rate = rDeg;
|
||||
// calculate rates in earth frame
|
||||
|
||||
var answer = BodyRatesToEarthRates(self.roll, self.pitch, self.yaw,
|
||||
self.pDeg, self.qDeg, self.rDeg);
|
||||
self.roll_rate = answer.Item1;
|
||||
self.pitch_rate = answer.Item2;
|
||||
self.yaw_rate = answer.Item3;
|
||||
|
||||
//self.roll_rate = pDeg;
|
||||
//self.pitch_rate = qDeg;
|
||||
//self.yaw_rate = rDeg;
|
||||
|
||||
//# update rotation
|
||||
roll += roll_rate * delta_time.TotalSeconds;
|
||||
|
@ -342,9 +342,9 @@ namespace ArdupilotMega.HIL
|
|||
att.roll = (float)roll * deg2rad;
|
||||
att.pitch = (float)pitch * deg2rad;
|
||||
att.yaw = (float)yaw * deg2rad;
|
||||
att.rollspeed = (float)roll_rate *deg2rad;
|
||||
att.pitchspeed = (float)pitch_rate *deg2rad;
|
||||
att.yawspeed = (float)yaw_rate *deg2rad;
|
||||
att.rollspeed = (float)roll_rate * deg2rad;
|
||||
att.pitchspeed = (float)pitch_rate * deg2rad;
|
||||
att.yawspeed = (float)yaw_rate * deg2rad;
|
||||
|
||||
#if MAVLINK10
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ using System.IO;
|
|||
using System.Drawing;
|
||||
using System.Threading;
|
||||
using ArdupilotMega.Controls;
|
||||
using ArdupilotMega.Mavlink;
|
||||
using System.ComponentModel;
|
||||
using log4net;
|
||||
|
||||
|
@ -1921,12 +1920,12 @@ namespace ArdupilotMega
|
|||
|
||||
if (Common.translateMode(modein, 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_NAV_MODE, navmode);
|
||||
System.Threading.Thread.Sleep(10);
|
||||
MainV2.comPort.generatePacket((byte)MAVLink.MAVLINK_MSG_ID_SET_MODE, mode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ArdupilotMega.Mavlink
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
class MavlinkCRC
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
|||
using System.Text;
|
||||
using log4net;
|
||||
|
||||
namespace ArdupilotMega.Mavlink
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
/// <summary>
|
||||
/// Static methods and helpers for creation and manipulation of Mavlink packets
|
||||
|
|
|
@ -26,6 +26,8 @@ using System.Xml;
|
|||
using log4net;
|
||||
using ZedGraph; // Graphs
|
||||
|
||||
using System.CodeDom.Compiler;
|
||||
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
public partial class MavlinkLog : Form
|
||||
|
@ -35,8 +37,10 @@ namespace ArdupilotMega
|
|||
List<CurrentState> flightdata = new List<CurrentState>();
|
||||
|
||||
List<string> selection = new List<string>();
|
||||
List<string> options = new List<string>();
|
||||
|
||||
Hashtable data = new Hashtable();
|
||||
Hashtable datappl = new Hashtable();
|
||||
Hashtable packetdata = new Hashtable();
|
||||
|
||||
PointLatLngAlt homepos = new PointLatLngAlt();
|
||||
|
||||
|
@ -620,148 +624,6 @@ namespace ArdupilotMega
|
|||
0xE00000,0x00E000,0x0000E0,0xE0E000,0xE000E0,0x00E0E0,0xE0E0E0,
|
||||
};
|
||||
|
||||
|
||||
private void GetLogFileData(ZedGraphControl zg1, string logfile, List<string> lookforfields)
|
||||
{
|
||||
if (zg1 == null)
|
||||
return;
|
||||
|
||||
if (lookforfields != null && lookforfields.Count == 0)
|
||||
return;
|
||||
|
||||
PointPairList[] lists = new PointPairList[lookforfields.Count];
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
// setup arrays
|
||||
for (int a = 0; a < lookforfields.Count; a++)
|
||||
{
|
||||
lists[a] = new PointPairList();
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
MAVLink MavlinkInterface = new MAVLink();
|
||||
MavlinkInterface.logplaybackfile = new BinaryReader(File.Open(logfile, FileMode.Open, FileAccess.Read, FileShare.Read));
|
||||
MavlinkInterface.logreadmode = true;
|
||||
|
||||
MavlinkInterface.packets.Initialize(); // clear
|
||||
|
||||
int appui = 0;
|
||||
|
||||
// to get first packet time
|
||||
MavlinkInterface.readPacket();
|
||||
|
||||
DateTime startlogtime = MavlinkInterface.lastlogread;
|
||||
|
||||
while (MavlinkInterface.logplaybackfile.BaseStream.Position < MavlinkInterface.logplaybackfile.BaseStream.Length)
|
||||
{
|
||||
progressBar1.Value = (int)((float)MavlinkInterface.logplaybackfile.BaseStream.Position / (float)MavlinkInterface.logplaybackfile.BaseStream.Length * 100.0f);
|
||||
progressBar1.Refresh();
|
||||
|
||||
byte[] packet = MavlinkInterface.readPacket();
|
||||
|
||||
object data = MavlinkInterface.DebugPacket(packet, false);
|
||||
|
||||
Type test = data.GetType();
|
||||
|
||||
foreach (var field in test.GetFields())
|
||||
{
|
||||
// field.Name has the field's name.
|
||||
|
||||
object fieldValue = field.GetValue(data); // Get value
|
||||
|
||||
if (field.FieldType.IsArray)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
string currentitem = field.Name + " " + field.DeclaringType.Name;
|
||||
int a = 0;
|
||||
foreach (var lookforfield in lookforfields)
|
||||
{
|
||||
|
||||
if (currentitem == lookforfield)
|
||||
{
|
||||
object value = field.GetValue(data);
|
||||
// seconds scale
|
||||
double time = (MavlinkInterface.lastlogread - startlogtime).TotalMilliseconds / 1000.0;
|
||||
|
||||
if (value.GetType() == typeof(Single))
|
||||
{
|
||||
lists[a].Add(time, (Single)field.GetValue(data));
|
||||
}
|
||||
else if (value.GetType() == typeof(short))
|
||||
{
|
||||
lists[a].Add(time, (short)field.GetValue(data));
|
||||
}
|
||||
else if (value.GetType() == typeof(ushort))
|
||||
{
|
||||
lists[a].Add(time, (ushort)field.GetValue(data));
|
||||
}
|
||||
else if (value.GetType() == typeof(byte))
|
||||
{
|
||||
lists[a].Add(time, (byte)field.GetValue(data));
|
||||
}
|
||||
else if (value.GetType() == typeof(Int32))
|
||||
{
|
||||
lists[a].Add(time, (Int32)field.GetValue(data));
|
||||
}
|
||||
}
|
||||
a++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (appui != DateTime.Now.Second)
|
||||
{
|
||||
// cant do entire app as mixes with flightdata timer
|
||||
this.Refresh();
|
||||
appui = DateTime.Now.Second;
|
||||
}
|
||||
}
|
||||
|
||||
MavlinkInterface.logreadmode = false;
|
||||
MavlinkInterface.logplaybackfile.Close();
|
||||
MavlinkInterface.logplaybackfile = null;
|
||||
|
||||
|
||||
//writeKML(logfile + ".kml");
|
||||
|
||||
progressBar1.Value = 100;
|
||||
}
|
||||
|
||||
int step = 0;
|
||||
|
||||
zg1.GraphPane.AddY2Axis("PWM");
|
||||
zg1.GraphPane.AddY2Axis("Angle");
|
||||
|
||||
//zg1.GraphPane.XAxis.Title.Text = "Seconds";
|
||||
|
||||
// setup display and arrays
|
||||
for (int a = 0; a < lookforfields.Count; a++)
|
||||
{
|
||||
LineItem myCurve;
|
||||
|
||||
int colorvalue = ColourValues[step % ColourValues.Length];
|
||||
step++;
|
||||
|
||||
myCurve = zg1.GraphPane.AddCurve(lookforfields[a].Replace("mavlink_", ""), lists[a], Color.FromArgb(unchecked(colorvalue + (int)0xff000000)), SymbolType.None);
|
||||
|
||||
double xMin, xMax, yMin, yMax;
|
||||
|
||||
myCurve.GetRange(out xMin, out xMax, out yMin, out yMax, true, false, zg1.GraphPane);
|
||||
|
||||
if (yMin > 900 && yMax < 2100)
|
||||
{
|
||||
myCurve.IsY2Axis = true;
|
||||
myCurve.YAxisIndex = 0;
|
||||
zg1.GraphPane.Y2Axis.IsVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> GetLogFileValidFields(string logfile)
|
||||
{
|
||||
Form selectform = SelectDataToGraphForm();
|
||||
|
@ -770,9 +632,10 @@ namespace ArdupilotMega
|
|||
|
||||
selection = new List<string>();
|
||||
|
||||
List<string> options = new List<string>();
|
||||
options = new List<string>();
|
||||
|
||||
this.data.Clear();
|
||||
this.datappl.Clear();
|
||||
this.packetdata.Clear();
|
||||
|
||||
colorStep = 0;
|
||||
|
||||
|
@ -812,6 +675,22 @@ namespace ArdupilotMega
|
|||
|
||||
Type test = data.GetType();
|
||||
|
||||
|
||||
if (true) {
|
||||
string packetname = test.Name.Replace("mavlink_", "").Replace("_t", "").ToUpper();
|
||||
|
||||
if (!packetdata.ContainsKey(packetname))
|
||||
{
|
||||
packetdata[packetname] = new Dictionary<double,object>();
|
||||
}
|
||||
|
||||
Dictionary<double, object> temp = (Dictionary<double, object>)packetdata[packetname];
|
||||
|
||||
double time = (MavlinkInterface.lastlogread - startlogtime).TotalMilliseconds / 1000.0;
|
||||
|
||||
temp[time] = data;
|
||||
}
|
||||
|
||||
foreach (var field in test.GetFields())
|
||||
{
|
||||
// field.Name has the field's name.
|
||||
|
@ -831,10 +710,10 @@ namespace ArdupilotMega
|
|||
options.Add(field.DeclaringType.Name + "." + field.Name);
|
||||
}
|
||||
|
||||
if (!this.data.ContainsKey(field.Name + " " + field.DeclaringType.Name))
|
||||
this.data[field.Name + " " + field.DeclaringType.Name] = new PointPairList();
|
||||
if (!this.datappl.ContainsKey(field.Name + " " + field.DeclaringType.Name))
|
||||
this.datappl[field.Name + " " + field.DeclaringType.Name] = new PointPairList();
|
||||
|
||||
PointPairList list = ((PointPairList)this.data[field.Name + " " + field.DeclaringType.Name]);
|
||||
PointPairList list = ((PointPairList)this.datappl[field.Name + " " + field.DeclaringType.Name]);
|
||||
|
||||
object value = fieldValue;
|
||||
// seconds scale
|
||||
|
@ -860,6 +739,14 @@ namespace ArdupilotMega
|
|||
{
|
||||
list.Add(time, (Int32)field.GetValue(data));
|
||||
}
|
||||
else if (value.GetType() == typeof(ulong))
|
||||
{
|
||||
list.Add(time, (ulong)field.GetValue(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -871,9 +758,12 @@ namespace ArdupilotMega
|
|||
try
|
||||
{
|
||||
|
||||
addMagField(ref options);
|
||||
dospecial("GPS_RAW");
|
||||
|
||||
addDistHome(ref options);
|
||||
|
||||
addMagField();
|
||||
|
||||
addDistHome();
|
||||
|
||||
}
|
||||
catch (Exception ex) { log.Info(ex.ToString()); }
|
||||
|
@ -901,42 +791,143 @@ namespace ArdupilotMega
|
|||
return selection;
|
||||
}
|
||||
|
||||
public static T Cast<T>(object o)
|
||||
{
|
||||
return (T)o;
|
||||
}
|
||||
|
||||
void dospecial(string PacketName)
|
||||
{
|
||||
string test = @"0; float test = (float)Sin(55) + 10;
|
||||
test += (float)sin(45);
|
||||
return test;
|
||||
Dictionary<double, object> temp = null;
|
||||
|
||||
try
|
||||
{
|
||||
temp = (Dictionary<double, object>)packetdata[PacketName];
|
||||
}
|
||||
catch
|
||||
{
|
||||
CustomMessageBox.Show("Bad PacketName");
|
||||
return;
|
||||
}
|
||||
|
||||
string code = @"
|
||||
|
||||
public double stage(object inp) {
|
||||
return getAltAboveHome((MAVLink.mavlink_gps_raw_t) inp);
|
||||
}
|
||||
|
||||
public double getAltAboveHome(MAVLink.mavlink_gps_raw_t gps)
|
||||
{
|
||||
if (customforusenumber == -1 && gps.fix_type != 2)
|
||||
customforusenumber = gps.alt;
|
||||
|
||||
return gps.alt - customforusenumber;
|
||||
}
|
||||
";
|
||||
|
||||
object answer = CodeGen.runCode(test);
|
||||
// build the class using codedom
|
||||
CodeGen.BuildClass(code);
|
||||
|
||||
// compile the class into an in-memory assembly.
|
||||
// if it doesn't compile, show errors in the window
|
||||
CompilerResults results = CodeGen.CompileAssembly();
|
||||
|
||||
if (results != null && results.CompiledAssembly != null)
|
||||
{
|
||||
string field = "Custom Custom"; // reverse bellow
|
||||
|
||||
options.Add("Custom.Custom");
|
||||
|
||||
this.datappl[field] = new PointPairList();
|
||||
|
||||
|
||||
|
||||
MethodInfo mi = RunCode(results);
|
||||
|
||||
|
||||
// from here
|
||||
PointPairList result = (PointPairList)this.datappl[field];
|
||||
|
||||
object assemblyInstance = results.CompiledAssembly.CreateInstance("ExpressionEvaluator.Calculator");
|
||||
|
||||
foreach (double time in temp.Keys)
|
||||
{
|
||||
result.Add(time, (double)mi.Invoke(assemblyInstance, new object[] { temp[time] }));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomMessageBox.Show("Compile Failed");
|
||||
return;
|
||||
}
|
||||
|
||||
object answer = CodeGen.runCode(code);
|
||||
|
||||
Console.WriteLine(answer);
|
||||
}
|
||||
|
||||
public MethodInfo RunCode(CompilerResults results)
|
||||
{
|
||||
Assembly executingAssembly = results.CompiledAssembly;
|
||||
try
|
||||
{
|
||||
//cant call the entry method if the assembly is null
|
||||
if (executingAssembly != null)
|
||||
{
|
||||
object assemblyInstance = executingAssembly.CreateInstance("ExpressionEvaluator.Calculator");
|
||||
//Use reflection to call the static Main function
|
||||
|
||||
Module[] modules = executingAssembly.GetModules(false);
|
||||
Type[] types = modules[0].GetTypes();
|
||||
|
||||
//loop through each class that was defined and look for the first occurrance of the entry point method
|
||||
foreach (Type type in types)
|
||||
{
|
||||
MethodInfo[] mis = type.GetMethods();
|
||||
foreach (MethodInfo mi in mis)
|
||||
{
|
||||
if (mi.Name == "stage")
|
||||
{
|
||||
return mi;
|
||||
//object result = mi.Invoke(assemblyInstance, null);
|
||||
//return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error: An exception occurred while executing the script", ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
PointPairList GetValuesForField(string name)
|
||||
{
|
||||
// eg RAW_IMU.xmag to "xmag mavlink_raw_imu_t"
|
||||
|
||||
string[] items = name.ToLower().Split(new char[] {'.',' '});
|
||||
|
||||
PointPairList list = ((PointPairList)this.data[items[1] + " mavlink_" + items[0] + "_t"]);
|
||||
PointPairList list = ((PointPairList)this.datappl[items[1] + " mavlink_" + items[0] + "_t"]);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void addMagField(ref List<string> options)
|
||||
void addMagField()
|
||||
{
|
||||
string field = "mag_field Custom";
|
||||
|
||||
options.Add("Custom.mag_field");
|
||||
|
||||
this.data[field] = new PointPairList();
|
||||
this.datappl[field] = new PointPairList();
|
||||
|
||||
PointPairList list = ((PointPairList)this.data[field]);
|
||||
PointPairList list = ((PointPairList)this.datappl[field]);
|
||||
|
||||
PointPairList listx = ((PointPairList)this.data["xmag mavlink_raw_imu_t"]);
|
||||
PointPairList listy = ((PointPairList)this.data["ymag mavlink_raw_imu_t"]);
|
||||
PointPairList listz = ((PointPairList)this.data["zmag mavlink_raw_imu_t"]);
|
||||
PointPairList listx = ((PointPairList)this.datappl["xmag mavlink_raw_imu_t"]);
|
||||
PointPairList listy = ((PointPairList)this.datappl["ymag mavlink_raw_imu_t"]);
|
||||
PointPairList listz = ((PointPairList)this.datappl["zmag mavlink_raw_imu_t"]);
|
||||
|
||||
//(float)Math.Sqrt(Math.Pow(mx, 2) + Math.Pow(my, 2) + Math.Pow(mz, 2));
|
||||
|
||||
|
@ -951,22 +942,22 @@ return test;
|
|||
}
|
||||
}
|
||||
|
||||
void addDistHome(ref List<string> options)
|
||||
void addDistHome()
|
||||
{
|
||||
string field = "dist_home Custom";
|
||||
|
||||
options.Add("Custom.dist_home");
|
||||
|
||||
this.data[field] = new PointPairList();
|
||||
this.datappl[field] = new PointPairList();
|
||||
|
||||
PointLatLngAlt home = new PointLatLngAlt();
|
||||
|
||||
PointPairList list = ((PointPairList)this.data[field]);
|
||||
PointPairList list = ((PointPairList)this.datappl[field]);
|
||||
|
||||
PointPairList listfix = ((PointPairList)this.data["fix_type mavlink_gps_raw_t"]);
|
||||
PointPairList listx = ((PointPairList)this.data["lat mavlink_gps_raw_t"]);
|
||||
PointPairList listy = ((PointPairList)this.data["lon mavlink_gps_raw_t"]);
|
||||
PointPairList listz = ((PointPairList)this.data["alt mavlink_gps_raw_t"]);
|
||||
PointPairList listfix = ((PointPairList)this.datappl["fix_type mavlink_gps_raw_t"]);
|
||||
PointPairList listx = ((PointPairList)this.datappl["lat mavlink_gps_raw_t"]);
|
||||
PointPairList listy = ((PointPairList)this.datappl["lon mavlink_gps_raw_t"]);
|
||||
PointPairList listz = ((PointPairList)this.datappl["alt mavlink_gps_raw_t"]);
|
||||
|
||||
for (int a = 0; a < listfix.Count; a++)
|
||||
{
|
||||
|
@ -1079,7 +1070,7 @@ return test;
|
|||
int colorvalue = ColourValues[colorStep % ColourValues.Length];
|
||||
colorStep++;
|
||||
|
||||
myCurve = zg1.GraphPane.AddCurve(((CheckBox)sender).Name.Replace("mavlink_", ""), (PointPairList)data[((CheckBox)sender).Name], Color.FromArgb(unchecked(colorvalue + (int)0xff000000)), SymbolType.None);
|
||||
myCurve = zg1.GraphPane.AddCurve(((CheckBox)sender).Name.Replace("mavlink_", ""), (PointPairList)datappl[((CheckBox)sender).Name], Color.FromArgb(unchecked(colorvalue + (int)0xff000000)), SymbolType.None);
|
||||
|
||||
myCurve.Tag = ((CheckBox)sender).Name;
|
||||
|
||||
|
@ -1087,7 +1078,7 @@ return test;
|
|||
myCurve.Tag.ToString() == "pitch mavlink_attitude_t" ||
|
||||
myCurve.Tag.ToString() == "yaw mavlink_attitude_t")
|
||||
{
|
||||
PointPairList ppl = new PointPairList((PointPairList)data[((CheckBox)sender).Name]);
|
||||
PointPairList ppl = new PointPairList((PointPairList)datappl[((CheckBox)sender).Name]);
|
||||
for (int a = 0; a < ppl.Count; a++)
|
||||
{
|
||||
ppl[a].Y = ppl[a].Y * (180.0 / Math.PI);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<Permission User="Everyone" GenericAll="yes" />
|
||||
</CreateFolder>
|
||||
</Component>
|
||||
<Component Id="_comp1" Guid="27583d32-d5cc-422a-a1d9-22fcb0aaf864">
|
||||
<Component Id="_comp1" Guid="a070a228-42fe-4bbc-a8f4-ca37bedc8aff">
|
||||
<File Id="_2" Source="..\bin\release\AeroSimRCAPMHil.zip" />
|
||||
<File Id="_3" Source="..\bin\release\alglibnet2.dll" />
|
||||
<File Id="_4" Source="..\bin\release\ArduCopter-sitl.exe" />
|
||||
|
@ -85,11 +85,11 @@
|
|||
<File Id="_52" Source="..\bin\release\ZedGraph.dll" />
|
||||
</Component>
|
||||
<Directory Id="aircraft52" Name="aircraft">
|
||||
<Component Id="_comp53" Guid="f064b576-e9b4-41d2-8b08-49172818c653">
|
||||
<Component Id="_comp53" Guid="31143d1e-1968-4907-9471-4e01422f9e78">
|
||||
<File Id="_54" Source="..\bin\release\aircraft\placeholder.txt" />
|
||||
</Component>
|
||||
<Directory Id="arducopter54" Name="arducopter">
|
||||
<Component Id="_comp55" Guid="4d8cdb81-fab2-4b24-ad08-cefb45253f27">
|
||||
<Component Id="_comp55" Guid="fbb61931-3ae2-4df5-86ef-3468717fccbc">
|
||||
<File Id="_56" Source="..\bin\release\aircraft\arducopter\arducopter-set.xml" />
|
||||
<File Id="_57" Source="..\bin\release\aircraft\arducopter\arducopter.jpg" />
|
||||
<File Id="_58" Source="..\bin\release\aircraft\arducopter\arducopter.xml" />
|
||||
|
@ -100,20 +100,20 @@
|
|||
<File Id="_63" Source="..\bin\release\aircraft\arducopter\README" />
|
||||
</Component>
|
||||
<Directory Id="data63" Name="data">
|
||||
<Component Id="_comp64" Guid="498fb8f9-f963-489b-bffd-605d6f70d7b1">
|
||||
<Component Id="_comp64" Guid="183432fe-1b80-4bdc-bdba-e938d240dc25">
|
||||
<File Id="_65" Source="..\bin\release\aircraft\arducopter\data\arducopter_half_step.txt" />
|
||||
<File Id="_66" Source="..\bin\release\aircraft\arducopter\data\arducopter_step.txt" />
|
||||
<File Id="_67" Source="..\bin\release\aircraft\arducopter\data\rw_generic_pylon.ac" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="Engines67" Name="Engines">
|
||||
<Component Id="_comp68" Guid="0844f5b1-b990-43f3-a3e0-1f123d6af8f2">
|
||||
<Component Id="_comp68" Guid="792df9a4-582f-47d9-b2b6-4115108c7a30">
|
||||
<File Id="_69" Source="..\bin\release\aircraft\arducopter\Engines\a2830-12.xml" />
|
||||
<File Id="_70" Source="..\bin\release\aircraft\arducopter\Engines\prop10x4.5.xml" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="Models70" Name="Models">
|
||||
<Component Id="_comp71" Guid="cead5c2b-aad8-4b6d-af62-bc3cae0ffe23">
|
||||
<Component Id="_comp71" Guid="dc93e1a8-4de1-42c4-b1fd-0a672efa9915">
|
||||
<File Id="_72" Source="..\bin\release\aircraft\arducopter\Models\arducopter.ac" />
|
||||
<File Id="_73" Source="..\bin\release\aircraft\arducopter\Models\arducopter.xml" />
|
||||
<File Id="_74" Source="..\bin\release\aircraft\arducopter\Models\plus_quad.ac" />
|
||||
|
@ -127,7 +127,7 @@
|
|||
</Directory>
|
||||
</Directory>
|
||||
<Directory Id="Rascal80" Name="Rascal">
|
||||
<Component Id="_comp81" Guid="63e7949e-2944-4ed6-849b-7a7fa45b08f7">
|
||||
<Component Id="_comp81" Guid="0c6a286d-d878-41cd-9868-3e45a61f32d8">
|
||||
<File Id="_82" Source="..\bin\release\aircraft\Rascal\Rascal-keyboard.xml" />
|
||||
<File Id="_83" Source="..\bin\release\aircraft\Rascal\Rascal-submodels.xml" />
|
||||
<File Id="_84" Source="..\bin\release\aircraft\Rascal\Rascal.xml" />
|
||||
|
@ -139,13 +139,13 @@
|
|||
<File Id="_90" Source="..\bin\release\aircraft\Rascal\thumbnail.jpg" />
|
||||
</Component>
|
||||
<Directory Id="Dialogs90" Name="Dialogs">
|
||||
<Component Id="_comp91" Guid="0e97ffbb-624b-4f93-a2c9-d58462cb82eb">
|
||||
<Component Id="_comp91" Guid="e89bdaf0-fd13-447f-93a4-29ccdc33bf20">
|
||||
<File Id="_92" Source="..\bin\release\aircraft\Rascal\Dialogs\config.xml" />
|
||||
<File Id="_93" Source="..\bin\release\aircraft\Rascal\Dialogs\config.xml.new" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="Engines93" Name="Engines">
|
||||
<Component Id="_comp94" Guid="8273a711-606c-47ba-8595-78b5b9b51f84">
|
||||
<Component Id="_comp94" Guid="97d5a6cb-c5ce-4821-b35e-4eed7f3ae541">
|
||||
<File Id="_95" Source="..\bin\release\aircraft\Rascal\Engines\18x8.xml" />
|
||||
<File Id="_96" Source="..\bin\release\aircraft\Rascal\Engines\18x8.xml.new" />
|
||||
<File Id="_97" Source="..\bin\release\aircraft\Rascal\Engines\Zenoah_G-26A.xml" />
|
||||
|
@ -153,7 +153,7 @@
|
|||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="Models98" Name="Models">
|
||||
<Component Id="_comp99" Guid="7f01cb3c-7f32-44ba-bbff-1291cef53ea4">
|
||||
<Component Id="_comp99" Guid="28612f51-e4ed-44df-90be-6e0ae10c432d">
|
||||
<File Id="_100" Source="..\bin\release\aircraft\Rascal\Models\Rascal.rgb" />
|
||||
<File Id="_101" Source="..\bin\release\aircraft\Rascal\Models\Rascal.rgb.new" />
|
||||
<File Id="_102" Source="..\bin\release\aircraft\Rascal\Models\Rascal110-000-013.ac" />
|
||||
|
@ -171,7 +171,7 @@
|
|||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="Systems113" Name="Systems">
|
||||
<Component Id="_comp114" Guid="c86479fa-e506-4548-9e69-1e25a49d2a80">
|
||||
<Component Id="_comp114" Guid="492779e1-ac02-4e65-9ff4-5b70ec5f27f5">
|
||||
<File Id="_115" Source="..\bin\release\aircraft\Rascal\Systems\110-autopilot.xml" />
|
||||
<File Id="_116" Source="..\bin\release\aircraft\Rascal\Systems\110-autopilot.xml.new" />
|
||||
<File Id="_117" Source="..\bin\release\aircraft\Rascal\Systems\airdata.nas" />
|
||||
|
@ -186,34 +186,34 @@
|
|||
</Directory>
|
||||
</Directory>
|
||||
<Directory Id="Driver123" Name="Driver">
|
||||
<Component Id="_comp124" Guid="1ead128f-9773-4e64-85a6-794cc19a761a">
|
||||
<Component Id="_comp124" Guid="877cf72e-a33f-4606-a058-4d245ecb4dda">
|
||||
<File Id="_125" Source="..\bin\release\Driver\Arduino MEGA 2560.inf" />
|
||||
<File Id="_126" Source="..\bin\release\Driver\Arduino MEGA 2560.inf.new" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="es_ES126" Name="es-ES">
|
||||
<Component Id="_comp127" Guid="804df9a1-a600-479f-90c0-d009f7b28d64">
|
||||
<Component Id="_comp127" Guid="c2c961f8-e355-4c45-a3c0-374478237e52">
|
||||
<File Id="_128" Source="..\bin\release\es-ES\ArdupilotMegaPlanner.resources.dll" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="fr128" Name="fr">
|
||||
<Component Id="_comp129" Guid="2e5d2e24-cc1b-454a-bd74-ae2db91ceaa5">
|
||||
<Component Id="_comp129" Guid="965158a9-2fa2-4347-a19f-3f0a3559f9ac">
|
||||
<File Id="_130" Source="..\bin\release\fr\ArdupilotMegaPlanner.resources.dll" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="it_IT130" Name="it-IT">
|
||||
<Component Id="_comp131" Guid="ed5edb47-dda4-44e2-99b5-a7800c8509ea">
|
||||
<Component Id="_comp131" Guid="789eabcd-e833-4015-a7ea-ebc684256168">
|
||||
<File Id="_132" Source="..\bin\release\it-IT\ArdupilotMegaPlanner.resources.dll" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="jsbsim132" Name="jsbsim">
|
||||
<Component Id="_comp133" Guid="6ad32fa2-5d4f-4aa2-a6b5-c0ab66ec4c4f">
|
||||
<Component Id="_comp133" Guid="de7781b7-50cf-456e-964b-bbc104b784f8">
|
||||
<File Id="_134" Source="..\bin\release\jsbsim\fgout.xml" />
|
||||
<File Id="_135" Source="..\bin\release\jsbsim\rascal_test.xml" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="m3u135" Name="m3u">
|
||||
<Component Id="_comp136" Guid="829a6282-d9c2-4ec2-959d-7695ac34c648">
|
||||
<Component Id="_comp136" Guid="fb23d848-2079-458e-bc11-b7f9c9ac8227">
|
||||
<File Id="_137" Source="..\bin\release\m3u\both.m3u" />
|
||||
<File Id="_138" Source="..\bin\release\m3u\hud.m3u" />
|
||||
<File Id="_139" Source="..\bin\release\m3u\map.m3u" />
|
||||
|
@ -221,12 +221,12 @@
|
|||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="pl140" Name="pl">
|
||||
<Component Id="_comp141" Guid="640061ad-2bd3-495b-bfa1-6990d087b35a">
|
||||
<Component Id="_comp141" Guid="ed518a01-a47c-4632-afc1-bbf9e134228d">
|
||||
<File Id="_142" Source="..\bin\release\pl\ArdupilotMegaPlanner.resources.dll" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="Resources142" Name="Resources">
|
||||
<Component Id="_comp143" Guid="60f0d36e-6671-48a3-b87c-2e31a3fc50a5">
|
||||
<Component Id="_comp143" Guid="d21a5a27-ddd7-4825-ae98-5792cc08710b">
|
||||
<File Id="_144" Source="..\bin\release\Resources\MAVCmd.txt" />
|
||||
<File Id="_145" Source="..\bin\release\Resources\MAVCmd.txt.new" />
|
||||
<File Id="_146" Source="..\bin\release\Resources\Welcome_to_Michael_Oborne.rtf" />
|
||||
|
@ -234,17 +234,17 @@
|
|||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="ru_RU147" Name="ru-RU">
|
||||
<Component Id="_comp148" Guid="039b8419-4534-43d0-af2f-1418890dd3d6">
|
||||
<Component Id="_comp148" Guid="4e5d3a70-4402-4105-9f33-327de86cce09">
|
||||
<File Id="_149" Source="..\bin\release\ru-RU\ArdupilotMegaPlanner.resources.dll" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="zh_Hans149" Name="zh-Hans">
|
||||
<Component Id="_comp150" Guid="287da807-7260-47c2-b782-b376d95ce68e">
|
||||
<Component Id="_comp150" Guid="bccb1a8a-580a-421d-9e00-5db6aa4f12fe">
|
||||
<File Id="_151" Source="..\bin\release\zh-Hans\ArdupilotMegaPlanner.resources.dll" />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id="zh_TW151" Name="zh-TW">
|
||||
<Component Id="_comp152" Guid="87db4ac6-634b-4502-a649-ed59566fd6fe">
|
||||
<Component Id="_comp152" Guid="d7f3228d-4e9f-472c-8c74-0b0ccaed830a">
|
||||
<File Id="_153" Source="..\bin\release\zh-TW\ArdupilotMegaPlanner.resources.dll" />
|
||||
</Component>
|
||||
</Directory>
|
||||
|
|
Binary file not shown.
|
@ -53,6 +53,8 @@ namespace ArdupilotMega
|
|||
{
|
||||
log.Fatal("Fatal app exception",ex);
|
||||
Console.WriteLine(ex.ToString());
|
||||
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,5 +34,5 @@ using System.Resources;
|
|||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.*")]
|
||||
[assembly: AssemblyFileVersion("1.1.63")]
|
||||
[assembly: AssemblyFileVersion("1.1.64")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("")]
|
||||
|
|
Binary file not shown.
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="us-ascii"?>
|
||||
<Config>
|
||||
<comport>COM18</comport>
|
||||
<baudrate>115200</baudrate>
|
||||
<APMFirmware>ArduPlane</APMFirmware>
|
||||
<showconsole>True</showconsole>
|
||||
<FlightSplitter>417</FlightSplitter>
|
||||
<Tuning_Graph_Selected>roll|pitch|nav_roll|nav_pitch|</Tuning_Graph_Selected>
|
||||
<NUM_tracklength>200</NUM_tracklength>
|
||||
<MainLocY>94</MainLocY>
|
||||
<MainMaximised>Normal</MainMaximised>
|
||||
<COM24_BAUD>115200</COM24_BAUD>
|
||||
<MainHeight>575</MainHeight>
|
||||
<MainLocX>203</MainLocX>
|
||||
<MainWidth>1024</MainWidth>
|
||||
</Config>
|
|
@ -277,6 +277,22 @@
|
|||
<F5>Output</F5>
|
||||
<F6>Gain</F6>
|
||||
</PID-23>
|
||||
<PID-112>
|
||||
<F1>Err</F1>
|
||||
<F2>P</F2>
|
||||
<F3>I</F3>
|
||||
<F4>D</F4>
|
||||
<F5>Output</F5>
|
||||
<F6>Gain</F6>
|
||||
</PID-112>
|
||||
<PID-122>
|
||||
<F1>Err</F1>
|
||||
<F2>P</F2>
|
||||
<F3>I</F3>
|
||||
<F4>D</F4>
|
||||
<F5>Output</F5>
|
||||
<F6>Gain</F6>
|
||||
</PID-122>
|
||||
</AC2>
|
||||
<!-- -->
|
||||
<APM>
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.1.4482.15190
|
||||
1.1.4485.13801
|
|
@ -277,6 +277,22 @@
|
|||
<F5>Output</F5>
|
||||
<F6>Gain</F6>
|
||||
</PID-23>
|
||||
<PID-112>
|
||||
<F1>Err</F1>
|
||||
<F2>P</F2>
|
||||
<F3>I</F3>
|
||||
<F4>D</F4>
|
||||
<F5>Output</F5>
|
||||
<F6>Gain</F6>
|
||||
</PID-112>
|
||||
<PID-122>
|
||||
<F1>Err</F1>
|
||||
<F2>P</F2>
|
||||
<F3>I</F3>
|
||||
<F4>D</F4>
|
||||
<F5>Output</F5>
|
||||
<F6>Gain</F6>
|
||||
</PID-122>
|
||||
</AC2>
|
||||
<!-- -->
|
||||
<APM>
|
||||
|
|
Loading…
Reference in New Issue