+++
This commit is contained in:
27
DroneClient/FormMain.Designer.cs
generated
27
DroneClient/FormMain.Designer.cs
generated
@ -74,6 +74,8 @@
|
|||||||
label17 = new Label();
|
label17 = new Label();
|
||||||
label_OF_X = new Label();
|
label_OF_X = new Label();
|
||||||
label19 = new Label();
|
label19 = new Label();
|
||||||
|
trackBar_Value = new TrackBar();
|
||||||
|
label4 = new Label();
|
||||||
groupBox1.SuspendLayout();
|
groupBox1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown_Server_Port).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Server_Port).BeginInit();
|
||||||
groupBox2.SuspendLayout();
|
groupBox2.SuspendLayout();
|
||||||
@ -81,6 +83,7 @@
|
|||||||
groupBox4.SuspendLayout();
|
groupBox4.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackBar_Power).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackBar_Power).BeginInit();
|
||||||
groupBox5.SuspendLayout();
|
groupBox5.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)trackBar_Value).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// timer_Test
|
// timer_Test
|
||||||
@ -536,11 +539,33 @@
|
|||||||
label19.TabIndex = 4;
|
label19.TabIndex = 4;
|
||||||
label19.Text = "X:";
|
label19.Text = "X:";
|
||||||
//
|
//
|
||||||
|
// trackBar_Value
|
||||||
|
//
|
||||||
|
trackBar_Value.Location = new Point(349, 240);
|
||||||
|
trackBar_Value.Maximum = 100;
|
||||||
|
trackBar_Value.Minimum = 1;
|
||||||
|
trackBar_Value.Name = "trackBar_Value";
|
||||||
|
trackBar_Value.Orientation = Orientation.Vertical;
|
||||||
|
trackBar_Value.Size = new Size(45, 195);
|
||||||
|
trackBar_Value.TabIndex = 25;
|
||||||
|
trackBar_Value.Value = 1;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(347, 219);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(47, 15);
|
||||||
|
label4.TabIndex = 26;
|
||||||
|
label4.Text = "POWER";
|
||||||
|
//
|
||||||
// Form_Main
|
// Form_Main
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(446, 447);
|
ClientSize = new Size(446, 447);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Controls.Add(trackBar_Value);
|
||||||
Controls.Add(groupBox5);
|
Controls.Add(groupBox5);
|
||||||
Controls.Add(button_MR);
|
Controls.Add(button_MR);
|
||||||
Controls.Add(button_ML);
|
Controls.Add(button_ML);
|
||||||
@ -570,6 +595,7 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)trackBar_Power).EndInit();
|
((System.ComponentModel.ISupportInitialize)trackBar_Power).EndInit();
|
||||||
groupBox5.ResumeLayout(false);
|
groupBox5.ResumeLayout(false);
|
||||||
groupBox5.PerformLayout();
|
groupBox5.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)trackBar_Value).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@ -621,5 +647,6 @@
|
|||||||
private Label label17;
|
private Label label17;
|
||||||
private Label label_OF_X;
|
private Label label_OF_X;
|
||||||
private Label label19;
|
private Label label19;
|
||||||
|
private TrackBar trackBar_Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ namespace DroneSimulator
|
|||||||
|
|
||||||
private void button_UU_MouseDown(object sender, MouseEventArgs e)
|
private void button_UU_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
const float pow = 0.1f;
|
float pow = ((float)trackBar_Value.Value) / 10.0f;
|
||||||
|
|
||||||
if (sender == button_UU)
|
if (sender == button_UU)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,8 @@ namespace DroneSimulator
|
|||||||
public struct Speed { public static float From, To; }
|
public struct Speed { public static float From, To; }
|
||||||
public static float Direction;
|
public static float Direction;
|
||||||
public static float Density;
|
public static float Density;
|
||||||
public static float Resist;
|
public static float PosResist;
|
||||||
|
public static float RotResist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,27 +199,34 @@ namespace DroneSimulator
|
|||||||
flow += flow * 0.1f; // Воздушная подушка
|
flow += flow * 0.1f; // Воздушная подушка
|
||||||
}
|
}
|
||||||
|
|
||||||
SpdPRY += AccPRY * (Dynamic * time / (Mass * Length));
|
|
||||||
|
|
||||||
float wind_x = 0, wind_y = 0, wind_z = 0;
|
float wind_x = 0, wind_y = 0, wind_z = 0;
|
||||||
|
float wind_p = 0, wind_r = 0, wind_w = 0;
|
||||||
|
|
||||||
if (Area.Wind.Enable)
|
if (Area.Wind.Enable)
|
||||||
{
|
{
|
||||||
Quaternion dir = Quaternion.CreateFromAxisAngle(new Vector3(0, 0, 1), Area.Wind.Direction * TO_RADI * 2);
|
Quaternion dir = Quaternion.CreateFromAxisAngle(new Vector3(0, 0, 1), Area.Wind.Direction * TO_RADI * 2);
|
||||||
|
|
||||||
//Quaternion win = new Quaternion(0, 1, 0, 0) * dir;
|
|
||||||
|
|
||||||
Quaternion spd = new Quaternion(0, Area.Wind.Speed.From, 0, 0) * dir;
|
Quaternion spd = new Quaternion(0, Area.Wind.Speed.From, 0, 0) * dir;
|
||||||
|
|
||||||
float spd_x = spd.X - SpdXYZ.X;
|
float spd_x = spd.X - SpdXYZ.X;
|
||||||
float spd_y = spd.Y - SpdXYZ.Y;
|
float spd_y = spd.Y - SpdXYZ.Y;
|
||||||
float spd_z = spd.Z - SpdXYZ.Z;
|
float spd_z = spd.Z - SpdXYZ.Z;
|
||||||
|
|
||||||
wind_x = 0.5f * Area.Wind.Density * Area.Wind.Resist * (spd_x * MathF.Abs(spd_x));
|
wind_x = 0.5f * Area.Wind.Density * Area.Wind.PosResist * (spd_x * MathF.Abs(spd_x));
|
||||||
wind_y = 0.5f * Area.Wind.Density * Area.Wind.Resist * (spd_y * MathF.Abs(spd_y));
|
wind_y = 0.5f * Area.Wind.Density * Area.Wind.PosResist * (spd_y * MathF.Abs(spd_y));
|
||||||
wind_z = 0.5f * Area.Wind.Density * Area.Wind.Resist * (spd_z * MathF.Abs(spd_z));
|
wind_z = 0.5f * Area.Wind.Density * Area.Wind.PosResist * (spd_z * MathF.Abs(spd_z));
|
||||||
|
|
||||||
|
wind_p = 0.5f * Area.Wind.Density * Area.Wind.RotResist * (SpdPRY.X * MathF.Abs(SpdPRY.X));
|
||||||
|
wind_r = 0.5f * Area.Wind.Density * Area.Wind.RotResist * (SpdPRY.Y * MathF.Abs(SpdPRY.Y));
|
||||||
|
wind_w = 0.5f * Area.Wind.Density * Area.Wind.RotResist * (SpdPRY.Z * MathF.Abs(SpdPRY.Z));
|
||||||
|
|
||||||
|
AccPRY.X -= wind_p; AccPRY.Y -= wind_r; AccPRY.Z -= wind_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpdPRY += AccPRY * (Dynamic * time / (Mass * Length));
|
||||||
|
|
||||||
Quaternion pow = Quaternion.Inverse(Quat) * new Quaternion(0, 0, flow, 0) * Quat;
|
Quaternion pow = Quaternion.Inverse(Quat) * new Quaternion(0, 0, flow, 0) * Quat;
|
||||||
AccXYZ = new Vector3(pow.X + wind_x, pow.Y + wind_y, pow.Z + wind_z) * (Gravity / Mass);
|
AccXYZ = new Vector3(pow.X + wind_x, pow.Y + wind_y, pow.Z + wind_z) * (Gravity / Mass);
|
||||||
SpdXYZ += (AccXYZ + new Vector3(0, 0, -Gravity)) * time;
|
SpdXYZ += (AccXYZ + new Vector3(0, 0, -Gravity)) * time;
|
||||||
|
68
DroneSimulator/FormMain.Designer.cs
generated
68
DroneSimulator/FormMain.Designer.cs
generated
@ -155,7 +155,9 @@
|
|||||||
radioButton_Real = new RadioButton();
|
radioButton_Real = new RadioButton();
|
||||||
tabPage_Area = new TabPage();
|
tabPage_Area = new TabPage();
|
||||||
groupBox4 = new GroupBox();
|
groupBox4 = new GroupBox();
|
||||||
numericUpDown_Area_Wind_Resist = new NumericUpDown();
|
numericUpDown_Area_Wind_RotResist = new NumericUpDown();
|
||||||
|
label65 = new Label();
|
||||||
|
numericUpDown_Area_Wind_PosResist = new NumericUpDown();
|
||||||
label64 = new Label();
|
label64 = new Label();
|
||||||
label63 = new Label();
|
label63 = new Label();
|
||||||
numericUpDown_Area_Wind_Density = new NumericUpDown();
|
numericUpDown_Area_Wind_Density = new NumericUpDown();
|
||||||
@ -234,7 +236,8 @@
|
|||||||
groupBox2.SuspendLayout();
|
groupBox2.SuspendLayout();
|
||||||
tabPage_Area.SuspendLayout();
|
tabPage_Area.SuspendLayout();
|
||||||
groupBox4.SuspendLayout();
|
groupBox4.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Resist).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_RotResist).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_PosResist).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Density).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Density).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Speed_To).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Speed_To).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Direction).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Direction).BeginInit();
|
||||||
@ -1629,7 +1632,9 @@
|
|||||||
//
|
//
|
||||||
// groupBox4
|
// groupBox4
|
||||||
//
|
//
|
||||||
groupBox4.Controls.Add(numericUpDown_Area_Wind_Resist);
|
groupBox4.Controls.Add(numericUpDown_Area_Wind_RotResist);
|
||||||
|
groupBox4.Controls.Add(label65);
|
||||||
|
groupBox4.Controls.Add(numericUpDown_Area_Wind_PosResist);
|
||||||
groupBox4.Controls.Add(label64);
|
groupBox4.Controls.Add(label64);
|
||||||
groupBox4.Controls.Add(label63);
|
groupBox4.Controls.Add(label63);
|
||||||
groupBox4.Controls.Add(numericUpDown_Area_Wind_Density);
|
groupBox4.Controls.Add(numericUpDown_Area_Wind_Density);
|
||||||
@ -1646,31 +1651,51 @@
|
|||||||
groupBox4.Dock = DockStyle.Top;
|
groupBox4.Dock = DockStyle.Top;
|
||||||
groupBox4.Location = new Point(0, 53);
|
groupBox4.Location = new Point(0, 53);
|
||||||
groupBox4.Name = "groupBox4";
|
groupBox4.Name = "groupBox4";
|
||||||
groupBox4.Size = new Size(210, 150);
|
groupBox4.Size = new Size(210, 177);
|
||||||
groupBox4.TabIndex = 1;
|
groupBox4.TabIndex = 1;
|
||||||
groupBox4.TabStop = false;
|
groupBox4.TabStop = false;
|
||||||
groupBox4.Text = "Air and Wind";
|
groupBox4.Text = "Air and Wind";
|
||||||
//
|
//
|
||||||
// numericUpDown_Area_Wind_Resist
|
// numericUpDown_Area_Wind_RotResist
|
||||||
//
|
//
|
||||||
numericUpDown_Area_Wind_Resist.DecimalPlaces = 3;
|
numericUpDown_Area_Wind_RotResist.DecimalPlaces = 3;
|
||||||
numericUpDown_Area_Wind_Resist.Increment = new decimal(new int[] { 1, 0, 0, 131072 });
|
numericUpDown_Area_Wind_RotResist.Increment = new decimal(new int[] { 1, 0, 0, 65536 });
|
||||||
numericUpDown_Area_Wind_Resist.Location = new Point(63, 116);
|
numericUpDown_Area_Wind_RotResist.Location = new Point(89, 145);
|
||||||
numericUpDown_Area_Wind_Resist.Maximum = new decimal(new int[] { 1, 0, 0, 0 });
|
numericUpDown_Area_Wind_RotResist.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||||
numericUpDown_Area_Wind_Resist.Name = "numericUpDown_Area_Wind_Resist";
|
numericUpDown_Area_Wind_RotResist.Name = "numericUpDown_Area_Wind_RotResist";
|
||||||
numericUpDown_Area_Wind_Resist.Size = new Size(60, 23);
|
numericUpDown_Area_Wind_RotResist.Size = new Size(60, 23);
|
||||||
numericUpDown_Area_Wind_Resist.TabIndex = 13;
|
numericUpDown_Area_Wind_RotResist.TabIndex = 15;
|
||||||
numericUpDown_Area_Wind_Resist.Value = new decimal(new int[] { 1, 0, 0, 131072 });
|
numericUpDown_Area_Wind_RotResist.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
numericUpDown_Area_Wind_Resist.ValueChanged += numericUpDown_Area_Wind_Update;
|
numericUpDown_Area_Wind_RotResist.ValueChanged += numericUpDown_Area_Wind_Update;
|
||||||
|
//
|
||||||
|
// label65
|
||||||
|
//
|
||||||
|
label65.AutoSize = true;
|
||||||
|
label65.Location = new Point(6, 147);
|
||||||
|
label65.Name = "label65";
|
||||||
|
label65.Size = new Size(77, 15);
|
||||||
|
label65.TabIndex = 14;
|
||||||
|
label65.Text = "Rotate Resist:";
|
||||||
|
//
|
||||||
|
// numericUpDown_Area_Wind_PosResist
|
||||||
|
//
|
||||||
|
numericUpDown_Area_Wind_PosResist.DecimalPlaces = 3;
|
||||||
|
numericUpDown_Area_Wind_PosResist.Location = new Point(89, 116);
|
||||||
|
numericUpDown_Area_Wind_PosResist.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||||
|
numericUpDown_Area_Wind_PosResist.Name = "numericUpDown_Area_Wind_PosResist";
|
||||||
|
numericUpDown_Area_Wind_PosResist.Size = new Size(60, 23);
|
||||||
|
numericUpDown_Area_Wind_PosResist.TabIndex = 13;
|
||||||
|
numericUpDown_Area_Wind_PosResist.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
numericUpDown_Area_Wind_PosResist.ValueChanged += numericUpDown_Area_Wind_Update;
|
||||||
//
|
//
|
||||||
// label64
|
// label64
|
||||||
//
|
//
|
||||||
label64.AutoSize = true;
|
label64.AutoSize = true;
|
||||||
label64.Location = new Point(13, 118);
|
label64.Location = new Point(6, 118);
|
||||||
label64.Name = "label64";
|
label64.Name = "label64";
|
||||||
label64.Size = new Size(40, 15);
|
label64.Size = new Size(73, 15);
|
||||||
label64.TabIndex = 12;
|
label64.TabIndex = 12;
|
||||||
label64.Text = "Resist:";
|
label64.Text = "Move Resist:";
|
||||||
//
|
//
|
||||||
// label63
|
// label63
|
||||||
//
|
//
|
||||||
@ -1777,7 +1802,7 @@
|
|||||||
// checkBox_Area_Wind_Enable
|
// checkBox_Area_Wind_Enable
|
||||||
//
|
//
|
||||||
checkBox_Area_Wind_Enable.AutoSize = true;
|
checkBox_Area_Wind_Enable.AutoSize = true;
|
||||||
checkBox_Area_Wind_Enable.Location = new Point(165, 125);
|
checkBox_Area_Wind_Enable.Location = new Point(165, 149);
|
||||||
checkBox_Area_Wind_Enable.Name = "checkBox_Area_Wind_Enable";
|
checkBox_Area_Wind_Enable.Name = "checkBox_Area_Wind_Enable";
|
||||||
checkBox_Area_Wind_Enable.Size = new Size(39, 19);
|
checkBox_Area_Wind_Enable.Size = new Size(39, 19);
|
||||||
checkBox_Area_Wind_Enable.TabIndex = 0;
|
checkBox_Area_Wind_Enable.TabIndex = 0;
|
||||||
@ -1987,7 +2012,8 @@
|
|||||||
tabPage_Area.ResumeLayout(false);
|
tabPage_Area.ResumeLayout(false);
|
||||||
groupBox4.ResumeLayout(false);
|
groupBox4.ResumeLayout(false);
|
||||||
groupBox4.PerformLayout();
|
groupBox4.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Resist).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_RotResist).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_PosResist).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Density).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Density).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Speed_To).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Speed_To).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Direction).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDown_Area_Wind_Direction).EndInit();
|
||||||
@ -2151,7 +2177,9 @@
|
|||||||
private Label label63;
|
private Label label63;
|
||||||
private NumericUpDown numericUpDown_Area_Wind_Density;
|
private NumericUpDown numericUpDown_Area_Wind_Density;
|
||||||
private Label label62;
|
private Label label62;
|
||||||
private NumericUpDown numericUpDown_Area_Wind_Resist;
|
private NumericUpDown numericUpDown_Area_Wind_PosResist;
|
||||||
private Label label64;
|
private Label label64;
|
||||||
|
private NumericUpDown numericUpDown_Area_Wind_RotResist;
|
||||||
|
private Label label65;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,8 @@ namespace DroneSimulator
|
|||||||
Area.Wind.Speed.To = (float)numericUpDown_Area_Wind_Speed_To.Value;
|
Area.Wind.Speed.To = (float)numericUpDown_Area_Wind_Speed_To.Value;
|
||||||
Area.Wind.Direction = (float)numericUpDown_Area_Wind_Direction.Value;
|
Area.Wind.Direction = (float)numericUpDown_Area_Wind_Direction.Value;
|
||||||
Area.Wind.Density = (float)numericUpDown_Area_Wind_Density.Value;
|
Area.Wind.Density = (float)numericUpDown_Area_Wind_Density.Value;
|
||||||
Area.Wind.Resist = (float)numericUpDown_Area_Wind_Resist.Value;
|
Area.Wind.PosResist = ((float)numericUpDown_Area_Wind_PosResist.Value)/1000.0f;
|
||||||
|
Area.Wind.RotResist = ((float)numericUpDown_Area_Wind_RotResist.Value)/1000.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user