Добавлена вкладка monitor, отладка протокола

This commit is contained in:
2025-03-28 17:45:10 +11:00
parent 5bd17f261b
commit 882b036c80
8 changed files with 1188 additions and 65 deletions

View File

@ -153,6 +153,7 @@
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1339, 680);
this.tabControl1.TabIndex = 10;
this.tabControl1.Visible = false;
//
// tabPage1
//

View File

@ -23,19 +23,15 @@ namespace TelemetryIO
private System.Timers.Timer packageReceivingTimeout = new System.Timers.Timer(5);
private System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
private System.Timers.Timer packageTransferTimer = new System.Timers.Timer(50);
private List<byte> rx_buf = new List<byte>();
private List<byte[]> send_queue = new List<byte[]>();
private bool sendContinuousFlag = false;
private float test_f = 0;
public MainForm()
{
InitializeComponent();
PortSelector.Items.AddRange(SerialPort.GetPortNames());
PortSelector.SelectedIndex = 0;
PortSelector.SelectedIndex = PortSelector.Items.Count - 1;
SpeedSelector.Items.AddRange(speedItems);
SpeedSelector.SelectedIndex = 0;
SpeedSelector.SelectedIndex = 3;
Send_btn.Enabled = false;
@ -45,7 +41,22 @@ namespace TelemetryIO
timer.Tick += Timer_Tick;
ratePID_control.SubscribeOnEvent(serial);
monitorVars1.subscribeOnMonitoringItemsReceived(serial);
ratePID_control.bottom_label = InfoLabel;
serial.HandShakeOccurred += Serial_HandShakeOccurred;
}
private void Serial_HandShakeOccurred(object sender, EventArgs e)
{
if (tabControl1.InvokeRequired)
{
tabControl1.BeginInvoke(new Action(() => tabControl1.Visible = true));
}
else
{
tabControl1.Visible = true;
}
}
private void Timer_Tick(object sender, EventArgs e)
@ -144,6 +155,12 @@ namespace TelemetryIO
}*/
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
serial.Exit();
base.OnFormClosing(e);
}
public void UpdateLabel(string newText)
{

View File

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -10,9 +12,10 @@ namespace TelemetryIO.Models
{
private static volatile Telemetry instance;
private static readonly object _lock = new object();
private Dictionary<string, VarAddress> dictMonitor = new Dictionary<string, VarAddress>();
public string name = "";
public float[] raw_imu = new float[6];
public float[] quaternion = new float[4];
public float[] motor_act = new float[4];
public float[] motor_sp = new float[4];
public float[] pid0 = new float[9];
@ -20,7 +23,40 @@ namespace TelemetryIO.Models
public float[] pid2 = new float[9];
public float[] pid3 = new float[9];
private Telemetry() { }
private Telemetry() {
dictMonitor.Add("rawAx", new VarAddress(0, 0));
dictMonitor.Add("rawAy", new VarAddress(0, 1));
dictMonitor.Add("rawAz", new VarAddress(0, 2));
dictMonitor.Add("rawGx", new VarAddress(0, 3));
dictMonitor.Add("rawGy", new VarAddress(0, 4));
dictMonitor.Add("rawGz", new VarAddress(0, 5));
dictMonitor.Add("Qw", new VarAddress(1, 0));
dictMonitor.Add("Qx", new VarAddress(1, 1));
dictMonitor.Add("Qy", new VarAddress(1, 2));
dictMonitor.Add("Qz", new VarAddress(1, 3));
dictMonitor.Add("motor0_Act", new VarAddress(100, 0));
dictMonitor.Add("motor1_Act", new VarAddress(100, 1));
dictMonitor.Add("motor2_Act", new VarAddress(100, 2));
dictMonitor.Add("motor3_Act", new VarAddress(100, 3));
dictMonitor.Add("motor4_Act", new VarAddress(100, 4));
dictMonitor.Add("motor5_Act", new VarAddress(100, 5));
dictMonitor.Add("motor6_Act", new VarAddress(100, 6));
dictMonitor.Add("motor7_Act", new VarAddress(100, 7));
}
public VarAddress getVarAdress(string name)
{
VarAddress ret;
dictMonitor.TryGetValue(name, out ret);
return ret;
}
public string[] getKeys()
{
return dictMonitor.Keys.ToArray();
}
public static Telemetry Instance
{
@ -42,10 +78,35 @@ namespace TelemetryIO.Models
public void setSlot(int slot, byte[] data, int offset, int len)
{
if (slot != 9999) Debug.WriteLine(slot);
switch (slot)
{
case 0://RAW IMU
set_raw_imu(data, offset, len);
set_float(raw_imu, data, offset, len);
break;
case 1://quaternion
set_float(quaternion, data, offset, len);
break;
case 100://motors act
set_float(motor_act, data, offset, len);
break;
case 1000:
set_float(pid0, data, offset, len);
break;
case 1001:
set_float(pid1, data, offset, len);
break;
case 1002:
set_float(pid2, data, offset, len);
break;
case 1003:
set_float(pid3, data, offset, len);
break;
case 9999:
@ -53,13 +114,16 @@ namespace TelemetryIO.Models
break;
}
}
private void set_raw_imu(byte[] data, int offset, int len)
private void set_float(float[] dest, byte[] data, int offset, int len)
{
for (int i = 0; i < (int)(len / 4); i++)
{
byte[] bs = new byte[4];
Array.Copy(data, i * 4, bs, 0, 4);
raw_imu[(int)(offset / 4)] = BitConverter.ToSingle(bs, 0);
float f = BitConverter.ToSingle(bs, 0);
dest[offset + i] = f;
}
}
@ -69,4 +133,24 @@ namespace TelemetryIO.Models
}
}
public class VarAddress
{
public int slot = 0;
public int offset = 0;
public int length = 0;
public VarAddress()
{
slot = offset = 0;
length = 4;
}
public VarAddress(int slot, int offset, int length = 4)
{
this.slot = slot;
this.offset = offset;
this.length = length;
}
}
}

View File

