From 407016276352126677ca6f0d0d3862760d193482 Mon Sep 17 00:00:00 2001 From: dr-i-boleet Date: Mon, 7 Apr 2025 13:44:23 +1100 Subject: [PATCH] Little fix --- TelemetryIO/Models/Telemetry.cs | 13 + TelemetryIO/TestQuaternion.Designer.cs | 372 +++++++++++++++++++++++++ TelemetryIO/TestQuaternion.cs | 128 +++++++++ TelemetryIO/TestQuaternion.resx | 120 ++++++++ 4 files changed, 633 insertions(+) create mode 100644 TelemetryIO/TestQuaternion.Designer.cs create mode 100644 TelemetryIO/TestQuaternion.cs create mode 100644 TelemetryIO/TestQuaternion.resx diff --git a/TelemetryIO/Models/Telemetry.cs b/TelemetryIO/Models/Telemetry.cs index b15cd2c..8f92ff9 100644 --- a/TelemetryIO/Models/Telemetry.cs +++ b/TelemetryIO/Models/Telemetry.cs @@ -17,6 +17,7 @@ namespace TelemetryIO.Models public string name = ""; public float[] raw_imu = new float[6]; public float[] imu = new float[6]; + public float[] filtered_imu = new float[6]; public float[] g_integration = new float[3]; public float[] euler = new float[3]; public float[] quaternion = new float[4]; @@ -43,6 +44,13 @@ namespace TelemetryIO.Models dictMonitor.Add("Gy", new VarAddress(IMU_ADDRESS, 4)); dictMonitor.Add("Gz", new VarAddress(IMU_ADDRESS, 5)); + dictMonitor.Add("filtered_Ax", new VarAddress(FILTERED_IMU_ADDRESS, 0)); + dictMonitor.Add("filtered_Ay", new VarAddress(FILTERED_IMU_ADDRESS, 1)); + dictMonitor.Add("filtered_Az", new VarAddress(FILTERED_IMU_ADDRESS, 2)); + dictMonitor.Add("filtered_Gx", new VarAddress(FILTERED_IMU_ADDRESS, 3)); + dictMonitor.Add("filtered_Gy", new VarAddress(FILTERED_IMU_ADDRESS, 4)); + dictMonitor.Add("filtered_Gz", new VarAddress(FILTERED_IMU_ADDRESS, 5)); + dictMonitor.Add("Gx_int", new VarAddress(G_INTEGRATION_ADDRESS, 0)); dictMonitor.Add("Gy_int", new VarAddress(G_INTEGRATION_ADDRESS, 1)); dictMonitor.Add("Gz_int", new VarAddress(G_INTEGRATION_ADDRESS, 2)); @@ -122,6 +130,10 @@ namespace TelemetryIO.Models set_float(euler, data, offset, len); break; + case FILTERED_IMU_ADDRESS://IMU + set_float(filtered_imu, data, offset, len); + break; + case BAT_ADDRESS://battery set_float(battery, data, offset, len); break; @@ -178,6 +190,7 @@ namespace TelemetryIO.Models public const int Q_ADDRESS = 2; public const int G_INTEGRATION_ADDRESS = 3; public const int EULER_ADDRESS = 4; + public const int FILTERED_IMU_ADDRESS = 5; public const int BAT_ADDRESS = 50; diff --git a/TelemetryIO/TestQuaternion.Designer.cs b/TelemetryIO/TestQuaternion.Designer.cs new file mode 100644 index 0000000..a356da2 --- /dev/null +++ b/TelemetryIO/TestQuaternion.Designer.cs @@ -0,0 +1,372 @@ +namespace TelemetryIO +{ + partial class TestQuaternion + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + this.YAW_track = new System.Windows.Forms.TrackBar(); + this.YAW_label = new System.Windows.Forms.Label(); + this.ROLL_label = new System.Windows.Forms.Label(); + this.ROLL_track = new System.Windows.Forms.TrackBar(); + this.PITCH_label = new System.Windows.Forms.Label(); + this.PITCH_track = new System.Windows.Forms.TrackBar(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.Psi_label = new System.Windows.Forms.Label(); + this.Theta_label = new System.Windows.Forms.Label(); + this.Phi_label = new System.Windows.Forms.Label(); + this.Qy_label = new System.Windows.Forms.Label(); + this.Qx_label = new System.Windows.Forms.Label(); + this.Qw_label = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.Qz_label = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.Reset_quaternion = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.YAW_track)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.ROLL_track)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PITCH_track)).BeginInit(); + this.SuspendLayout(); + // + // YAW_track + // + this.YAW_track.Location = new System.Drawing.Point(131, 27); + this.YAW_track.Maximum = 180; + this.YAW_track.Name = "YAW_track"; + this.YAW_track.Orientation = System.Windows.Forms.Orientation.Vertical; + this.YAW_track.Size = new System.Drawing.Size(45, 104); + this.YAW_track.TabIndex = 0; + this.YAW_track.TickStyle = System.Windows.Forms.TickStyle.TopLeft; + this.YAW_track.Scroll += new System.EventHandler(this.YAW_track_Scroll); + // + // YAW_label + // + this.YAW_label.AutoSize = true; + this.YAW_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.YAW_label.Location = new System.Drawing.Point(145, 138); + this.YAW_label.Name = "YAW_label"; + this.YAW_label.Size = new System.Drawing.Size(16, 17); + this.YAW_label.TabIndex = 1; + this.YAW_label.Text = "0"; + this.YAW_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // ROLL_label + // + this.ROLL_label.AutoSize = true; + this.ROLL_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.ROLL_label.Location = new System.Drawing.Point(43, 138); + this.ROLL_label.Name = "ROLL_label"; + this.ROLL_label.Size = new System.Drawing.Size(16, 17); + this.ROLL_label.TabIndex = 3; + this.ROLL_label.Text = "0"; + this.ROLL_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // ROLL_track + // + this.ROLL_track.Location = new System.Drawing.Point(29, 27); + this.ROLL_track.Maximum = 180; + this.ROLL_track.Name = "ROLL_track"; + this.ROLL_track.Orientation = System.Windows.Forms.Orientation.Vertical; + this.ROLL_track.Size = new System.Drawing.Size(45, 104); + this.ROLL_track.TabIndex = 2; + this.ROLL_track.TickStyle = System.Windows.Forms.TickStyle.TopLeft; + this.ROLL_track.Scroll += new System.EventHandler(this.ROLL_track_Scroll); + // + // PITCH_label + // + this.PITCH_label.AutoSize = true; + this.PITCH_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.PITCH_label.Location = new System.Drawing.Point(94, 138); + this.PITCH_label.Name = "PITCH_label"; + this.PITCH_label.Size = new System.Drawing.Size(16, 17); + this.PITCH_label.TabIndex = 5; + this.PITCH_label.Text = "0"; + this.PITCH_label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // PITCH_track + // + this.PITCH_track.Location = new System.Drawing.Point(80, 27); + this.PITCH_track.Maximum = 180; + this.PITCH_track.Name = "PITCH_track"; + this.PITCH_track.Orientation = System.Windows.Forms.Orientation.Vertical; + this.PITCH_track.Size = new System.Drawing.Size(45, 104); + this.PITCH_track.TabIndex = 4; + this.PITCH_track.TickStyle = System.Windows.Forms.TickStyle.TopLeft; + this.PITCH_track.Scroll += new System.EventHandler(this.PITCH_track_Scroll); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label1.Location = new System.Drawing.Point(379, 44); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(28, 17); + this.label1.TabIndex = 6; + this.label1.Text = "Phi"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label2.Location = new System.Drawing.Point(362, 61); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(45, 17); + this.label2.TabIndex = 7; + this.label2.Text = "Theta"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label3.Location = new System.Drawing.Point(380, 78); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(27, 17); + this.label3.TabIndex = 8; + this.label3.Text = "Psi"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // Psi_label + // + this.Psi_label.AutoSize = true; + this.Psi_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Psi_label.Location = new System.Drawing.Point(425, 78); + this.Psi_label.Name = "Psi_label"; + this.Psi_label.Size = new System.Drawing.Size(27, 17); + this.Psi_label.TabIndex = 11; + this.Psi_label.Text = "Psi"; + this.Psi_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // Theta_label + // + this.Theta_label.AutoSize = true; + this.Theta_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Theta_label.Location = new System.Drawing.Point(425, 61); + this.Theta_label.Name = "Theta_label"; + this.Theta_label.Size = new System.Drawing.Size(45, 17); + this.Theta_label.TabIndex = 10; + this.Theta_label.Text = "Theta"; + this.Theta_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // Phi_label + // + this.Phi_label.AutoSize = true; + this.Phi_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Phi_label.Location = new System.Drawing.Point(425, 44); + this.Phi_label.Name = "Phi_label"; + this.Phi_label.Size = new System.Drawing.Size(28, 17); + this.Phi_label.TabIndex = 9; + this.Phi_label.Text = "Phi"; + this.Phi_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // Qy_label + // + this.Qy_label.AutoSize = true; + this.Qy_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Qy_label.Location = new System.Drawing.Point(270, 78); + this.Qy_label.Name = "Qy_label"; + this.Qy_label.Size = new System.Drawing.Size(16, 17); + this.Qy_label.TabIndex = 17; + this.Qy_label.Text = "0"; + this.Qy_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // Qx_label + // + this.Qx_label.AutoSize = true; + this.Qx_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Qx_label.Location = new System.Drawing.Point(270, 61); + this.Qx_label.Name = "Qx_label"; + this.Qx_label.Size = new System.Drawing.Size(16, 17); + this.Qx_label.TabIndex = 16; + this.Qx_label.Text = "0"; + this.Qx_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // Qw_label + // + this.Qw_label.AutoSize = true; + this.Qw_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Qw_label.Location = new System.Drawing.Point(270, 44); + this.Qw_label.Name = "Qw_label"; + this.Qw_label.Size = new System.Drawing.Size(16, 17); + this.Qw_label.TabIndex = 15; + this.Qw_label.Text = "1"; + this.Qw_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label7.Location = new System.Drawing.Point(225, 78); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(15, 17); + this.label7.TabIndex = 14; + this.label7.Text = "y"; + this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label8.Location = new System.Drawing.Point(226, 61); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(14, 17); + this.label8.TabIndex = 13; + this.label8.Text = "x"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label9.Location = new System.Drawing.Point(223, 44); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(17, 17); + this.label9.TabIndex = 12; + this.label9.Text = "w"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // Qz_label + // + this.Qz_label.AutoSize = true; + this.Qz_label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.Qz_label.Location = new System.Drawing.Point(270, 95); + this.Qz_label.Name = "Qz_label"; + this.Qz_label.Size = new System.Drawing.Size(16, 17); + this.Qz_label.TabIndex = 19; + this.Qz_label.Text = "0"; + this.Qz_label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label11.Location = new System.Drawing.Point(225, 95); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(15, 17); + this.label11.TabIndex = 18; + this.label11.Text = "z"; + this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label12.Location = new System.Drawing.Point(218, 27); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(89, 17); + this.label12.TabIndex = 20; + this.label12.Text = "Quaternion"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label13.Location = new System.Drawing.Point(394, 27); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(46, 17); + this.label13.TabIndex = 21; + this.label13.Text = "Euler"; + // + // Reset_quaternion + // + this.Reset_quaternion.Location = new System.Drawing.Point(221, 126); + this.Reset_quaternion.Name = "Reset_quaternion"; + this.Reset_quaternion.Size = new System.Drawing.Size(75, 23); + this.Reset_quaternion.TabIndex = 22; + this.Reset_quaternion.Text = "Reset"; + this.Reset_quaternion.UseVisualStyleBackColor = true; + this.Reset_quaternion.Click += new System.EventHandler(this.Reset_quaternion_Click); + // + // TestQuaternion + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.Reset_quaternion); + this.Controls.Add(this.label13); + this.Controls.Add(this.label12); + this.Controls.Add(this.Qz_label); + this.Controls.Add(this.label11); + this.Controls.Add(this.Qy_label); + this.Controls.Add(this.Qx_label); + this.Controls.Add(this.Qw_label); + this.Controls.Add(this.label7); + this.Controls.Add(this.label8); + this.Controls.Add(this.label9); + this.Controls.Add(this.Psi_label); + this.Controls.Add(this.Theta_label); + this.Controls.Add(this.Phi_label); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.PITCH_label); + this.Controls.Add(this.PITCH_track); + this.Controls.Add(this.ROLL_label); + this.Controls.Add(this.ROLL_track); + this.Controls.Add(this.YAW_label); + this.Controls.Add(this.YAW_track); + this.Name = "TestQuaternion"; + this.Size = new System.Drawing.Size(620, 460); + ((System.ComponentModel.ISupportInitialize)(this.YAW_track)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.ROLL_track)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PITCH_track)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TrackBar YAW_track; + private System.Windows.Forms.Label YAW_label; + private System.Windows.Forms.Label ROLL_label; + private System.Windows.Forms.TrackBar ROLL_track; + private System.Windows.Forms.Label PITCH_label; + private System.Windows.Forms.TrackBar PITCH_track; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label Psi_label; + private System.Windows.Forms.Label Theta_label; + private System.Windows.Forms.Label Phi_label; + private System.Windows.Forms.Label Qy_label; + private System.Windows.Forms.Label Qx_label; + private System.Windows.Forms.Label Qw_label; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label Qz_label; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Button Reset_quaternion; + } +} diff --git a/TelemetryIO/TestQuaternion.cs b/TelemetryIO/TestQuaternion.cs new file mode 100644 index 0000000..ac068a1 --- /dev/null +++ b/TelemetryIO/TestQuaternion.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace TelemetryIO +{ + public partial class TestQuaternion : UserControl + { + private float[] rates = new float[3]; + private Quaternion attitude = new Quaternion(0, 0, 0, 1); + public TestQuaternion() + { + InitializeComponent(); + } + + private void updateWithAngularRates() + { + Quaternion wq = new Quaternion(rates[0], rates[1], rates[2], 0); + //wq *= 0.5f; + attitude = attitude * wq; + attitude = attitude*(1 / attitude.Length()); + } + + private void ROLL_track_Scroll(object sender, EventArgs e) + { + TrackBar tb = sender as TrackBar; + rates[0] = (float)(tb.Value)/180f*(float)Math.PI/2; + updateWithAngularRates(); + updateView(); + } + + private void PITCH_track_Scroll(object sender, EventArgs e) + { + TrackBar tb = sender as TrackBar; + rates[1] = (float)(tb.Value) / 180f * (float)Math.PI/2; + updateWithAngularRates(); + updateView(); + } + + private void YAW_track_Scroll(object sender, EventArgs e) + { + TrackBar tb = sender as TrackBar; + rates[2] = (float)(tb.Value) / 180f * (float)Math.PI/2; + updateWithAngularRates(); + updateView(); + } + + private void updateView() + { + if (Qw_label.InvokeRequired) + { + Qw_label.Invoke(new Action(()=> Qw_label.Text = attitude.W.ToString("0.000"))); + } + else + { + Qw_label.Text = attitude.W.ToString("0.000"); + } + + if (Qx_label.InvokeRequired) + { + Qx_label.Invoke(new Action(() => Qx_label.Text = attitude.X.ToString("0.000"))); + } + else + { + Qx_label.Text = attitude.X.ToString("0.000"); + } + + if (Qy_label.InvokeRequired) + { + Qy_label.Invoke(new Action(() => Qy_label.Text = attitude.Y.ToString("0.000"))); + } + else + { + Qy_label.Text = attitude.Y.ToString("0.000"); + } + + if (Qz_label.InvokeRequired) + { + Qz_label.Invoke(new Action(() => Qz_label.Text = attitude.Z.ToString("0.000"))); + } + else + { + Qz_label.Text = attitude.Z.ToString("0.000"); + } + + if (ROLL_label.InvokeRequired) + { + ROLL_label.Invoke(new Action(() => ROLL_label.Text = rates[0].ToString("0.00"))); + } + else + { + ROLL_label.Text = rates[0].ToString("0.00"); + } + + if (PITCH_label.InvokeRequired) + { + PITCH_label.Invoke(new Action(() => PITCH_label.Text = rates[1].ToString("0.00"))); + } + else + { + PITCH_label.Text = rates[1].ToString("0.00"); + } + + if (YAW_label.InvokeRequired) + { + YAW_label.Invoke(new Action(() => YAW_label.Text = rates[2].ToString("0.00"))); + } + else + { + YAW_label.Text = rates[2].ToString("0.00"); + } + } + + private void Reset_quaternion_Click(object sender, EventArgs e) + { + attitude = new Quaternion(0, 0, 0, 1); + updateView(); + } + } +} diff --git a/TelemetryIO/TestQuaternion.resx b/TelemetryIO/TestQuaternion.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/TelemetryIO/TestQuaternion.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file