@ -29,29 +29,102 @@
private void InitializeComponent()
{
this.MainFormPlot = new ScottPlot.WinForms.FormsPlot();
this.mon_test_label = new System.Windows.Forms.Label();
this.add_btn = new System.Windows.Forms.Button();
this.del_btn = new System.Windows.Forms.Button();
this.monNames_label = new System.Windows.Forms.Label();
this.monitorItems_cb = new System.Windows.Forms.ComboBox();
this.monitorItems_lb = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// MainFormPlot
//
this.MainFormPlot.DisplayScale = 0F;
this.MainFormPlot.Location = new System.Drawing.Point(115, 3);
this.MainFormPlot.Location = new System.Drawing.Point(238, 58);
this.MainFormPlot.Name = "MainFormPlot";
this.MainFormPlot.Size = new System.Drawing.Size(1046, 594);
this.MainFormPlot.Size = new System.Drawing.Size(923, 539);
this.MainFormPlot.TabIndex = 0;
//
// mon_test_label
//
this.mon_test_label.AutoSize = true;
this.mon_test_label.Location = new System.Drawing.Point(3, 11);
this.mon_test_label.Name = "mon_test_label";
this.mon_test_label.Size = new System.Drawing.Size(78, 13);
this.mon_test_label.TabIndex = 2;
this.mon_test_label.Text = "mon_test_label";
//
// add_btn
//
this.add_btn.Location = new System.Drawing.Point(20, 88);
this.add_btn.Name = "add_btn";
this.add_btn.Size = new System.Drawing.Size(75, 23);
this.add_btn.TabIndex = 3;
this.add_btn.Text = "add_btn";
this.add_btn.UseVisualStyleBackColor = true;
this.add_btn.Click += new System.EventHandler(this.add_btn_Click);
//
// del_btn
//
this.del_btn.Location = new System.Drawing.Point(20, 135);
this.del_btn.Name = "del_btn";
this.del_btn.Size = new System.Drawing.Size(75, 23);
this.del_btn.TabIndex = 4;
this.del_btn.Text = "del_btn";
this.del_btn.UseVisualStyleBackColor = true;
this.del_btn.Click += new System.EventHandler(this.del_btn_Click);
//
// monNames_label
//
this.monNames_label.AutoSize = true;
this.monNames_label.Location = new System.Drawing.Point(597, 11);
this.monNames_label.Name = "monNames_label";
this.monNames_label.Size = new System.Drawing.Size(35, 13);
this.monNames_label.TabIndex = 5;
this.monNames_label.Text = "label1";
//
// monitorItems_cb
//
this.monitorItems_cb.FormattingEnabled = true;
this.monitorItems_cb.Location = new System.Drawing.Point(20, 58);
this.monitorItems_cb.Name = "monitorItems_cb";
this.monitorItems_cb.Size = new System.Drawing.Size(121, 21);
this.monitorItems_cb.TabIndex = 6;
//
// monitorItems_lb
//
this.monitorItems_lb.FormattingEnabled = true;
this.monitorItems_lb.Location = new System.Drawing.Point(20, 180);
this.monitorItems_lb.Name = "monitorItems_lb";
this.monitorItems_lb.Size = new System.Drawing.Size(121, 316);
this.monitorItems_lb.TabIndex = 8;
//
// MonitorVars
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.monitorItems_lb);
this.Controls.Add(this.monitorItems_cb);
this.Controls.Add(this.monNames_label);
this.Controls.Add(this.del_btn);
this.Controls.Add(this.add_btn);
this.Controls.Add(this.mon_test_label);
this.Controls.Add(this.MainFormPlot);
this.Name = "MonitorVars";
this.Size = new System.Drawing.Size(1240, 600);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private ScottPlot.WinForms.FormsPlot MainFormPlot;
private System.Windows.Forms.Label mon_test_label;
private System.Windows.Forms.Button add_btn;
private System.Windows.Forms.Button del_btn;
private System.Windows.Forms.Label monNames_label;
private System.Windows.Forms.ComboBox monitorItems_cb;
private System.Windows.Forms.ListBox monitorItems_lb;
}
}

View File

@ -8,6 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TelemetryIO.Models;
namespace TelemetryIO
{
@ -15,14 +16,130 @@ namespace TelemetryIO
{
public SerialHandler serial { get; set; }
public float[][] monitoringBuffer = new float[32][];
private List<double[]> monitorList = new List<double[]>();
private List<string> monitorNames = new List<string>();
private List<ScottPlot.Plottables.Signal> signals = new List<ScottPlot.Plottables.Signal>();
private List<int[]>[] plotContent = new List<int[]>[32];
private Timer updateTimer = new Timer();
private float[] monitoring = new float[32];
private int test_index = 0;
private bool isSubscribed = false;
private string processingName = "";
private int processingIndex = -1;
public MonitorVars()
{
InitializeComponent();
initMonitoringBuffer();
MainFormPlot.Multiplot.AddPlots(4);
updateTimer.Interval = 100;
MainFormPlot.Plot.Axes.AutoScale();
monitorItems_cb.Items.AddRange(Telemetry.Instance.getKeys());
monitorItems_cb.SelectedIndex = 0;
updateTimer.Tick += UpdateTimer_Tick;
updateTimer.Start();
//MainFormPlot.
}
public void subscribeOnMonitoringItemsReceived(SerialHandler s)
{
if (isSubscribed) return;
isSubscribed = true;
serial = s;
s.MonitoringItemsReceived += Serial_MonitoringItemsReceived;
s.AnswerReceived += S_AnswerReceived;
}
private void S_AnswerReceived(object sender, SerialEventArgs e)
{
if(e.Answer == "ADD")
{
monitorNames.Add(processingName);
processingIndex++;
if (monitorItems_lb.InvokeRequired)
{
monitorItems_lb.Invoke(new Action(() => monitorItems_lb.Items.Add(processingName)));
}
else
{
monitorItems_lb.Items.Add(processingName);
}
monitorList.Add(new double[1024]);
MainFormPlot.Plot.Add.Signal(monitorList[monitorList.Count - 1]);
}
else if(e.Answer == "REMOVE")
{
monitorNames.RemoveAt(processingIndex);
monitorList.RemoveAt(processingIndex);
if (monitorItems_lb.InvokeRequired)
{
monitorItems_lb.Invoke(new Action(() => monitorItems_lb.Items.RemoveAt(processingIndex)));
}
else
{
monitorItems_lb.Items.RemoveAt(processingIndex);
}
if (processingIndex >= 0) processingIndex--;
}else if(e.Answer == "REMOVEALL")
{
monitorNames.Clear();
monitorList.Clear();
}
}
private void Serial_MonitoringItemsReceived(object sender, MonitoringEventArgs e)
{
for(int i = 0; i < monitorList.Count; i++)
{
ShiftLeft(monitorList[i]);
monitorList[i][monitorList[i].Length - 1] = e.Data[i];
}
monitoring = new float[monitorList.Count];
for (int i = 0; i < monitorList.Count; i++)
{
monitoring[i] = (float)monitorList[i][monitorList[i].Length - 1];
}
}
private void UpdateTimer_Tick(object sender, EventArgs e)
{
if (mon_test_label.InvokeRequired)
{
mon_test_label.Invoke(new Action(() => mon_test_label.Text = string.Join(", ", monitoring)));
}
else
{
mon_test_label.Text = string.Join(", ", monitoring);
}
if (monNames_label.InvokeRequired)
{
monNames_label.Invoke(new Action(() => monNames_label.Text = string.Join(", ", monitorNames)));
}
else monNames_label.Text = string.Join(", ", monitorNames);
if (monitorList.Count > 0)
{
MainFormPlot.Plot.Clear();
for(int i = 0; i < monitorList.Count; i++)
{
var sig = MainFormPlot.Plot.Add.Signal(monitorList[i]);
sig.LegendText = monitorNames[i];
}
MainFormPlot.Plot.Legend.IsVisible = true;
MainFormPlot.Plot.Legend.Orientation = ScottPlot.Orientation.Horizontal;
MainFormPlot.Plot.Axes.AutoScale();
MainFormPlot.Refresh();
}
}
void initMonitoringBuffer()
{
for (int i = 0; i < monitoringBuffer.Length; i++)
@ -30,5 +147,26 @@ namespace TelemetryIO
monitoringBuffer[i] = new float[8192];
}
}
private void add_btn_Click(object sender, EventArgs e)
{
processingName = (string)monitorItems_cb.SelectedItem;
serial.AddMonitoringItem(processingName);
/*serial.AddMonitoringItem(0, test_index);
processingName = "item." + test_index;
if (test_index < 5) test_index++;
else test_index = 0;*/
}
private void del_btn_Click(object sender, EventArgs e)
{
processingIndex = monitorItems_lb.SelectedIndex;
serial.RemoveMonitoringItem(processingIndex);
}
private void ShiftLeft(double[] arr)
{
Buffer.BlockCopy(arr, sizeof(double), arr, 0, (arr.Length - 1)*sizeof(double));
}
}
}

View File

@ -52,7 +52,7 @@
this.numericUpDown7 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown8 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown9 = new System.Windows.Forms.NumericUpDown();
this.panel2 = new System.Windows.Forms.Panel();
this.pid1_panel = new System.Windows.Forms.Panel();
this.numericUpDown10 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown11 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown12 = new System.Windows.Forms.NumericUpDown();
@ -71,6 +71,46 @@
this.label16 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.tab_pid2 = new System.Windows.Forms.TabPage();
this.tab_pid3 = new System.Windows.Forms.TabPage();
this.pid2_panel = new System.Windows.Forms.Panel();
this.numericUpDown19 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown20 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown21 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown22 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown23 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown24 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown25 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown26 = new System.Windows.Forms.NumericUpDown();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.label24 = new System.Windows.Forms.Label();
this.label25 = new System.Windows.Forms.Label();
this.label26 = new System.Windows.Forms.Label();
this.label27 = new System.Windows.Forms.Label();
this.numericUpDown27 = new System.Windows.Forms.NumericUpDown();
this.pid3_panel = new System.Windows.Forms.Panel();
this.numericUpDown28 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown29 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown30 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown31 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown32 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown33 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown34 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown35 = new System.Windows.Forms.NumericUpDown();
this.label28 = new System.Windows.Forms.Label();
this.label29 = new System.Windows.Forms.Label();
this.label30 = new System.Windows.Forms.Label();
this.label31 = new System.Windows.Forms.Label();
this.label32 = new System.Windows.Forms.Label();
this.label33 = new System.Windows.Forms.Label();
this.label34 = new System.Windows.Forms.Label();
this.label35 = new System.Windows.Forms.Label();
this.label36 = new System.Windows.Forms.Label();
this.numericUpDown36 = new System.Windows.Forms.NumericUpDown();
this.tabControl1.SuspendLayout();
this.tab_pid0.SuspendLayout();
this.pid0_panel.SuspendLayout();
@ -84,7 +124,7 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown9)).BeginInit();
this.panel2.SuspendLayout();
this.pid1_panel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown10)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown12)).BeginInit();
@ -94,6 +134,28 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDown16)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown17)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown18)).BeginInit();
this.tab_pid2.SuspendLayout();
this.tab_pid3.SuspendLayout();
this.pid2_panel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown19)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown20)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown21)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown22)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown23)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown24)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown25)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown26)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown27)).BeginInit();
this.pid3_panel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown28)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown29)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown30)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown31)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown32)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown33)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown34)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown35)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown36)).BeginInit();
this.SuspendLayout();
//
// Save_btn
@ -119,6 +181,8 @@
//
this.tabControl1.Controls.Add(this.tab_pid0);
this.tabControl1.Controls.Add(this.tab_pid1);
this.tabControl1.Controls.Add(this.tab_pid2);
this.tabControl1.Controls.Add(this.tab_pid3);
this.tabControl1.Location = new System.Drawing.Point(32, 23);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
@ -244,7 +308,7 @@
//
// tab_pid1
//
this.tab_pid1.Controls.Add(this.panel2);
this.tab_pid1.Controls.Add(this.pid1_panel);
this.tab_pid1.Location = new System.Drawing.Point(4, 22);
this.tab_pid1.Name = "tab_pid1";
this.tab_pid1.Padding = new System.Windows.Forms.Padding(3);
@ -379,30 +443,30 @@
this.numericUpDown9.TabIndex = 7;
this.numericUpDown9.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// panel2
// pid1_panel
//
this.panel2.Controls.Add(this.numericUpDown10);
this.panel2.Controls.Add(this.numericUpDown11);
this.panel2.Controls.Add(this.numericUpDown12);
this.panel2.Controls.Add(this.numericUpDown13);
this.panel2.Controls.Add(this.numericUpDown14);
this.panel2.Controls.Add(this.numericUpDown15);
this.panel2.Controls.Add(this.numericUpDown16);
this.panel2.Controls.Add(this.numericUpDown17);
this.panel2.Controls.Add(this.numericUpDown18);
this.panel2.Controls.Add(this.label10);
this.panel2.Controls.Add(this.label11);
this.panel2.Controls.Add(this.label12);
this.panel2.Controls.Add(this.label13);
this.panel2.Controls.Add(this.label14);
this.panel2.Controls.Add(this.label15);
this.panel2.Controls.Add(this.label16);
this.panel2.Controls.Add(this.label17);
this.panel2.Controls.Add(this.label18);
this.panel2.Location = new System.Drawing.Point(23, 25);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(517, 117);
this.panel2.TabIndex = 1;
this.pid1_panel.Controls.Add(this.numericUpDown10);
this.pid1_panel.Controls.Add(this.numericUpDown11);
this.pid1_panel.Controls.Add(this.numericUpDown12);
this.pid1_panel.Controls.Add(this.numericUpDown13);
this.pid1_panel.Controls.Add(this.numericUpDown14);
this.pid1_panel.Controls.Add(this.numericUpDown15);
this.pid1_panel.Controls.Add(this.numericUpDown16);
this.pid1_panel.Controls.Add(this.numericUpDown17);
this.pid1_panel.Controls.Add(this.numericUpDown18);
this.pid1_panel.Controls.Add(this.label10);
this.pid1_panel.Controls.Add(this.label11);
this.pid1_panel.Controls.Add(this.label12);
this.pid1_panel.Controls.Add(this.label13);
this.pid1_panel.Controls.Add(this.label14);
this.pid1_panel.Controls.Add(this.label15);
this.pid1_panel.Controls.Add(this.label16);
this.pid1_panel.Controls.Add(this.label17);
this.pid1_panel.Controls.Add(this.label18);
this.pid1_panel.Location = new System.Drawing.Point(23, 25);
this.pid1_panel.Name = "pid1_panel";
this.pid1_panel.Size = new System.Drawing.Size(517, 117);
this.pid1_panel.TabIndex = 1;
//
// numericUpDown10
//
@ -415,7 +479,7 @@
0});
this.numericUpDown10.Name = "numericUpDown10";
this.numericUpDown10.Size = new System.Drawing.Size(100, 20);
this.numericUpDown10.TabIndex = 62;
this.numericUpDown10.TabIndex = 9;
this.numericUpDown10.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown11
@ -429,7 +493,7 @@
0});
this.numericUpDown11.Name = "numericUpDown11";
this.numericUpDown11.Size = new System.Drawing.Size(100, 20);
this.numericUpDown11.TabIndex = 61;
this.numericUpDown11.TabIndex = 8;
this.numericUpDown11.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown12
@ -443,7 +507,7 @@
0});
this.numericUpDown12.Name = "numericUpDown12";
this.numericUpDown12.Size = new System.Drawing.Size(100, 20);
this.numericUpDown12.TabIndex = 60;
this.numericUpDown12.TabIndex = 7;
this.numericUpDown12.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown13
@ -457,7 +521,7 @@
0});
this.numericUpDown13.Name = "numericUpDown13";
this.numericUpDown13.Size = new System.Drawing.Size(100, 20);
this.numericUpDown13.TabIndex = 59;
this.numericUpDown13.TabIndex = 6;
this.numericUpDown13.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown14
@ -471,7 +535,7 @@
0});
this.numericUpDown14.Name = "numericUpDown14";
this.numericUpDown14.Size = new System.Drawing.Size(100, 20);
this.numericUpDown14.TabIndex = 58;
this.numericUpDown14.TabIndex = 5;
this.numericUpDown14.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown15
@ -485,7 +549,7 @@
0});
this.numericUpDown15.Name = "numericUpDown15";
this.numericUpDown15.Size = new System.Drawing.Size(100, 20);
this.numericUpDown15.TabIndex = 57;
this.numericUpDown15.TabIndex = 4;
this.numericUpDown15.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown16
@ -499,7 +563,7 @@
0});
this.numericUpDown16.Name = "numericUpDown16";
this.numericUpDown16.Size = new System.Drawing.Size(100, 20);
this.numericUpDown16.TabIndex = 56;
this.numericUpDown16.TabIndex = 3;
this.numericUpDown16.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown17
@ -513,7 +577,7 @@
0});
this.numericUpDown17.Name = "numericUpDown17";
this.numericUpDown17.Size = new System.Drawing.Size(100, 20);
this.numericUpDown17.TabIndex = 55;
this.numericUpDown17.TabIndex = 2;
this.numericUpDown17.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown18
@ -527,7 +591,7 @@
0});
this.numericUpDown18.Name = "numericUpDown18";
this.numericUpDown18.Size = new System.Drawing.Size(100, 20);
this.numericUpDown18.TabIndex = 54;
this.numericUpDown18.TabIndex = 1;
this.numericUpDown18.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label10
@ -611,6 +675,490 @@
this.label18.TabIndex = 37;
this.label18.Text = "Roll.P";
//
// tab_pid2
//
this.tab_pid2.Controls.Add(this.pid2_panel);
this.tab_pid2.Location = new System.Drawing.Point(4, 22);
this.tab_pid2.Name = "tab_pid2";
this.tab_pid2.Size = new System.Drawing.Size(562, 167);
this.tab_pid2.TabIndex = 2;
this.tab_pid2.Text = "Набор 2";
this.tab_pid2.UseVisualStyleBackColor = true;
//
// tab_pid3
//
this.tab_pid3.Controls.Add(this.pid3_panel);
this.tab_pid3.Location = new System.Drawing.Point(4, 22);
this.tab_pid3.Name = "tab_pid3";
this.tab_pid3.Size = new System.Drawing.Size(562, 167);
this.tab_pid3.TabIndex = 3;
this.tab_pid3.Text = "Набор 3";
this.tab_pid3.UseVisualStyleBackColor = true;
//
// pid2_panel
//
this.pid2_panel.Controls.Add(this.numericUpDown19);
this.pid2_panel.Controls.Add(this.numericUpDown20);
this.pid2_panel.Controls.Add(this.numericUpDown21);
this.pid2_panel.Controls.Add(this.numericUpDown22);
this.pid2_panel.Controls.Add(this.numericUpDown23);
this.pid2_panel.Controls.Add(this.numericUpDown24);
this.pid2_panel.Controls.Add(this.numericUpDown25);
this.pid2_panel.Controls.Add(this.numericUpDown26);
this.pid2_panel.Controls.Add(this.label19);
this.pid2_panel.Controls.Add(this.label20);
this.pid2_panel.Controls.Add(this.label21);
this.pid2_panel.Controls.Add(this.label22);
this.pid2_panel.Controls.Add(this.label23);
this.pid2_panel.Controls.Add(this.label24);
this.pid2_panel.Controls.Add(this.label25);
this.pid2_panel.Controls.Add(this.label26);
this.pid2_panel.Controls.Add(this.label27);
this.pid2_panel.Controls.Add(this.numericUpDown27);
this.pid2_panel.Location = new System.Drawing.Point(23, 25);
this.pid2_panel.Name = "pid2_panel";
this.pid2_panel.Size = new System.Drawing.Size(517, 117);
this.pid2_panel.TabIndex = 1;
//
// numericUpDown19
//
this.numericUpDown19.DecimalPlaces = 2;
this.numericUpDown19.Location = new System.Drawing.Point(398, 77);
this.numericUpDown19.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown19.Name = "numericUpDown19";
this.numericUpDown19.Size = new System.Drawing.Size(100, 20);
this.numericUpDown19.TabIndex = 9;
this.numericUpDown19.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown20
//
this.numericUpDown20.DecimalPlaces = 2;
this.numericUpDown20.Location = new System.Drawing.Point(398, 51);
this.numericUpDown20.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown20.Name = "numericUpDown20";
this.numericUpDown20.Size = new System.Drawing.Size(100, 20);
this.numericUpDown20.TabIndex = 8;
this.numericUpDown20.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown21
//
this.numericUpDown21.DecimalPlaces = 2;
this.numericUpDown21.Location = new System.Drawing.Point(398, 23);
this.numericUpDown21.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown21.Name = "numericUpDown21";
this.numericUpDown21.Size = new System.Drawing.Size(100, 20);
this.numericUpDown21.TabIndex = 7;
this.numericUpDown21.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown22
//
this.numericUpDown22.DecimalPlaces = 2;
this.numericUpDown22.Location = new System.Drawing.Point(232, 77);
this.numericUpDown22.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown22.Name = "numericUpDown22";
this.numericUpDown22.Size = new System.Drawing.Size(100, 20);
this.numericUpDown22.TabIndex = 6;
this.numericUpDown22.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown23
//
this.numericUpDown23.DecimalPlaces = 2;
this.numericUpDown23.Location = new System.Drawing.Point(232, 51);
this.numericUpDown23.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown23.Name = "numericUpDown23";
this.numericUpDown23.Size = new System.Drawing.Size(100, 20);
this.numericUpDown23.TabIndex = 5;
this.numericUpDown23.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown24
//
this.numericUpDown24.DecimalPlaces = 2;
this.numericUpDown24.Location = new System.Drawing.Point(232, 23);
this.numericUpDown24.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown24.Name = "numericUpDown24";
this.numericUpDown24.Size = new System.Drawing.Size(100, 20);
this.numericUpDown24.TabIndex = 4;
this.numericUpDown24.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown25
//
this.numericUpDown25.DecimalPlaces = 2;
this.numericUpDown25.Location = new System.Drawing.Point(67, 77);
this.numericUpDown25.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown25.Name = "numericUpDown25";
this.numericUpDown25.Size = new System.Drawing.Size(100, 20);
this.numericUpDown25.TabIndex = 3;
this.numericUpDown25.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown26
//
this.numericUpDown26.DecimalPlaces = 2;
this.numericUpDown26.Location = new System.Drawing.Point(67, 51);
this.numericUpDown26.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown26.Name = "numericUpDown26";
this.numericUpDown26.Size = new System.Drawing.Size(100, 20);
this.numericUpDown26.TabIndex = 2;
this.numericUpDown26.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label19
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(347, 77);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(39, 13);
this.label19.TabIndex = 53;
this.label19.Text = "Yaw.D";
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(347, 51);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(34, 13);
this.label20.TabIndex = 51;
this.label20.Text = "Yaw.I";
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(347, 25);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(38, 13);
this.label21.TabIndex = 49;
this.label21.Text = "Yaw.P";
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(185, 77);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(42, 13);
this.label22.TabIndex = 47;
this.label22.Text = "Pitch.D";
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(185, 51);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(37, 13);
this.label23.TabIndex = 45;
this.label23.Text = "Pitch.I";
//
// label24
//
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(185, 25);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(41, 13);
this.label24.TabIndex = 43;
this.label24.Text = "Pitch.P";
//
// label25
//
this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(26, 77);
this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(36, 13);
this.label25.TabIndex = 41;
this.label25.Text = "Roll.D";
//
// label26
//
this.label26.AutoSize = true;
this.label26.Location = new System.Drawing.Point(26, 51);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(31, 13);
this.label26.TabIndex = 39;
this.label26.Text = "Roll.I";
//
// label27
//
this.label27.AutoSize = true;
this.label27.Location = new System.Drawing.Point(26, 25);
this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(35, 13);
this.label27.TabIndex = 37;
this.label27.Text = "Roll.P";
//
// numericUpDown27
//
this.numericUpDown27.DecimalPlaces = 2;
this.numericUpDown27.Location = new System.Drawing.Point(67, 23);
this.numericUpDown27.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown27.Name = "numericUpDown27";
this.numericUpDown27.Size = new System.Drawing.Size(100, 20);
this.numericUpDown27.TabIndex = 1;
this.numericUpDown27.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// pid3_panel
//
this.pid3_panel.Controls.Add(this.numericUpDown28);
this.pid3_panel.Controls.Add(this.numericUpDown29);
this.pid3_panel.Controls.Add(this.numericUpDown30);
this.pid3_panel.Controls.Add(this.numericUpDown31);
this.pid3_panel.Controls.Add(this.numericUpDown32);
this.pid3_panel.Controls.Add(this.numericUpDown33);
this.pid3_panel.Controls.Add(this.numericUpDown34);
this.pid3_panel.Controls.Add(this.numericUpDown35);
this.pid3_panel.Controls.Add(this.label28);
this.pid3_panel.Controls.Add(this.label29);
this.pid3_panel.Controls.Add(this.label30);
this.pid3_panel.Controls.Add(this.label31);
this.pid3_panel.Controls.Add(this.label32);
this.pid3_panel.Controls.Add(this.label33);
this.pid3_panel.Controls.Add(this.label34);
this.pid3_panel.Controls.Add(this.label35);
this.pid3_panel.Controls.Add(this.label36);
this.pid3_panel.Controls.Add(this.numericUpDown36);
this.pid3_panel.Location = new System.Drawing.Point(23, 25);
this.pid3_panel.Name = "pid3_panel";
this.pid3_panel.Size = new System.Drawing.Size(517, 117);
this.pid3_panel.TabIndex = 1;
//
// numericUpDown28
//
this.numericUpDown28.DecimalPlaces = 2;
this.numericUpDown28.Location = new System.Drawing.Point(398, 77);
this.numericUpDown28.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown28.Name = "numericUpDown28";
this.numericUpDown28.Size = new System.Drawing.Size(100, 20);
this.numericUpDown28.TabIndex = 9;
this.numericUpDown28.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown29
//
this.numericUpDown29.DecimalPlaces = 2;
this.numericUpDown29.Location = new System.Drawing.Point(398, 51);
this.numericUpDown29.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown29.Name = "numericUpDown29";
this.numericUpDown29.Size = new System.Drawing.Size(100, 20);
this.numericUpDown29.TabIndex = 8;
this.numericUpDown29.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown30
//
this.numericUpDown30.DecimalPlaces = 2;
this.numericUpDown30.Location = new System.Drawing.Point(398, 23);
this.numericUpDown30.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown30.Name = "numericUpDown30";
this.numericUpDown30.Size = new System.Drawing.Size(100, 20);
this.numericUpDown30.TabIndex = 7;
this.numericUpDown30.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown31
//
this.numericUpDown31.DecimalPlaces = 2;
this.numericUpDown31.Location = new System.Drawing.Point(232, 77);
this.numericUpDown31.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown31.Name = "numericUpDown31";
this.numericUpDown31.Size = new System.Drawing.Size(100, 20);
this.numericUpDown31.TabIndex = 6;
this.numericUpDown31.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown32
//
this.numericUpDown32.DecimalPlaces = 2;
this.numericUpDown32.Location = new System.Drawing.Point(232, 51);
this.numericUpDown32.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown32.Name = "numericUpDown32";
this.numericUpDown32.Size = new System.Drawing.Size(100, 20);
this.numericUpDown32.TabIndex = 5;
this.numericUpDown32.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown33
//
this.numericUpDown33.DecimalPlaces = 2;
this.numericUpDown33.Location = new System.Drawing.Point(232, 23);
this.numericUpDown33.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown33.Name = "numericUpDown33";
this.numericUpDown33.Size = new System.Drawing.Size(100, 20);
this.numericUpDown33.TabIndex = 4;
this.numericUpDown33.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown34
//
this.numericUpDown34.DecimalPlaces = 2;
this.numericUpDown34.Location = new System.Drawing.Point(67, 77);
this.numericUpDown34.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown34.Name = "numericUpDown34";
this.numericUpDown34.Size = new System.Drawing.Size(100, 20);
this.numericUpDown34.TabIndex = 3;
this.numericUpDown34.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// numericUpDown35
//
this.numericUpDown35.DecimalPlaces = 2;
this.numericUpDown35.Location = new System.Drawing.Point(67, 51);
this.numericUpDown35.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown35.Name = "numericUpDown35";
this.numericUpDown35.Size = new System.Drawing.Size(100, 20);
this.numericUpDown35.TabIndex = 2;
this.numericUpDown35.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label28
//
this.label28.AutoSize = true;
this.label28.Location = new System.Drawing.Point(347, 77);
this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(39, 13);
this.label28.TabIndex = 53;
this.label28.Text = "Yaw.D";
//
// label29
//
this.label29.AutoSize = true;
this.label29.Location = new System.Drawing.Point(347, 51);
this.label29.Name = "label29";
this.label29.Size = new System.Drawing.Size(34, 13);
this.label29.TabIndex = 51;
this.label29.Text = "Yaw.I";
//
// label30
//
this.label30.AutoSize = true;
this.label30.Location = new System.Drawing.Point(347, 25);
this.label30.Name = "label30";
this.label30.Size = new System.Drawing.Size(38, 13);
this.label30.TabIndex = 49;
this.label30.Text = "Yaw.P";
//
// label31
//
this.label31.AutoSize = true;
this.label31.Location = new System.Drawing.Point(185, 77);
this.label31.Name = "label31";
this.label31.Size = new System.Drawing.Size(42, 13);
this.label31.TabIndex = 47;
this.label31.Text = "Pitch.D";
//
// label32
//
this.label32.AutoSize = true;
this.label32.Location = new System.Drawing.Point(185, 51);
this.label32.Name = "label32";
this.label32.Size = new System.Drawing.Size(37, 13);
this.label32.TabIndex = 45;
this.label32.Text = "Pitch.I";
//
// label33
//
this.label33.AutoSize = true;
this.label33.Location = new System.Drawing.Point(185, 25);
this.label33.Name = "label33";
this.label33.Size = new System.Drawing.Size(41, 13);
this.label33.TabIndex = 43;
this.label33.Text = "Pitch.P";
//
// label34
//
this.label34.AutoSize = true;
this.label34.Location = new System.Drawing.Point(26, 77);
this.label34.Name = "label34";
this.label34.Size = new System.Drawing.Size(36, 13);
this.label34.TabIndex = 41;
this.label34.Text = "Roll.D";
//
// label35
//
this.label35.AutoSize = true;
this.label35.Location = new System.Drawing.Point(26, 51);
this.label35.Name = "label35";
this.label35.Size = new System.Drawing.Size(31, 13);
this.label35.TabIndex = 39;
this.label35.Text = "Roll.I";
//
// label36
//
this.label36.AutoSize = true;
this.label36.Location = new System.Drawing.Point(26, 25);
this.label36.Name = "label36";
this.label36.Size = new System.Drawing.Size(35, 13);
this.label36.TabIndex = 37;
this.label36.Text = "Roll.P";
//
// numericUpDown36
//
this.numericUpDown36.DecimalPlaces = 2;
this.numericUpDown36.Location = new System.Drawing.Point(67, 23);
this.numericUpDown36.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown36.Name = "numericUpDown36";
this.numericUpDown36.Size = new System.Drawing.Size(100, 20);
this.numericUpDown36.TabIndex = 1;
this.numericUpDown36.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// RatePID
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -634,8 +1182,8 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown8)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown9)).EndInit();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.pid1_panel.ResumeLayout(false);
this.pid1_panel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown10)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown12)).EndInit();
@ -645,6 +1193,30 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDown16)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown17)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown18)).EndInit();
this.tab_pid2.ResumeLayout(false);
this.tab_pid3.ResumeLayout(false);
this.pid2_panel.ResumeLayout(false);
this.pid2_panel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown19)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown20)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown21)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown22)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown23)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown24)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown25)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown26)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown27)).EndInit();
this.pid3_panel.ResumeLayout(false);
this.pid3_panel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown28)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown29)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown30)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown31)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown32)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown33)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown34)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown35)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown36)).EndInit();
this.ResumeLayout(false);
}
@ -675,7 +1247,7 @@
private System.Windows.Forms.NumericUpDown numericUpDown6;
private System.Windows.Forms.NumericUpDown numericUpDown3;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel pid1_panel;
private System.Windows.Forms.NumericUpDown numericUpDown10;
private System.Windows.Forms.NumericUpDown numericUpDown11;
private System.Windows.Forms.NumericUpDown numericUpDown12;
@ -694,5 +1266,45 @@
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.TabPage tab_pid2;
private System.Windows.Forms.Panel pid2_panel;
private System.Windows.Forms.NumericUpDown numericUpDown19;
private System.Windows.Forms.NumericUpDown numericUpDown20;
private System.Windows.Forms.NumericUpDown numericUpDown21;
private System.Windows.Forms.NumericUpDown numericUpDown22;
private System.Windows.Forms.NumericUpDown numericUpDown23;
private System.Windows.Forms.NumericUpDown numericUpDown24;
private System.Windows.Forms.NumericUpDown numericUpDown25;
private System.Windows.Forms.NumericUpDown numericUpDown26;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.NumericUpDown numericUpDown27;
private System.Windows.Forms.TabPage tab_pid3;
private System.Windows.Forms.Panel pid3_panel;
private System.Windows.Forms.NumericUpDown numericUpDown28;
private System.Windows.Forms.NumericUpDown numericUpDown29;
private System.Windows.Forms.NumericUpDown numericUpDown30;
private System.Windows.Forms.NumericUpDown numericUpDown31;
private System.Windows.Forms.NumericUpDown numericUpDown32;
private System.Windows.Forms.NumericUpDown numericUpDown33;
private System.Windows.Forms.NumericUpDown numericUpDown34;
private System.Windows.Forms.NumericUpDown numericUpDown35;
private System.Windows.Forms.Label label28;
private System.Windows.Forms.Label label29;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.Label label31;
private System.Windows.Forms.Label label32;
private System.Windows.Forms.Label label33;
private System.Windows.Forms.Label label34;
private System.Windows.Forms.Label label35;
private System.Windows.Forms.Label label36;
private System.Windows.Forms.NumericUpDown numericUpDown36;
}
}

View File

@ -8,6 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TelemetryIO.Models;
namespace TelemetryIO
{
@ -15,10 +16,13 @@ namespace TelemetryIO
{
private float[] pid0 = new float[9];
private float[] pid1 = new float[9];
private float[] pid2 = new float[9];
private float[] pid3 = new float[9];
private float zh = 0;
private bool isSubscribed = false;
public SerialHandler serial { get; set; }
public Label bottom_label { get; set; }
private object locker = new object();
public RatePID()
{
@ -36,6 +40,18 @@ namespace TelemetryIO
{
bottom_label.Text = e.Answer; ;
}
lock (locker)
{
pid0 = Telemetry.Instance.pid0;
pid1 = Telemetry.Instance.pid1;
pid2 = Telemetry.Instance.pid2;
pid3 = Telemetry.Instance.pid3;
}
if(e.Answer == "1000")change_view(pid0_panel, pid0);
else if (e.Answer == "1001") change_view(pid1_panel, pid1);
else if (e.Answer == "1002") change_view(pid2_panel, pid2);
else if (e.Answer == "1003") change_view(pid3_panel, pid3);
}
public void SubscribeOnEvent(SerialHandler s)
@ -46,6 +62,25 @@ namespace TelemetryIO
serial.AnswerReceived += Serial_AnswerReceived;
}
private void change_view(Panel panel, float[] pid)
{
for (int i = 0; i < panel.Controls.Count; i++)
{
if (panel.Controls[i] is NumericUpDown)
{
NumericUpDown c = panel.Controls[i] as NumericUpDown;
if (c.InvokeRequired)
{
c.BeginInvoke(new Action(() => c.Value = (decimal)pid[c.TabIndex - 1]));
}
else
{
c.Value = (decimal)pid[c.TabIndex - 1];
}
}
}
}
private void Save_btn_Click(object sender, EventArgs e)
{
@ -55,7 +90,7 @@ namespace TelemetryIO
if (pid0_panel.Controls[i] is NumericUpDown)
{
NumericUpDown c = pid0_panel.Controls[i] as NumericUpDown;
floats[pid0_panel.Controls[i].TabIndex - 1] = (float)c.Value;
floats[c.TabIndex - 1] = (float)c.Value;
}
}
serial.sendTestWrite(floats);

View File

@ -6,6 +6,7 @@ using System.Linq;
using System.Net.Http;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TelemetryIO.Models;
@ -30,12 +31,31 @@ namespace TelemetryIO
private SerialPort com_port;
static private List<byte> rx_buf = new List<byte>();
static private byte[] data;
//Generate event when answer is received
public delegate void AnswerEventHandler<SerialEventArgs>(object sender, SerialEventArgs e);
public event AnswerEventHandler<SerialEventArgs> AnswerReceived;
//Generate event when handshake is occurred
public delegate void HandShakeHandler(object sender, EventArgs e);
public event HandShakeHandler HandShakeOccurred;
//Generate event when monitoring telegram is received
public delegate void MonitoringEventHandler<MonitoringEventArgs>(object sender, MonitoringEventArgs e);
public event MonitoringEventHandler<MonitoringEventArgs> MonitoringItemsReceived;
private int int_test = 0;
private float[] monitor = new float[32];
public string view_str = "";
Telemetry telemetry = Telemetry.Instance;
private Queue<byte[]> req_buffer = new Queue<byte[]>();
private object lock_obj = new object();
private bool waitingForResponse = false;
private bool isMonitorEmpty = false;
private bool isTimeout = false;
private readonly int responseTimeout = 2000;
private System.Timers.Timer timeout = new System.Timers.Timer(3000);
public struct Telegram
@ -67,6 +87,7 @@ namespace TelemetryIO
public SerialHandler()
{
com_port = new SerialPort();
timeout.AutoReset = false;
}
public SerialHandler(string PortName, int BaudRate)
@ -74,6 +95,7 @@ namespace TelemetryIO
com_port = new SerialPort();
com_port.PortName = PortName;
com_port.BaudRate = BaudRate;
timeout.AutoReset = false;
}
private void Serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
@ -87,7 +109,9 @@ namespace TelemetryIO
byte b = (byte)sp.ReadByte();
if (b == ESCAPE_END)
{
{//END BYTE IS RECEIVED
timeout.Stop();
isTimeout = false;
byte[] unscape = EscapeSeqToBytes(rx_buf.ToArray());
uint checksum = crc32(unscape, unscape.Length - 4);
uint re_checksum = DataSlots.bytes_to_uint(unscape, unscape.Length - 4);
@ -103,58 +127,171 @@ namespace TelemetryIO
if (cmd == TELE_CMD_RD_ONCE)
{
DataSlots.setSlot(slot, data, offset, len);
telemetry.setSlot(slot, data, offset, len);
OnAnswerReceived(slot.ToString());
//DataSlots.setSlot(slot, data, offset, len);
}
else if (cmd == TELE_CMD_RD_MON_ON)
{
{//READ MONITORING DATA
for(int i = 0; i < data.Length/4; i++)
{
monitor[i] = BitConverter.ToSingle(data, i*4);
}
OnMonitoringItemsReceived(monitor);
view_str = string.Join(", ", monitor.Select(x => "" + x).ToArray(), 0, data.Length/4);
}
else if (cmd == TELE_CMD_WR)
{
{//WRITTING OPERATION IS DONE WITH SUCCESS
if (data[0] == 'O' && data[1] == 'k')
{
Debug.Write("Data is written\n");
OnAnswerReceived("Data is written");
}
}else if(cmd == TELE_CMD_HELLO)
{
{//HANDSHAKING ANSWER
telemetry.setSlot(9999, data, 0, 0);
view_str = Encoding.ASCII.GetString(data);
req_buffer.Clear();
OnHandShakeOccurred();
getPIDs();
}else if(cmd == TELE_CMD_RD_MON_ADD)
{
OnAnswerReceived("ADD");
isMonitorEmpty = false;
}
else if(cmd == TELE_CMD_RD_MON_REMOVE)
{
OnAnswerReceived("REMOVE");
}else if(cmd == TELE_CMD_RD_MON_REMOVEALL)
{
OnAnswerReceived("REMOVEALL");
isMonitorEmpty = true;
}
}
waitingForResponse = false;
sendNextRequest();
}
else if (b == ESCAPE_BEGIN)
{
{//START BYTE IS RECEIVED
rx_buf.Clear();
}
else
{
{//FILLING BUFFER
rx_buf.Add(b);
}
}
}
public void Open()
{
com_port.Open();
com_port.DataReceived += Serial_DataReceived;
byte[] to = prepareTelegram(TELE_CMD_HELLO, 0, new byte[0], 0);
com_port.Write(to, 0, to.Length);
timeout.Elapsed += Timeout_Elapsed;
putRequest(prepareTelegram(TELE_CMD_HELLO, 0, new byte[0], 0));
}
private void Timeout_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
lock(lock_obj)
{
if(waitingForResponse)
{
//generate timeout event
Debug.WriteLine("Timeout!!!!!");
waitingForResponse = false;
isTimeout = true;
req_buffer.Clear();
this.Close();
}
}
}
public void Close()
{
com_port.DataReceived -= Serial_DataReceived;
timeout.Elapsed -= Timeout_Elapsed;
com_port.Close();
}
public void Exit()
{
RemoveMonitoringItems();
while (isMonitorEmpty || isTimeout) ;
if(!isTimeout)Close();
}
public void putRequest(byte[] request)
{
lock(lock_obj)
{
if (waitingForResponse)
{
req_buffer.Enqueue(request);
return;
}
sendRequest(request);
}
}
private void sendRequest(byte[] request)
{
waitingForResponse = true;
com_port.Write(request, 0, request.Length);
timeout.Stop();
timeout.Start();
}
private void sendNextRequest()
{
waitingForResponse = false;
if (req_buffer.Count > 0)
{
sendRequest(req_buffer.Dequeue());
}
}
public void getPIDs()
{
putRequest(prepareTelegram(TELE_CMD_RD_ONCE, 1000, new byte[0], 0, 4 * 9));
putRequest(prepareTelegram(TELE_CMD_RD_ONCE, 1001, new byte[0], 0, 4 * 9));
putRequest(prepareTelegram(TELE_CMD_RD_ONCE, 1002, new byte[0], 0, 4 * 9));
putRequest(prepareTelegram(TELE_CMD_RD_ONCE, 1003, new byte[0], 0, 4 * 9));
}
//**********************************************************************************************
//*************************************** REQUESTS BLOCK ***************************************
//**********************************************************************************************
public void stopMonitoring()
{
putRequest(prepareTelegram(TELE_CMD_RD_MON_OFF, 0, new byte[0], 0, 0));
}
public void startMonitoring()
{
putRequest(prepareTelegram(TELE_CMD_RD_MON_ON, 0, new byte[0], 0, 0));
}
public void AddMonitoringItem(int slot, int offset)
{
putRequest(prepareTelegram(TELE_CMD_RD_MON_ADD, slot, new byte[0], offset));
}
public void AddMonitoringItem(string name)
{
putRequest(prepareTelegram(TELE_CMD_RD_MON_ADD, new byte[0], name));
}
public void RemoveMonitoringItem(int position)
{
putRequest(prepareTelegram(TELE_CMD_RD_MON_REMOVE, position, new byte[0], 0));
}
public void RemoveMonitoringItems()
{
putRequest(prepareTelegram(TELE_CMD_RD_MON_REMOVEALL, 0, new byte[0], 0));
}
byte crc8(byte[] data, int length)
{
byte crc = 0x00; // Initial value
@ -224,6 +361,12 @@ namespace TelemetryIO
com_port.Write(b, 0, b.Length);
}
byte[] prepareTelegram<T>(int cmd, T[] load, string var_name)
{
VarAddress va = telemetry.getVarAdress(var_name);
return prepareTelegram(cmd, va.slot, load, va.offset, va.length);
}
byte[] prepareTelegram<T>(int cmd, int slot, T[] load, int offset, int len = 0)
{
byte[] byteload = DataArrayToBytes(load);
@ -341,6 +484,16 @@ namespace TelemetryIO
{
AnswerReceived?.Invoke(this, new SerialEventArgs(answer));
}
protected virtual void OnHandShakeOccurred()
{
HandShakeOccurred?.Invoke(this, new EventArgs());
}
protected virtual void OnMonitoringItemsReceived(float[] data)
{
MonitoringItemsReceived?.Invoke(this, new MonitoringEventArgs(data));
}
}
public class SerialEventArgs: EventArgs
@ -352,4 +505,14 @@ namespace TelemetryIO
Answer = answer;
}
}
public class MonitoringEventArgs: EventArgs
{
public float[] Data { get; set;}
public MonitoringEventArgs(float[] data)
{
Data = data;
}
}
}