增加设定温度和温度限速功能
This commit is contained in:
@@ -104,6 +104,12 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CameraManager.cs" />
|
||||
<Compile Include="ParameterInputForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ParameterInputForm.Designer.cs">
|
||||
<DependentUpon>ParameterInputForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ShowForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -113,6 +119,9 @@
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="tempControl.cs" />
|
||||
<EmbeddedResource Include="ParameterInputForm.resx">
|
||||
<DependentUpon>ParameterInputForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ShowForm.resx">
|
||||
<DependentUpon>ShowForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
55
HitBotCSharpDemo/ParameterInputForm.Designer.cs
generated
Normal file
55
HitBotCSharpDemo/ParameterInputForm.Designer.cs
generated
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HitBotCSharpDemo
|
||||
{
|
||||
partial class ParameterInputForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ParameterInputForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(450, 225);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ParameterInputForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "参数设置";
|
||||
this.Load += new System.EventHandler(this.ParameterInputForm_Load_1);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
120
HitBotCSharpDemo/ParameterInputForm.cs
Normal file
120
HitBotCSharpDemo/ParameterInputForm.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HitBotCSharpDemo
|
||||
{
|
||||
public partial class ParameterInputForm : Form
|
||||
{
|
||||
private TextBox textBoxInput;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private Label labelTitle;
|
||||
public string InputValue { get; private set; }
|
||||
public ParameterInputForm(string parameterName, string currentValue)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeCustomComponents(parameterName, currentValue);
|
||||
}
|
||||
private void InitializeCustomComponents(string parameterName, string currentValue)
|
||||
{
|
||||
// 标题标签
|
||||
labelTitle = new Label();
|
||||
labelTitle.Text = $"设置 {parameterName}:";
|
||||
labelTitle.Location = new Point(20, 20);
|
||||
labelTitle.Size = new Size(260, 20);
|
||||
labelTitle.Font = new Font("Microsoft Sans Serif", 9F, FontStyle.Regular);
|
||||
this.Controls.Add(labelTitle);
|
||||
// 输入文本框
|
||||
textBoxInput = new TextBox();
|
||||
textBoxInput.Text = currentValue;
|
||||
textBoxInput.Location = new Point(20, 50);
|
||||
textBoxInput.Size = new Size(260, 20);
|
||||
textBoxInput.Font = new Font("Microsoft Sans Serif", 9F, FontStyle.Regular);
|
||||
// 自动选中所有文本
|
||||
textBoxInput.SelectAll();
|
||||
textBoxInput.Focus();
|
||||
this.Controls.Add(textBoxInput);
|
||||
// 保存按钮
|
||||
buttonSave = new Button();
|
||||
buttonSave.Text = "保存";
|
||||
buttonSave.Location = new Point(125, 90);
|
||||
buttonSave.Size = new Size(75, 25);
|
||||
buttonSave.DialogResult = DialogResult.OK;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
this.Controls.Add(buttonSave);
|
||||
// 取消按钮
|
||||
buttonCancel = new Button();
|
||||
buttonCancel.Text = "取消";
|
||||
buttonCancel.Location = new Point(205, 90);
|
||||
buttonCancel.Size = new Size(75, 25);
|
||||
buttonCancel.DialogResult = DialogResult.Cancel;
|
||||
this.Controls.Add(buttonCancel);
|
||||
// 设置默认按钮和取消按钮
|
||||
this.AcceptButton = buttonSave;
|
||||
this.CancelButton = buttonCancel;
|
||||
// 添加Enter键处理
|
||||
textBoxInput.KeyPress += TextBoxInput_KeyPress;
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
InputValue = textBoxInput.Text.Trim();
|
||||
|
||||
// 验证输入
|
||||
if (string.IsNullOrEmpty(InputValue))
|
||||
{
|
||||
MessageBox.Show("请输入数值", "输入错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
textBoxInput.Focus();
|
||||
return;
|
||||
}
|
||||
if (!double.TryParse(InputValue, out double value))
|
||||
{
|
||||
MessageBox.Show("请输入有效的数字", "输入错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
textBoxInput.Focus();
|
||||
return;
|
||||
}
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
private void TextBoxInput_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
// 按Enter键相当于点击保存按钮
|
||||
if (e.KeyChar == (char)Keys.Enter)
|
||||
{
|
||||
e.Handled = true;
|
||||
ButtonSave_Click(sender, e);
|
||||
}
|
||||
// 按Escape键相当于点击取消按钮
|
||||
else if (e.KeyChar == (char)Keys.Escape)
|
||||
{
|
||||
e.Handled = true;
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
// 确保文本框获得焦点并选中所有文本
|
||||
textBoxInput.Focus();
|
||||
textBoxInput.SelectAll();
|
||||
}
|
||||
private void ParameterInputForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ParameterInputForm_Load_1(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
120
HitBotCSharpDemo/ParameterInputForm.resx
Normal file
120
HitBotCSharpDemo/ParameterInputForm.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
488
HitBotCSharpDemo/RobotControl.cs
Normal file
488
HitBotCSharpDemo/RobotControl.cs
Normal file
@@ -0,0 +1,488 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ControlBeanExDll;
|
||||
using TcpserverExDll;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HitBotCSharpDemo
|
||||
{
|
||||
internal class RobotControl
|
||||
{
|
||||
private ControlBeanEx robot;
|
||||
private bool isInit = false;
|
||||
private Thread thread_Jog_Move;
|
||||
private bool moveFlag;
|
||||
private Button currentButton;
|
||||
private int offset = 2; // 寸动距离
|
||||
private int offset_jog = 2; // 连续移动单次距离
|
||||
private static int io_Count = 6; // IO数量
|
||||
private int[] io_In = new int[io_Count];
|
||||
private int[] io_Out = new int[io_Count];
|
||||
private bool[] output_State_Flags = new bool[6] { true, true, true, true, true, true };
|
||||
|
||||
// 点位相关
|
||||
private float[] pos0, pos1, pos2;
|
||||
private int posHand0, posHand1, posHand2;
|
||||
private Thread thread_PosMove;
|
||||
private static object locker_PosMove = new object();
|
||||
|
||||
// 相机点位相关
|
||||
private float[][] cameraPositions;
|
||||
private string filePath = "Cam_pos_path.txt";
|
||||
public bool IsInitialized => isInit;
|
||||
public ControlBeanEx Robot => robot;
|
||||
public RobotControl()
|
||||
{
|
||||
TcpserverEx.net_port_initial();
|
||||
robot = TcpserverEx.get_robot(74); // 替换为自己的机器的id号
|
||||
}
|
||||
public void ScanRobotIDs(ComboBox comboBox)
|
||||
{
|
||||
comboBox.Items.Clear();
|
||||
for (int i = 0; i < 255; i++)
|
||||
{
|
||||
ControlBeanEx tempRobot = TcpserverEx.get_robot(i);
|
||||
if (tempRobot.is_connected())
|
||||
{
|
||||
comboBox.Items.Add(i.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool InitializeRobot(string robotId, RichTextBox coordTextBox)
|
||||
{
|
||||
coordTextBox.Clear();
|
||||
if (robot == null) return false;
|
||||
|
||||
robot = TcpserverEx.get_robot(int.Parse(robotId));
|
||||
robot.check_joint(4, false);
|
||||
|
||||
if (robot.is_connected())
|
||||
{
|
||||
int ret = robot.initial(1, 240); // 修改自己机器的型号
|
||||
if (ret == 1)
|
||||
{
|
||||
robot.unlock_position();
|
||||
isInit = true;
|
||||
MessageBox.Show("robot 初始化完成");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("robot 初始化失败,返回值 = " + ret.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("robot 未连接");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public void HandleJogMove(Button button, CheckBox inchingCheckBox)
|
||||
{
|
||||
if (!isInit)
|
||||
{
|
||||
MessageBox.Show("机械臂未初始化");
|
||||
return;
|
||||
}
|
||||
currentButton = button;
|
||||
|
||||
if (inchingCheckBox.Checked) // 寸动模式
|
||||
{
|
||||
ExecuteInchingMove(button);
|
||||
}
|
||||
// 连续移动由MouseDown事件处理
|
||||
}
|
||||
public void StartJogMove(Button button)
|
||||
{
|
||||
currentButton = button;
|
||||
if (currentButton == null) return;
|
||||
|
||||
thread_Jog_Move = new Thread(ExecuteContinuousMove);
|
||||
thread_Jog_Move.IsBackground = true;
|
||||
thread_Jog_Move.Start();
|
||||
}
|
||||
public void StopJogMove(CheckBox inchingCheckBox)
|
||||
{
|
||||
if (robot != null && !inchingCheckBox.Checked)
|
||||
{
|
||||
robot.new_stop_move();
|
||||
}
|
||||
currentButton = null;
|
||||
moveFlag = false;
|
||||
}
|
||||
public void GetJointState(ComboBox jointComboBox, RichTextBox displayTextBox)
|
||||
{
|
||||
if (!isInit)
|
||||
{
|
||||
MessageBox.Show("机械臂未初始化");
|
||||
return;
|
||||
}
|
||||
|
||||
int jointNumber = int.Parse(jointComboBox.SelectedItem.ToString());
|
||||
int ret = robot.get_joint_state(jointNumber);
|
||||
|
||||
displayTextBox.Clear();
|
||||
switch (ret)
|
||||
{
|
||||
case 1:
|
||||
displayTextBox.SelectedText = "关节" + jointNumber + "正常";
|
||||
break;
|
||||
default:
|
||||
displayTextBox.SelectedText = "关节" + jointNumber + "异常!异常代码:" + ret + ".(详情请查看API文档)";
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void UpdateIOAndCoordinates(RichTextBox coordTextBox, Label[] inputLabels, Label[] outputLabels)
|
||||
{
|
||||
if (!isInit) return;
|
||||
|
||||
robot.get_scara_param();
|
||||
coordTextBox.Text = "Coord: X:" + robot.x + "mm " + "Y:" + robot.y + "mm " + "Z:" + robot.z + "mm " +
|
||||
"R:" + robot.rotation + "°" + "Hand:" + (robot.get_lr() == 1 ? "R" : "L") + " ";
|
||||
// 更新IO状态
|
||||
for (int i = 0; i < io_Count; i++)
|
||||
{
|
||||
io_In[i] = robot.get_digital_in(i);
|
||||
io_Out[i] = robot.get_digital_out(i);
|
||||
}
|
||||
// 更新输入标签颜色
|
||||
for (int i = 0; i < io_Count; i++)
|
||||
{
|
||||
Color newColor = GetIOColor(io_In[i]);
|
||||
if (inputLabels[i].BackColor != newColor)
|
||||
inputLabels[i].BackColor = newColor;
|
||||
}
|
||||
// 更新输出标签颜色
|
||||
for (int i = 0; i < io_Count; i++)
|
||||
{
|
||||
Color newColor = GetIOColor(io_Out[i]);
|
||||
if (outputLabels[i].BackColor != newColor)
|
||||
outputLabels[i].BackColor = newColor;
|
||||
}
|
||||
}
|
||||
public void ToggleDigitalOutput(Label outputLabel, Label[] allOutputLabels)
|
||||
{
|
||||
int outputNum = GetOutputNumber(outputLabel, allOutputLabels);
|
||||
if (outputNum >= 0)
|
||||
{
|
||||
robot.set_digital_out(outputNum, output_State_Flags[outputNum]);
|
||||
output_State_Flags[outputNum] = !output_State_Flags[outputNum];
|
||||
}
|
||||
}
|
||||
public void SetPosition(int positionIndex, RichTextBox displayTextBox)
|
||||
{
|
||||
if (!isInit)
|
||||
{
|
||||
MessageBox.Show("机械臂未初始化");
|
||||
return;
|
||||
}
|
||||
robot.get_scara_param();
|
||||
displayTextBox.Clear();
|
||||
displayTextBox.Text = "Coord: X:" + robot.x + "mm " + "Y:" + robot.y + "mm " + "Z:" + robot.z + "mm " +
|
||||
"R:" + robot.rotation + "°" + "Hand:" + (robot.get_lr() == 1 ? "R" : "L") + " ";
|
||||
switch (positionIndex)
|
||||
{
|
||||
case 0:
|
||||
pos0 = new float[] { robot.x, robot.y, robot.z, robot.rotation };
|
||||
posHand0 = robot.get_lr();
|
||||
break;
|
||||
case 1:
|
||||
pos1 = new float[] { robot.x, robot.y, robot.z, robot.rotation };
|
||||
posHand1 = robot.get_lr();
|
||||
break;
|
||||
case 2:
|
||||
pos2 = new float[] { robot.x, robot.y, robot.z, robot.rotation };
|
||||
posHand2 = robot.get_lr();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void StartPositionLoop(Button pauseBtn, Button resumeBtn)
|
||||
{
|
||||
pauseBtn.Enabled = true;
|
||||
resumeBtn.Enabled = true;
|
||||
|
||||
if (pos0 == null || pos1 == null || pos2 == null)
|
||||
{
|
||||
MessageBox.Show("请先设置3个点位!");
|
||||
return;
|
||||
}
|
||||
|
||||
thread_PosMove = new Thread(ExecutePositionLoop);
|
||||
thread_PosMove.IsBackground = false;
|
||||
thread_PosMove.Start();
|
||||
}
|
||||
public void PauseMove(Button stopBtn)
|
||||
{
|
||||
stopBtn.Enabled = false;
|
||||
robot.pause_move();
|
||||
}
|
||||
public void ResumeMove(Button stopBtn)
|
||||
{
|
||||
stopBtn.Enabled = true;
|
||||
robot.resume_move();
|
||||
}
|
||||
public void StopMove(Button pauseBtn, Button resumeBtn)
|
||||
{
|
||||
pauseBtn.Enabled = false;
|
||||
resumeBtn.Enabled = false;
|
||||
robot.new_stop_move();
|
||||
thread_PosMove.Abort();
|
||||
}
|
||||
public void HomeJoint(Button jointButton)
|
||||
{
|
||||
if (!isInit)
|
||||
{
|
||||
MessageBox.Show("机械臂未初始化");
|
||||
return;
|
||||
}
|
||||
int jointNumber = GetJointNumber(jointButton);
|
||||
if (jointNumber > 0)
|
||||
{
|
||||
robot.joint_home(jointNumber);
|
||||
}
|
||||
}
|
||||
//public void LoadCameraPositions()
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// if (File.Exists(filePath))
|
||||
// {
|
||||
// string[] lines = File.ReadAllLines(filePath);
|
||||
// cameraPositions = new float[5][]; // 存储5个点位
|
||||
// int positionIndex = 0;
|
||||
// foreach (string line in lines)
|
||||
// {
|
||||
// // 跳过注释行(以#开头)和空行
|
||||
// if (string.IsNullOrWhiteSpace(line) || line.StartsWith("#"))
|
||||
// continue;
|
||||
// if (positionIndex < 5)
|
||||
// {
|
||||
// string[] coords = line.Split(',');
|
||||
// if (coords.Length == 4)
|
||||
// {
|
||||
// cameraPositions[positionIndex] = new float[4];
|
||||
// for (int i = 0; i < 4; i++)
|
||||
// {
|
||||
// if (float.TryParse(coords[i].Trim(), out float value))
|
||||
// {
|
||||
// cameraPositions[positionIndex][i] = value;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// MessageBox.Show($"解析第{positionIndex + 1}行第{i + 1}个坐标时出错:{coords[i]}");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// positionIndex++;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// MessageBox.Show($"第{positionIndex + 1}行坐标格式错误,应该包含4个值(X,Y,Z,R)");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// MessageBox.Show($"未找到文件:{filePath}");
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// MessageBox.Show($"加载点位文件时出错:{ex.Message}");
|
||||
// }
|
||||
//}
|
||||
public void MoveToCameraPosition(int positionIndex)
|
||||
{
|
||||
if (!isInit)
|
||||
{
|
||||
MessageBox.Show("机械臂未初始化");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cameraPositions == null || positionIndex >= cameraPositions.Length || cameraPositions[positionIndex] == null)
|
||||
{
|
||||
MessageBox.Show($"点位{positionIndex + 1}数据未加载或无效");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 获取当前位置参数
|
||||
robot.get_scara_param();
|
||||
int currentHand = robot.get_lr(); // 使用当前手系
|
||||
float x = cameraPositions[positionIndex][0];
|
||||
float y = cameraPositions[positionIndex][1];
|
||||
float z = cameraPositions[positionIndex][2];
|
||||
float r = cameraPositions[positionIndex][3];
|
||||
// 设置运动参数
|
||||
robot.new_set_acc(30, 30, 30, 30);
|
||||
// 移动到指定位置
|
||||
int result = robot.new_movej_xyz_lr(x, y, z, r, 100, 0, currentHand);
|
||||
if (result != 1)
|
||||
{
|
||||
MessageBox.Show($"移动到点位{positionIndex + 1}失败,返回值:{result}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"移动到点位{positionIndex + 1}时出错:{ex.Message}");
|
||||
}
|
||||
}
|
||||
public void WaitForRobotStop()
|
||||
{
|
||||
if (!isInit) return;
|
||||
while (true)
|
||||
{
|
||||
robot.get_scara_param();
|
||||
if (!robot.move_flag) // 机械臂处于静止状态
|
||||
{
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(100); // 每100ms检查一次
|
||||
}
|
||||
}
|
||||
private void ExecuteInchingMove(Button button)
|
||||
{
|
||||
robot.get_scara_param();
|
||||
int hand = robot.get_lr();
|
||||
float speed = 2;
|
||||
robot.new_set_acc(30, 30, 30, 30);
|
||||
string buttonName = button.Name;
|
||||
|
||||
switch (buttonName)
|
||||
{
|
||||
case "btn_XP":
|
||||
robot.new_movej_xyz_lr(robot.x + offset, robot.y, robot.z, robot.rotation, speed, 0, hand);
|
||||
break;
|
||||
case "btn_XN":
|
||||
robot.new_movej_xyz_lr(robot.x - offset, robot.y, robot.z, robot.rotation, speed, 0, hand);
|
||||
break;
|
||||
case "btn_YP":
|
||||
robot.new_movej_xyz_lr(robot.x, robot.y + offset, robot.z, robot.rotation, speed, 0, hand);
|
||||
break;
|
||||
case "btn_YN":
|
||||
robot.new_movej_xyz_lr(robot.x, robot.y - offset, robot.z, robot.rotation, speed, 0, hand);
|
||||
break;
|
||||
case "btn_ZP":
|
||||
robot.new_movej_xyz_lr(robot.x, robot.y, robot.z + offset, robot.rotation, speed, 0, hand);
|
||||
break;
|
||||
case "btn_ZN":
|
||||
robot.new_movej_xyz_lr(robot.x, robot.y, robot.z - offset, robot.rotation, speed, 0, hand);
|
||||
break;
|
||||
case "btn_RP":
|
||||
robot.new_movej_xyz_lr(robot.x, robot.y, robot.z, robot.rotation + offset, speed, 0, hand);
|
||||
break;
|
||||
case "btn_RN":
|
||||
robot.new_movej_xyz_lr(robot.x, robot.y, robot.z, robot.rotation - offset, speed, 0, hand);
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void ExecuteContinuousMove()
|
||||
{
|
||||
moveFlag = true;
|
||||
while (moveFlag && currentButton != null)
|
||||
{
|
||||
string buttonName = currentButton.Name;
|
||||
|
||||
switch (buttonName)
|
||||
{
|
||||
case "btn_XP":
|
||||
robot.jog_move2(offset_jog, 0, 0, 0, 1);
|
||||
break;
|
||||
case "btn_XN":
|
||||
robot.jog_move2(-offset_jog, 0, 0, 0, 1);
|
||||
break;
|
||||
case "btn_YP":
|
||||
robot.jog_move2(0, offset_jog, 0, 0, 1);
|
||||
break;
|
||||
case "btn_YN":
|
||||
robot.jog_move2(0, -offset_jog, 0, 0, 1);
|
||||
break;
|
||||
case "btn_ZP":
|
||||
robot.jog_move2(0, 0, offset_jog, 0, 1);
|
||||
break;
|
||||
case "btn_ZN":
|
||||
robot.jog_move2(0, 0, -offset_jog, 0, 1);
|
||||
break;
|
||||
case "btn_RP":
|
||||
robot.jog_move2(0, 0, 0, offset_jog, 1);
|
||||
break;
|
||||
case "btn_RN":
|
||||
robot.jog_move2(0, 0, 0, -offset_jog, 1);
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
robot.wait_stop();
|
||||
}
|
||||
private void ExecutePositionLoop()
|
||||
{
|
||||
lock (locker_PosMove)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
robot.resume_move();
|
||||
robot.get_scara_param();
|
||||
robot.new_movej_xyz_lr(pos0[0], pos0[1], pos0[2], pos0[3], 50, 0, posHand0);
|
||||
robot.wait_stop();
|
||||
robot.new_movej_xyz_lr(pos1[0], pos1[1], pos1[2], pos1[3], 50, 0, posHand1);
|
||||
robot.wait_stop();
|
||||
robot.new_movej_xyz_lr(pos2[0], pos2[1], pos2[2], pos2[3], 50, 0, posHand2);
|
||||
robot.wait_stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
private Color GetIOColor(int ioState)
|
||||
{
|
||||
switch (ioState)
|
||||
{
|
||||
case -1:
|
||||
case 3:
|
||||
return Color.Gray;
|
||||
case 0:
|
||||
return Color.Green;
|
||||
case 1:
|
||||
return Color.Red;
|
||||
default:
|
||||
return Color.Gray;
|
||||
}
|
||||
}
|
||||
private int GetOutputNumber(Label outputLabel, Label[] allOutputLabels)
|
||||
{
|
||||
for (int i = 0; i < allOutputLabels.Length; i++)
|
||||
{
|
||||
if (outputLabel == allOutputLabels[i])
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
private int GetJointNumber(Button jointButton)
|
||||
{
|
||||
string buttonName = jointButton.Name;
|
||||
switch (buttonName)
|
||||
{
|
||||
case "btn_joint1":
|
||||
return 1;
|
||||
case "btn_joint2":
|
||||
return 2;
|
||||
case "btn_joint3":
|
||||
return 3;
|
||||
case "btn_joint4":
|
||||
return 4;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
895
HitBotCSharpDemo/ShowForm.Designer.cs
generated
895
HitBotCSharpDemo/ShowForm.Designer.cs
generated
@@ -120,6 +120,50 @@
|
||||
this.cam_btn_2 = new System.Windows.Forms.Button();
|
||||
this.cam_btn_1 = new System.Windows.Forms.Button();
|
||||
this.tap_tempCtrl = new System.Windows.Forms.TabPage();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.textBox9 = new System.Windows.Forms.TextBox();
|
||||
this.label26 = new System.Windows.Forms.Label();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button11 = new System.Windows.Forms.Button();
|
||||
this.textBox5 = new System.Windows.Forms.TextBox();
|
||||
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.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.textBox8 = new System.Windows.Forms.TextBox();
|
||||
this.label25 = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.button8 = new System.Windows.Forms.Button();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.label15 = new System.Windows.Forms.Label();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.label17 = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.textBox7 = new System.Windows.Forms.TextBox();
|
||||
this.label24 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.button7 = new System.Windows.Forms.Button();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.grb_pos1 = new System.Windows.Forms.GroupBox();
|
||||
this.textBox6 = new System.Windows.Forms.TextBox();
|
||||
this.label23 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.grb_temport = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
@@ -129,42 +173,6 @@
|
||||
this.lbl_Refresh_ID = new System.Windows.Forms.Label();
|
||||
this.tim_IO_Refresh = new System.Windows.Forms.Timer(this.components);
|
||||
this.rit_Coord = new System.Windows.Forms.RichTextBox();
|
||||
this.grb_pos1 = new System.Windows.Forms.GroupBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.button7 = new System.Windows.Forms.Button();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.button8 = new System.Windows.Forms.Button();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.label15 = new System.Windows.Forms.Label();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.label17 = new System.Windows.Forms.Label();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button11 = new System.Windows.Forms.Button();
|
||||
this.textBox5 = new System.Windows.Forms.TextBox();
|
||||
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.tac_MainForm.SuspendLayout();
|
||||
this.tap_Axis.SuspendLayout();
|
||||
this.grb_R.SuspendLayout();
|
||||
@@ -181,12 +189,12 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cam_feed)).BeginInit();
|
||||
this.tap_tempCtrl.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.grb_pos1.SuspendLayout();
|
||||
this.grb_temport.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.grb_pos1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btn_Init
|
||||
@@ -1250,6 +1258,436 @@
|
||||
this.tap_tempCtrl.UseVisualStyleBackColor = true;
|
||||
this.tap_tempCtrl.Click += new System.EventHandler(this.tabPage1_Click);
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.textBox9);
|
||||
this.groupBox3.Controls.Add(this.label26);
|
||||
this.groupBox3.Controls.Add(this.label18);
|
||||
this.groupBox3.Controls.Add(this.button10);
|
||||
this.groupBox3.Controls.Add(this.button11);
|
||||
this.groupBox3.Controls.Add(this.textBox5);
|
||||
this.groupBox3.Controls.Add(this.label19);
|
||||
this.groupBox3.Controls.Add(this.label20);
|
||||
this.groupBox3.Controls.Add(this.label21);
|
||||
this.groupBox3.Controls.Add(this.label22);
|
||||
this.groupBox3.Location = new System.Drawing.Point(61, 615);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(1094, 100);
|
||||
this.groupBox3.TabIndex = 11;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "点位4";
|
||||
//
|
||||
// textBox9
|
||||
//
|
||||
this.textBox9.Location = new System.Drawing.Point(730, 39);
|
||||
this.textBox9.Name = "textBox9";
|
||||
this.textBox9.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox9.TabIndex = 15;
|
||||
//
|
||||
// label26
|
||||
//
|
||||
this.label26.AutoSize = true;
|
||||
this.label26.Location = new System.Drawing.Point(642, 44);
|
||||
this.label26.Name = "label26";
|
||||
this.label26.Size = new System.Drawing.Size(98, 18);
|
||||
this.label26.TabIndex = 14;
|
||||
this.label26.Text = "温度限速:";
|
||||
this.label26.Click += new System.EventHandler(this.label26_Click);
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Location = new System.Drawing.Point(540, 45);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(17, 18);
|
||||
this.label18.TabIndex = 9;
|
||||
this.label18.Text = "0";
|
||||
//
|
||||
// button10
|
||||
//
|
||||
this.button10.Location = new System.Drawing.Point(980, 32);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(97, 40);
|
||||
this.button10.TabIndex = 8;
|
||||
this.button10.Text = "保存";
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button11
|
||||
//
|
||||
this.button11.Location = new System.Drawing.Point(866, 34);
|
||||
this.button11.Name = "button11";
|
||||
this.button11.Size = new System.Drawing.Size(92, 40);
|
||||
this.button11.TabIndex = 7;
|
||||
this.button11.Text = "开始升温";
|
||||
this.button11.UseVisualStyleBackColor = true;
|
||||
this.button11.Click += new System.EventHandler(this.button11_Click);
|
||||
//
|
||||
// textBox5
|
||||
//
|
||||
this.textBox5.Location = new System.Drawing.Point(309, 38);
|
||||
this.textBox5.Name = "textBox5";
|
||||
this.textBox5.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox5.TabIndex = 8;
|
||||
//
|
||||
// label19
|
||||
//
|
||||
this.label19.AutoSize = true;
|
||||
this.label19.Location = new System.Drawing.Point(449, 44);
|
||||
this.label19.Name = "label19";
|
||||
this.label19.Size = new System.Drawing.Size(98, 18);
|
||||
this.label19.TabIndex = 7;
|
||||
this.label19.Text = "设定温度:";
|
||||
//
|
||||
// label20
|
||||
//
|
||||
this.label20.AutoSize = true;
|
||||
this.label20.Location = new System.Drawing.Point(215, 42);
|
||||
this.label20.Name = "label20";
|
||||
this.label20.Size = new System.Drawing.Size(98, 18);
|
||||
this.label20.TabIndex = 2;
|
||||
this.label20.Text = "调节温度:";
|
||||
//
|
||||
// label21
|
||||
//
|
||||
this.label21.AutoSize = true;
|
||||
this.label21.Location = new System.Drawing.Point(116, 43);
|
||||
this.label21.Name = "label21";
|
||||
this.label21.Size = new System.Drawing.Size(17, 18);
|
||||
this.label21.TabIndex = 1;
|
||||
this.label21.Text = "0";
|
||||
//
|
||||
// label22
|
||||
//
|
||||
this.label22.AutoSize = true;
|
||||
this.label22.Location = new System.Drawing.Point(26, 42);
|
||||
this.label22.Name = "label22";
|
||||
this.label22.Size = new System.Drawing.Size(98, 18);
|
||||
this.label22.TabIndex = 0;
|
||||
this.label22.Text = "实际温度:";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.textBox8);
|
||||
this.groupBox2.Controls.Add(this.label25);
|
||||
this.groupBox2.Controls.Add(this.label13);
|
||||
this.groupBox2.Controls.Add(this.button8);
|
||||
this.groupBox2.Controls.Add(this.button9);
|
||||
this.groupBox2.Controls.Add(this.textBox4);
|
||||
this.groupBox2.Controls.Add(this.label14);
|
||||
this.groupBox2.Controls.Add(this.label15);
|
||||
this.groupBox2.Controls.Add(this.label16);
|
||||
this.groupBox2.Controls.Add(this.label17);
|
||||
this.groupBox2.Location = new System.Drawing.Point(61, 488);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(1094, 100);
|
||||
this.groupBox2.TabIndex = 10;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "点位3";
|
||||
//
|
||||
// textBox8
|
||||
//
|
||||
this.textBox8.Location = new System.Drawing.Point(730, 38);
|
||||
this.textBox8.Name = "textBox8";
|
||||
this.textBox8.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox8.TabIndex = 14;
|
||||
//
|
||||
// label25
|
||||
//
|
||||
this.label25.AutoSize = true;
|
||||
this.label25.Location = new System.Drawing.Point(642, 43);
|
||||
this.label25.Name = "label25";
|
||||
this.label25.Size = new System.Drawing.Size(98, 18);
|
||||
this.label25.TabIndex = 14;
|
||||
this.label25.Text = "温度限速:";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(540, 42);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(17, 18);
|
||||
this.label13.TabIndex = 9;
|
||||
this.label13.Text = "0";
|
||||
//
|
||||
// button8
|
||||
//
|
||||
this.button8.Location = new System.Drawing.Point(980, 32);
|
||||
this.button8.Name = "button8";
|
||||
this.button8.Size = new System.Drawing.Size(97, 40);
|
||||
this.button8.TabIndex = 8;
|
||||
this.button8.Text = "保存";
|
||||
this.button8.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button9
|
||||
//
|
||||
this.button9.Location = new System.Drawing.Point(866, 32);
|
||||
this.button9.Name = "button9";
|
||||
this.button9.Size = new System.Drawing.Size(92, 40);
|
||||
this.button9.TabIndex = 7;
|
||||
this.button9.Text = "开始升温";
|
||||
this.button9.UseVisualStyleBackColor = true;
|
||||
this.button9.Click += new System.EventHandler(this.button9_Click);
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.Location = new System.Drawing.Point(309, 38);
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox4.TabIndex = 8;
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(449, 41);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(98, 18);
|
||||
this.label14.TabIndex = 7;
|
||||
this.label14.Text = "设定温度:";
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.AutoSize = true;
|
||||
this.label15.Location = new System.Drawing.Point(215, 42);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(98, 18);
|
||||
this.label15.TabIndex = 2;
|
||||
this.label15.Text = "调节温度:";
|
||||
//
|
||||
// label16
|
||||
//
|
||||
this.label16.AutoSize = true;
|
||||
this.label16.Location = new System.Drawing.Point(116, 43);
|
||||
this.label16.Name = "label16";
|
||||
this.label16.Size = new System.Drawing.Size(17, 18);
|
||||
this.label16.TabIndex = 1;
|
||||
this.label16.Text = "0";
|
||||
//
|
||||
// label17
|
||||
//
|
||||
this.label17.AutoSize = true;
|
||||
this.label17.Location = new System.Drawing.Point(26, 42);
|
||||
this.label17.Name = "label17";
|
||||
this.label17.Size = new System.Drawing.Size(98, 18);
|
||||
this.label17.TabIndex = 0;
|
||||
this.label17.Text = "实际温度:";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.textBox7);
|
||||
this.groupBox1.Controls.Add(this.label24);
|
||||
this.groupBox1.Controls.Add(this.label8);
|
||||
this.groupBox1.Controls.Add(this.button6);
|
||||
this.groupBox1.Controls.Add(this.button7);
|
||||
this.groupBox1.Controls.Add(this.textBox3);
|
||||
this.groupBox1.Controls.Add(this.label9);
|
||||
this.groupBox1.Controls.Add(this.label10);
|
||||
this.groupBox1.Controls.Add(this.label11);
|
||||
this.groupBox1.Controls.Add(this.label12);
|
||||
this.groupBox1.Location = new System.Drawing.Point(61, 360);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(1094, 100);
|
||||
this.groupBox1.TabIndex = 7;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "点位2";
|
||||
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter_1);
|
||||
//
|
||||
// textBox7
|
||||
//
|
||||
this.textBox7.Location = new System.Drawing.Point(730, 39);
|
||||
this.textBox7.Name = "textBox7";
|
||||
this.textBox7.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox7.TabIndex = 13;
|
||||
//
|
||||
// label24
|
||||
//
|
||||
this.label24.AutoSize = true;
|
||||
this.label24.Location = new System.Drawing.Point(642, 43);
|
||||
this.label24.Name = "label24";
|
||||
this.label24.Size = new System.Drawing.Size(98, 18);
|
||||
this.label24.TabIndex = 13;
|
||||
this.label24.Text = "温度限速:";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(540, 44);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(17, 18);
|
||||
this.label8.TabIndex = 9;
|
||||
this.label8.Text = "0";
|
||||
//
|
||||
// button6
|
||||
//
|
||||
this.button6.Location = new System.Drawing.Point(980, 33);
|
||||
this.button6.Name = "button6";
|
||||
this.button6.Size = new System.Drawing.Size(97, 40);
|
||||
this.button6.TabIndex = 8;
|
||||
this.button6.Text = "保存";
|
||||
this.button6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button7
|
||||
//
|
||||
this.button7.Location = new System.Drawing.Point(866, 33);
|
||||
this.button7.Name = "button7";
|
||||
this.button7.Size = new System.Drawing.Size(92, 40);
|
||||
this.button7.TabIndex = 7;
|
||||
this.button7.Text = "开始升温";
|
||||
this.button7.UseVisualStyleBackColor = true;
|
||||
this.button7.Click += new System.EventHandler(this.button7_Click);
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(309, 38);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox3.TabIndex = 8;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(449, 43);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(98, 18);
|
||||
this.label9.TabIndex = 7;
|
||||
this.label9.Text = "设定温度:";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(215, 42);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(98, 18);
|
||||
this.label10.TabIndex = 2;
|
||||
this.label10.Text = "调节温度:";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(116, 43);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(17, 18);
|
||||
this.label11.TabIndex = 1;
|
||||
this.label11.Text = "0";
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(26, 42);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(98, 18);
|
||||
this.label12.TabIndex = 0;
|
||||
this.label12.Text = "实际温度:";
|
||||
//
|
||||
// grb_pos1
|
||||
//
|
||||
this.grb_pos1.Controls.Add(this.textBox6);
|
||||
this.grb_pos1.Controls.Add(this.label23);
|
||||
this.grb_pos1.Controls.Add(this.label7);
|
||||
this.grb_pos1.Controls.Add(this.button5);
|
||||
this.grb_pos1.Controls.Add(this.button4);
|
||||
this.grb_pos1.Controls.Add(this.textBox2);
|
||||
this.grb_pos1.Controls.Add(this.label6);
|
||||
this.grb_pos1.Controls.Add(this.label5);
|
||||
this.grb_pos1.Controls.Add(this.label4);
|
||||
this.grb_pos1.Controls.Add(this.label3);
|
||||
this.grb_pos1.Location = new System.Drawing.Point(61, 227);
|
||||
this.grb_pos1.Name = "grb_pos1";
|
||||
this.grb_pos1.Size = new System.Drawing.Size(1094, 100);
|
||||
this.grb_pos1.TabIndex = 6;
|
||||
this.grb_pos1.TabStop = false;
|
||||
this.grb_pos1.Text = "点位1";
|
||||
this.grb_pos1.Enter += new System.EventHandler(this.groupBox1_Enter);
|
||||
//
|
||||
// textBox6
|
||||
//
|
||||
this.textBox6.Location = new System.Drawing.Point(730, 39);
|
||||
this.textBox6.Name = "textBox6";
|
||||
this.textBox6.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox6.TabIndex = 12;
|
||||
//
|
||||
// label23
|
||||
//
|
||||
this.label23.AutoSize = true;
|
||||
this.label23.Location = new System.Drawing.Point(642, 43);
|
||||
this.label23.Name = "label23";
|
||||
this.label23.Size = new System.Drawing.Size(98, 18);
|
||||
this.label23.TabIndex = 12;
|
||||
this.label23.Text = "温度限速:";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(540, 43);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(17, 18);
|
||||
this.label7.TabIndex = 9;
|
||||
this.label7.Text = "0";
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Location = new System.Drawing.Point(980, 32);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(97, 40);
|
||||
this.button5.TabIndex = 8;
|
||||
this.button5.Text = "保存";
|
||||
this.button5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(866, 32);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(92, 40);
|
||||
this.button4.TabIndex = 7;
|
||||
this.button4.Text = "开始升温";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click_1);
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(309, 39);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox2.TabIndex = 8;
|
||||
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(449, 42);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(98, 18);
|
||||
this.label6.TabIndex = 7;
|
||||
this.label6.Text = "设定温度:";
|
||||
this.label6.Click += new System.EventHandler(this.label6_Click);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(215, 43);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(98, 18);
|
||||
this.label5.TabIndex = 2;
|
||||
this.label5.Text = "调节温度:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(116, 43);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(17, 18);
|
||||
this.label4.TabIndex = 1;
|
||||
this.label4.Text = "0";
|
||||
this.label4.Click += new System.EventHandler(this.label4_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(26, 42);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(98, 18);
|
||||
this.label3.TabIndex = 0;
|
||||
this.label3.Text = "实际温度:";
|
||||
//
|
||||
// grb_temport
|
||||
//
|
||||
this.grb_temport.Controls.Add(this.comboBox1);
|
||||
@@ -1336,359 +1774,6 @@
|
||||
this.rit_Coord.Text = "";
|
||||
this.rit_Coord.TextChanged += new System.EventHandler(this.rit_Coord_TextChanged);
|
||||
//
|
||||
// grb_pos1
|
||||
//
|
||||
this.grb_pos1.Controls.Add(this.label7);
|
||||
this.grb_pos1.Controls.Add(this.button5);
|
||||
this.grb_pos1.Controls.Add(this.button4);
|
||||
this.grb_pos1.Controls.Add(this.textBox2);
|
||||
this.grb_pos1.Controls.Add(this.label6);
|
||||
this.grb_pos1.Controls.Add(this.label5);
|
||||
this.grb_pos1.Controls.Add(this.label4);
|
||||
this.grb_pos1.Controls.Add(this.label3);
|
||||
this.grb_pos1.Location = new System.Drawing.Point(61, 227);
|
||||
this.grb_pos1.Name = "grb_pos1";
|
||||
this.grb_pos1.Size = new System.Drawing.Size(1055, 100);
|
||||
this.grb_pos1.TabIndex = 6;
|
||||
this.grb_pos1.TabStop = false;
|
||||
this.grb_pos1.Text = "点位1";
|
||||
this.grb_pos1.Enter += new System.EventHandler(this.groupBox1_Enter);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(26, 42);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(98, 18);
|
||||
this.label3.TabIndex = 0;
|
||||
this.label3.Text = "实际温度:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(116, 43);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(17, 18);
|
||||
this.label4.TabIndex = 1;
|
||||
this.label4.Text = "0";
|
||||
this.label4.Click += new System.EventHandler(this.label4_Click);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(227, 42);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(98, 18);
|
||||
this.label5.TabIndex = 2;
|
||||
this.label5.Text = "调节温度:";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(458, 42);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(98, 18);
|
||||
this.label6.TabIndex = 7;
|
||||
this.label6.Text = "设定温度:";
|
||||
this.label6.Click += new System.EventHandler(this.label6_Click);
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(321, 38);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox2.TabIndex = 8;
|
||||
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(901, 31);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(113, 40);
|
||||
this.button4.TabIndex = 7;
|
||||
this.button4.Text = "开始升温";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Location = new System.Drawing.Point(761, 31);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(113, 40);
|
||||
this.button5.TabIndex = 8;
|
||||
this.button5.Text = "保存";
|
||||
this.button5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(549, 43);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(17, 18);
|
||||
this.label7.TabIndex = 9;
|
||||
this.label7.Text = "0";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.label8);
|
||||
this.groupBox1.Controls.Add(this.button6);
|
||||
this.groupBox1.Controls.Add(this.button7);
|
||||
this.groupBox1.Controls.Add(this.textBox3);
|
||||
this.groupBox1.Controls.Add(this.label9);
|
||||
this.groupBox1.Controls.Add(this.label10);
|
||||
this.groupBox1.Controls.Add(this.label11);
|
||||
this.groupBox1.Controls.Add(this.label12);
|
||||
this.groupBox1.Location = new System.Drawing.Point(61, 360);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(1055, 100);
|
||||
this.groupBox1.TabIndex = 7;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "点位2";
|
||||
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter_1);
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(549, 43);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(17, 18);
|
||||
this.label8.TabIndex = 9;
|
||||
this.label8.Text = "0";
|
||||
//
|
||||
// button6
|
||||
//
|
||||
this.button6.Location = new System.Drawing.Point(761, 31);
|
||||
this.button6.Name = "button6";
|
||||
this.button6.Size = new System.Drawing.Size(113, 40);
|
||||
this.button6.TabIndex = 8;
|
||||
this.button6.Text = "保存";
|
||||
this.button6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button7
|
||||
//
|
||||
this.button7.Location = new System.Drawing.Point(901, 31);
|
||||
this.button7.Name = "button7";
|
||||
this.button7.Size = new System.Drawing.Size(113, 40);
|
||||
this.button7.TabIndex = 7;
|
||||
this.button7.Text = "开始升温";
|
||||
this.button7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Location = new System.Drawing.Point(321, 38);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox3.TabIndex = 8;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(458, 42);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(98, 18);
|
||||
this.label9.TabIndex = 7;
|
||||
this.label9.Text = "设定温度:";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(227, 42);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(98, 18);
|
||||
this.label10.TabIndex = 2;
|
||||
this.label10.Text = "调节温度:";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(116, 43);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(17, 18);
|
||||
this.label11.TabIndex = 1;
|
||||
this.label11.Text = "0";
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(26, 42);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(98, 18);
|
||||
this.label12.TabIndex = 0;
|
||||
this.label12.Text = "实际温度:";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.label13);
|
||||
this.groupBox2.Controls.Add(this.button8);
|
||||
this.groupBox2.Controls.Add(this.button9);
|
||||
this.groupBox2.Controls.Add(this.textBox4);
|
||||
this.groupBox2.Controls.Add(this.label14);
|
||||
this.groupBox2.Controls.Add(this.label15);
|
||||
this.groupBox2.Controls.Add(this.label16);
|
||||
this.groupBox2.Controls.Add(this.label17);
|
||||
this.groupBox2.Location = new System.Drawing.Point(61, 488);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(1055, 100);
|
||||
this.groupBox2.TabIndex = 10;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "点位3";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(549, 43);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(17, 18);
|
||||
this.label13.TabIndex = 9;
|
||||
this.label13.Text = "0";
|
||||
//
|
||||
// button8
|
||||
//
|
||||
this.button8.Location = new System.Drawing.Point(761, 31);
|
||||
this.button8.Name = "button8";
|
||||
this.button8.Size = new System.Drawing.Size(113, 40);
|
||||
this.button8.TabIndex = 8;
|
||||
this.button8.Text = "保存";
|
||||
this.button8.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button9
|
||||
//
|
||||
this.button9.Location = new System.Drawing.Point(901, 31);
|
||||
this.button9.Name = "button9";
|
||||
this.button9.Size = new System.Drawing.Size(113, 40);
|
||||
this.button9.TabIndex = 7;
|
||||
this.button9.Text = "开始升温";
|
||||
this.button9.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.Location = new System.Drawing.Point(321, 38);
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox4.TabIndex = 8;
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(458, 42);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(98, 18);
|
||||
this.label14.TabIndex = 7;
|
||||
this.label14.Text = "设定温度:";
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.AutoSize = true;
|
||||
this.label15.Location = new System.Drawing.Point(227, 42);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(98, 18);
|
||||
this.label15.TabIndex = 2;
|
||||
this.label15.Text = "调节温度:";
|
||||
//
|
||||
// label16
|
||||
//
|
||||
this.label16.AutoSize = true;
|
||||
this.label16.Location = new System.Drawing.Point(116, 43);
|
||||
this.label16.Name = "label16";
|
||||
this.label16.Size = new System.Drawing.Size(17, 18);
|
||||
this.label16.TabIndex = 1;
|
||||
this.label16.Text = "0";
|
||||
//
|
||||
// label17
|
||||
//
|
||||
this.label17.AutoSize = true;
|
||||
this.label17.Location = new System.Drawing.Point(26, 42);
|
||||
this.label17.Name = "label17";
|
||||
this.label17.Size = new System.Drawing.Size(98, 18);
|
||||
this.label17.TabIndex = 0;
|
||||
this.label17.Text = "实际温度:";
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.label18);
|
||||
this.groupBox3.Controls.Add(this.button10);
|
||||
this.groupBox3.Controls.Add(this.button11);
|
||||
this.groupBox3.Controls.Add(this.textBox5);
|
||||
this.groupBox3.Controls.Add(this.label19);
|
||||
this.groupBox3.Controls.Add(this.label20);
|
||||
this.groupBox3.Controls.Add(this.label21);
|
||||
this.groupBox3.Controls.Add(this.label22);
|
||||
this.groupBox3.Location = new System.Drawing.Point(61, 615);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(1055, 100);
|
||||
this.groupBox3.TabIndex = 11;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "点位4";
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Location = new System.Drawing.Point(549, 43);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(17, 18);
|
||||
this.label18.TabIndex = 9;
|
||||
this.label18.Text = "0";
|
||||
//
|
||||
// button10
|
||||
//
|
||||
this.button10.Location = new System.Drawing.Point(761, 31);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(113, 40);
|
||||
this.button10.TabIndex = 8;
|
||||
this.button10.Text = "保存";
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button11
|
||||
//
|
||||
this.button11.Location = new System.Drawing.Point(901, 31);
|
||||
this.button11.Name = "button11";
|
||||
this.button11.Size = new System.Drawing.Size(113, 40);
|
||||
this.button11.TabIndex = 7;
|
||||
this.button11.Text = "开始升温";
|
||||
this.button11.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox5
|
||||
//
|
||||
this.textBox5.Location = new System.Drawing.Point(321, 38);
|
||||
this.textBox5.Name = "textBox5";
|
||||
this.textBox5.Size = new System.Drawing.Size(100, 28);
|
||||
this.textBox5.TabIndex = 8;
|
||||
//
|
||||
// label19
|
||||
//
|
||||
this.label19.AutoSize = true;
|
||||
this.label19.Location = new System.Drawing.Point(458, 42);
|
||||
this.label19.Name = "label19";
|
||||
this.label19.Size = new System.Drawing.Size(98, 18);
|
||||
this.label19.TabIndex = 7;
|
||||
this.label19.Text = "设定温度:";
|
||||
//
|
||||
// label20
|
||||
//
|
||||
this.label20.AutoSize = true;
|
||||
this.label20.Location = new System.Drawing.Point(227, 42);
|
||||
this.label20.Name = "label20";
|
||||
this.label20.Size = new System.Drawing.Size(98, 18);
|
||||
this.label20.TabIndex = 2;
|
||||
this.label20.Text = "调节温度:";
|
||||
//
|
||||
// label21
|
||||
//
|
||||
this.label21.AutoSize = true;
|
||||
this.label21.Location = new System.Drawing.Point(116, 43);
|
||||
this.label21.Name = "label21";
|
||||
this.label21.Size = new System.Drawing.Size(17, 18);
|
||||
this.label21.TabIndex = 1;
|
||||
this.label21.Text = "0";
|
||||
//
|
||||
// label22
|
||||
//
|
||||
this.label22.AutoSize = true;
|
||||
this.label22.Location = new System.Drawing.Point(26, 42);
|
||||
this.label22.Name = "label22";
|
||||
this.label22.Size = new System.Drawing.Size(98, 18);
|
||||
this.label22.TabIndex = 0;
|
||||
this.label22.Text = "实际温度:";
|
||||
//
|
||||
// ShowForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
|
||||
@@ -1732,17 +1817,17 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cam_feed)).EndInit();
|
||||
this.tap_tempCtrl.ResumeLayout(false);
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.grb_pos1.ResumeLayout(false);
|
||||
this.grb_pos1.PerformLayout();
|
||||
this.grb_temport.ResumeLayout(false);
|
||||
this.grb_temport.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.grb_pos1.ResumeLayout(false);
|
||||
this.grb_pos1.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -1885,6 +1970,14 @@
|
||||
private System.Windows.Forms.Label label15;
|
||||
private System.Windows.Forms.Label label16;
|
||||
private System.Windows.Forms.Label label17;
|
||||
private System.Windows.Forms.Label label26;
|
||||
private System.Windows.Forms.Label label25;
|
||||
private System.Windows.Forms.Label label24;
|
||||
private System.Windows.Forms.TextBox textBox6;
|
||||
private System.Windows.Forms.Label label23;
|
||||
private System.Windows.Forms.TextBox textBox9;
|
||||
private System.Windows.Forms.TextBox textBox8;
|
||||
private System.Windows.Forms.TextBox textBox7;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ namespace HitBotCSharpDemo
|
||||
|
||||
private CameraManager cameraManager;
|
||||
private tempControl tempControl;
|
||||
|
||||
private ControlBeanEx robot;
|
||||
public ShowForm()
|
||||
{
|
||||
@@ -210,10 +209,79 @@ namespace HitBotCSharpDemo
|
||||
cameraManager.Initialize();
|
||||
|
||||
Label[] temperatureLabels = new Label[] { label4, label11, label16, label21 };
|
||||
tempControl = new tempControl(temperatureLabels);
|
||||
Label[] setting_temperatureLabels = new Label[] { label7, label8, label13, label18 };
|
||||
|
||||
tempControl = new tempControl(temperatureLabels, setting_temperatureLabels);
|
||||
tempControl.LoadAvailablePorts(comboBox1);
|
||||
|
||||
textBox6.Click += TextBox_Click;
|
||||
textBox7.Click += TextBox_Click;
|
||||
textBox8.Click += TextBox_Click;
|
||||
textBox9.Click += TextBox_Click;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void TextBox_Click(object sender, EventArgs e)
|
||||
{
|
||||
TextBox textBox = sender as TextBox;
|
||||
if (textBox == null) return;
|
||||
// 检查串口是否打开
|
||||
if (tempControl == null || !tempControl.IsSerialPortOpen())
|
||||
{
|
||||
MessageBox.Show("串口未打开,无法设置参数");
|
||||
return;
|
||||
}
|
||||
// 根据控件名称确定下位机编号和显示名称
|
||||
int deviceNumber = -1;
|
||||
string parameterName = "";
|
||||
switch (textBox.Name)
|
||||
{
|
||||
case "textBox6":
|
||||
deviceNumber = 0;
|
||||
parameterName = "下位机1 RAMPSPEED";
|
||||
break;
|
||||
case "textBox7":
|
||||
deviceNumber = 1;
|
||||
parameterName = "下位机2 RAMPSPEED";
|
||||
break;
|
||||
case "textBox8":
|
||||
deviceNumber = 2;
|
||||
parameterName = "下位机3 RAMPSPEED";
|
||||
break;
|
||||
case "textBox9":
|
||||
deviceNumber = 3;
|
||||
parameterName = "下位机4 RAMPSPEED";
|
||||
break;
|
||||
}
|
||||
if (deviceNumber >= 0)
|
||||
{
|
||||
// 创建并显示输入窗口
|
||||
ParameterInputForm inputForm = new ParameterInputForm(parameterName, textBox.Text);
|
||||
if (inputForm.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
// 用户点击了保存按钮
|
||||
string newValue = inputForm.InputValue;
|
||||
|
||||
// 检查输入是否为有效数字
|
||||
if (double.TryParse(newValue, out double inputValue))
|
||||
{
|
||||
// 更新textbox显示
|
||||
textBox.Text = newValue;
|
||||
|
||||
// 构建并发送命令
|
||||
string command = $"TC1:TCRAMPSPEED={inputValue}@{deviceNumber}\r";
|
||||
tempControl.SendCommand(command);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请输入有效的数字", "输入错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
inputForm.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void cob_Robot_ID_Click(object sender, EventArgs e)
|
||||
{
|
||||
cob_Robot_ID.Items.Clear();
|
||||
@@ -1339,5 +1407,29 @@ namespace HitBotCSharpDemo
|
||||
|
||||
}
|
||||
|
||||
private void button4_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button9_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button11_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void label26_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -204,3 +204,185 @@
|
||||
2025-06-17 16:15:05.190 trail_number1.443221
|
||||
2025-06-17 16:15:05.190 tcp_distance 144.322098
|
||||
2025-06-17 16:15:05.190 angle1_1 = -44.911705 angle2_1 = 98.661697 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -11.002804 angle2_2 = 84.112190 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-17 19:20:28.265 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-17 19:20:28.266 robot connected
|
||||
2025-06-17 19:20:28.266 26
|
||||
2025-06-17 19:20:28.268 current generation=26
|
||||
2025-06-17 19:20:28.784 0x1a
|
||||
2025-06-17 19:20:29.673 initial joint2 2449950
|
||||
2025-06-17 19:20:29.674 C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\\j4_pid.txt do not exist
|
||||
2025-06-17 19:20:29.674 robot WritePID
|
||||
2025-06-17 19:20:29.982 initial joint1 -160236
|
||||
2025-06-17 19:20:30.028 initial joint2 2449948
|
||||
2025-06-17 19:20:30.074 initial joint3 -219816
|
||||
2025-06-17 19:20:30.136 initial joint4 -25369363
|
||||
2025-06-17 19:20:30.152 initial joint1 -160236
|
||||
2025-06-17 19:20:30.198 initial joint2 2449949
|
||||
2025-06-17 19:20:30.244 initial joint3 -219816
|
||||
2025-06-17 19:20:30.291 initial joint4 -25369363
|
||||
2025-06-17 19:20:30.306 initial joint1 -160230
|
||||
2025-06-17 19:20:30.352 initial joint2 2449950
|
||||
2025-06-17 19:20:30.398 initial joint3 -219818
|
||||
2025-06-17 19:20:30.444 initial joint4 -25369364
|
||||
2025-06-17 19:20:32.668 initial_thread initialized
|
||||
2025-06-17 19:20:32.668 servo enable
|
||||
2025-06-17 19:20:32.668 brake open
|
||||
2025-06-17 19:20:32.669 set_brake_state 0 1
|
||||
2025-06-17 19:20:32.870 robot initialized
|
||||
2025-06-17 19:20:33.454 get_scara_param -11.002300 84.112396 -75.469200 -1005.720520
|
||||
2025-06-17 19:20:33.454 get_scara_real_coor -11.002100 84.112396 -75.468803 -1005.720398
|
||||
2025-06-17 19:20:33.454 <09><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2><EFBFBD><EFBFBD>
|
||||
2025-06-17 19:20:33.455 position -160232.609375 2449951.000000 -219819.984375 -25369366.000000 -1124228.875000 4073196.000000 -61915.968750 -24985686.000000
|
||||
2025-06-17 19:20:33.455 speed 66192.367188 55729.695313 54212.039063 15807.129883
|
||||
2025-06-17 19:20:33.455 set_first_position_after_initial
|
||||
2025-06-17 19:20:33.456 movej_old start_pos: -11.002300 84.112396 -75.469200 -1005.720520 end_pos: -11.002300 84.112297 -75.469200 -1005.720520 org_sp 10.000000 end_sp 0.729016
|
||||
2025-06-17 19:20:33.744 J3 Belt Meilage=40.923592km
|
||||
2025-06-17 19:20:35.251 30 30 30 30
|
||||
2025-06-17 19:20:35.253 new_movej_xyz_lr 274.065002 -292.061096 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-17 19:20:35.253 goal_angle -63.500324 35.083988
|
||||
2025-06-17 19:20:35.253 new_movej_angle -63.500324 35.083988 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-17 19:20:35.253 z1 -75.469200 z2 -75.466103
|
||||
2025-06-17 19:20:35.253 angle1_1 -11.002300 angle2_1 84.112297 z1 -75.469200 r1 -1005.720520
|
||||
2025-06-17 19:20:35.254 angle1_2 -63.500324 angle2_2 35.083988 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-17 19:20:35.254 speed 100.000000
|
||||
2025-06-17 19:20:35.254 tcp_distance 482.202667
|
||||
2025-06-17 19:20:35.255 new_end_speed 100.000000 j1_acc_t 2.411013 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 23.815603
|
||||
2025-06-17 19:20:35.255 new_end_speed 100.000000 j2_acc_t 2.411013 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 22.241575
|
||||
2025-06-17 19:20:35.255 new_end_speed 100.000000 j3_acc_t 2.411013 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 0.001405
|
||||
2025-06-17 19:20:35.256 new_end_speed 100.000000 j4_acc_t 2.411013 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 0.000222
|
||||
2025-06-17 19:20:35.256 end_speed 100.000000
|
||||
2025-06-17 19:20:35.256 trail_number4.822027
|
||||
2025-06-17 19:20:35.256 tcp_distance 482.202667
|
||||
2025-06-17 19:20:35.256 angle1_1 = -11.002300 angle2_1 = 84.112297 z1 = -75.469200 r1 = -1005.720520 angle1_2 = -63.500324 angle2_2 = 35.083988 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-17 19:20:40.259 30 30 30 30
|
||||
2025-06-17 19:20:40.261 new_movej_xyz_lr 274.065002 5.965300 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-17 19:20:40.261 goal_angle -44.911705 98.661697
|
||||
2025-06-17 19:20:40.261 new_movej_angle -44.911705 98.661697 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-17 19:20:40.261 z1 -75.466103 z2 -75.466103
|
||||
2025-06-17 19:20:40.261 angle1_1 -63.500324 angle2_1 35.083988 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-17 19:20:40.261 angle1_2 -44.911705 angle2_2 98.661697 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-17 19:20:40.262 speed 100.000000
|
||||
2025-06-17 19:20:40.262 tcp_distance 318.237030
|
||||
2025-06-17 19:20:40.262 new_end_speed 100.000000 j1_acc_t 1.591185 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 12.777455
|
||||
2025-06-17 19:20:40.262 new_end_speed 100.000000 j2_acc_t 1.591185 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 43.702080
|
||||
2025-06-17 19:20:40.262 new_end_speed 100.000000 j3_acc_t 1.591185 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 0.000000
|
||||
2025-06-17 19:20:40.262 new_end_speed 100.000000 j4_acc_t 1.591185 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 0.000000
|
||||
2025-06-17 19:20:40.263 end_speed 100.000000
|
||||
2025-06-17 19:20:40.263 trail_number3.182370
|
||||
2025-06-17 19:20:40.263 tcp_distance 318.237030
|
||||
2025-06-17 19:20:40.264 angle1_1 = -63.500324 angle2_1 = 35.083988 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -44.911705 angle2_2 = 98.661697 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-17 19:20:44.988 30 30 30 30
|
||||
2025-06-17 19:20:44.989 new_movej_xyz_lr 274.065002 149.383698 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-17 19:20:44.989 goal_angle -11.002804 84.112190
|
||||
2025-06-17 19:20:44.989 new_movej_angle -11.002804 84.112190 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-17 19:20:44.989 z1 -75.466103 z2 -75.466103
|
||||
2025-06-17 19:20:44.990 angle1_1 -44.911705 angle2_1 98.661697 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-17 19:20:44.990 angle1_2 -11.002804 angle2_2 84.112190 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-17 19:20:44.990 speed 100.000000
|
||||
2025-06-17 19:20:44.990 tcp_distance 144.322098
|
||||
2025-06-17 19:20:44.990 new_end_speed 100.000000 j1_acc_t 0.721610 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 51.395920
|
||||
2025-06-17 19:20:44.990 new_end_speed 100.000000 j2_acc_t 0.721610 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 22.052773
|
||||
2025-06-17 19:20:44.991 new_end_speed 100.000000 j3_acc_t 0.721610 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 0.000000
|
||||
2025-06-17 19:20:44.991 new_end_speed 100.000000 j4_acc_t 0.721610 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 0.000000
|
||||
2025-06-17 19:20:44.991 end_speed 100.000000
|
||||
2025-06-17 19:20:44.991 trail_number1.443221
|
||||
2025-06-17 19:20:44.991 tcp_distance 144.322098
|
||||
2025-06-17 19:20:44.992 angle1_1 = -44.911705 angle2_1 = 98.661697 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -11.002804 angle2_2 = 84.112190 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-17 19:20:47.596 30 30 30 30
|
||||
2025-06-17 19:20:47.596 new_movej_xyz_lr 93.989304 -37.882999 -4.457100 -1027.920044 100.000000 0.000000 1
|
||||
2025-06-17 19:20:47.598 goal_angle -87.199585 152.604431
|
||||
2025-06-17 19:20:47.598 new_movej_angle -87.199585 152.604431 -4.457100 -1027.920044 0.000000 100.000000
|
||||
2025-06-17 19:20:47.598 z1 -75.466103 z2 -4.457100
|
||||
2025-06-17 19:20:47.598 angle1_1 -11.002804 angle2_1 84.112190 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-17 19:20:47.598 angle1_2 -87.199585 angle2_2 152.604431 z2 -4.457100 r2 -1027.920044
|
||||
2025-06-17 19:20:47.599 speed 100.000000
|
||||
2025-06-17 19:20:47.599 tcp_distance 288.737366
|
||||
2025-06-17 19:20:47.599 new_end_speed 100.000000 j1_acc_t 1.443687 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 57.727364
|
||||
2025-06-17 19:20:47.599 new_end_speed 100.000000 j2_acc_t 1.443687 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 51.890335
|
||||
2025-06-17 19:20:47.599 new_end_speed 100.000000 j3_acc_t 1.443687 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 53.797054
|
||||
2025-06-17 19:20:47.599 new_end_speed 100.000000 j4_acc_t 1.443687 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 16.818187
|
||||
2025-06-17 19:20:47.600 end_speed 100.000000
|
||||
2025-06-17 19:20:47.600 trail_number2.887374
|
||||
2025-06-17 19:20:47.600 tcp_distance 288.737366
|
||||
2025-06-17 19:20:47.601 angle1_1 = -11.002804 angle2_1 = 84.112190 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -87.199585 angle2_2 = 152.604431 z2 = -4.457100 r2 = -1027.920044
|
||||
2025-06-17 20:42:24.041 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-17 20:42:24.042 robot connected
|
||||
2025-06-17 20:42:24.042 26
|
||||
2025-06-17 20:42:24.042 current generation=26
|
||||
2025-06-17 20:42:24.556 0x1a
|
||||
2025-06-17 20:42:25.419 initial joint2 4444930
|
||||
2025-06-17 20:42:25.420 C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\\j4_pid.txt do not exist
|
||||
2025-06-17 20:42:25.420 robot WritePID
|
||||
2025-06-17 20:42:25.728 initial joint1 -1269936
|
||||
2025-06-17 20:42:25.790 initial joint2 4444931
|
||||
2025-06-17 20:42:25.836 initial joint3 -12992
|
||||
2025-06-17 20:42:25.881 initial joint4 -25056188
|
||||
2025-06-17 20:42:25.896 initial joint1 -1269936
|
||||
2025-06-17 20:42:25.942 initial joint2 4444931
|
||||
2025-06-17 20:42:25.988 initial joint3 -12992
|
||||
2025-06-17 20:42:26.048 initial joint4 -25056189
|
||||
2025-06-17 20:42:26.078 initial joint1 -1269936
|
||||
2025-06-17 20:42:26.123 initial joint2 4444934
|
||||
2025-06-17 20:42:26.169 initial joint3 -12992
|
||||
2025-06-17 20:42:26.215 initial joint4 -25056190
|
||||
2025-06-17 20:42:28.535 initial_thread initialized
|
||||
2025-06-17 20:42:28.535 servo enable
|
||||
2025-06-17 20:42:28.536 brake open
|
||||
2025-06-17 20:42:28.536 set_brake_state 0 1
|
||||
2025-06-17 20:42:28.750 robot initialized
|
||||
2025-06-17 20:42:29.320 get_scara_param -87.199501 152.604797 -4.460400 -1027.920044
|
||||
2025-06-17 20:42:29.321 get_scara_real_coor -87.199501 152.604797 -4.460400 -1027.920044
|
||||
2025-06-17 20:42:29.321 set_first_position_after_initial
|
||||
2025-06-17 20:42:29.322 movej_old start_pos: -87.199501 152.604797 -4.460400 -1027.920044 end_pos: -87.199501 152.604797 -4.460400 -1027.920044 org_sp 10.000000 end_sp 10.000000
|
||||
2025-06-17 20:42:29.612 J3 Belt Meilage=40.924110km
|
||||
2025-06-17 20:42:31.857 30 30 30 30
|
||||
2025-06-17 20:42:31.858 new_movej_xyz_lr 274.065002 5.965300 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-17 20:42:31.858 goal_angle -44.911705 98.661697
|
||||
2025-06-17 20:42:31.859 new_movej_angle -44.911705 98.661697 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-17 20:42:31.860 z1 -4.460400 z2 -75.466103
|
||||
2025-06-17 20:42:31.860 angle1_1 -87.199501 angle2_1 152.604797 z1 -4.460400 r1 -1027.920044
|
||||
2025-06-17 20:42:31.860 angle1_2 -44.911705 angle2_2 98.661697 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-17 20:42:31.860 speed 100.000000
|
||||
2025-06-17 20:42:31.860 tcp_distance 200.024323
|
||||
2025-06-17 20:42:31.861 new_end_speed 100.000000 j1_acc_t 1.000122 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 46.246613
|
||||
2025-06-17 20:42:31.861 new_end_speed 100.000000 j2_acc_t 1.000122 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 58.993038
|
||||
2025-06-17 20:42:31.863 new_end_speed 100.000000 j3_acc_t 1.000122 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 77.652977
|
||||
2025-06-17 20:42:31.863 new_end_speed 100.000000 j4_acc_t 1.000122 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 24.277243
|
||||
2025-06-17 20:42:31.863 end_speed 100.000000
|
||||
2025-06-17 20:42:31.863 trail_number2.000243
|
||||
2025-06-17 20:42:31.863 tcp_distance 200.024323
|
||||
2025-06-17 20:42:31.864 angle1_1 = -87.199501 angle2_1 = 152.604797 z1 = -4.460400 r1 = -1027.920044 angle1_2 = -44.911705 angle2_2 = 98.661697 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-17 20:42:35.087 30 30 30 30
|
||||
2025-06-17 20:42:35.087 new_movej_xyz_lr 274.065002 149.383698 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-17 20:42:35.088 goal_angle -11.002804 84.112190
|
||||
2025-06-17 20:42:35.088 new_movej_angle -11.002804 84.112190 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-17 20:42:35.088 z1 -75.466103 z2 -75.466103
|
||||
2025-06-17 20:42:35.089 angle1_1 -44.911705 angle2_1 98.661697 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-17 20:42:35.089 angle1_2 -11.002804 angle2_2 84.112190 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-17 20:42:35.089 speed 100.000000
|
||||
2025-06-17 20:42:35.089 tcp_distance 144.322098
|
||||
2025-06-17 20:42:35.089 new_end_speed 100.000000 j1_acc_t 0.721610 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 51.395920
|
||||
2025-06-17 20:42:35.090 new_end_speed 100.000000 j2_acc_t 0.721610 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 22.052773
|
||||
2025-06-17 20:42:35.090 new_end_speed 100.000000 j3_acc_t 0.721610 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 0.000000
|
||||
2025-06-17 20:42:35.090 new_end_speed 100.000000 j4_acc_t 0.721610 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 0.000000
|
||||
2025-06-17 20:42:35.090 end_speed 100.000000
|
||||
2025-06-17 20:42:35.090 trail_number1.443221
|
||||
2025-06-17 20:42:35.091 tcp_distance 144.322098
|
||||
2025-06-17 20:42:35.091 angle1_1 = -44.911705 angle2_1 = 98.661697 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -11.002804 angle2_2 = 84.112190 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-17 20:42:37.761 30 30 30 30
|
||||
2025-06-17 20:42:37.761 new_movej_xyz_lr 93.989304 -37.882999 -4.457100 -1027.920044 100.000000 0.000000 1
|
||||
2025-06-17 20:42:37.761 goal_angle -87.199585 152.604431
|
||||
2025-06-17 20:42:37.761 new_movej_angle -87.199585 152.604431 -4.457100 -1027.920044 0.000000 100.000000
|
||||
2025-06-17 20:42:37.762 z1 -75.466103 z2 -4.457100
|
||||
2025-06-17 20:42:37.762 angle1_1 -11.002804 angle2_1 84.112190 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-17 20:42:37.762 angle1_2 -87.199585 angle2_2 152.604431 z2 -4.457100 r2 -1027.920044
|
||||
2025-06-17 20:42:37.762 speed 100.000000
|
||||
2025-06-17 20:42:37.762 tcp_distance 288.737366
|
||||
2025-06-17 20:42:37.762 new_end_speed 100.000000 j1_acc_t 1.443687 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 57.727364
|
||||
2025-06-17 20:42:37.763 new_end_speed 100.000000 j2_acc_t 1.443687 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 51.890335
|
||||
2025-06-17 20:42:37.763 new_end_speed 100.000000 j3_acc_t 1.443687 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 53.797054
|
||||
2025-06-17 20:42:37.763 new_end_speed 100.000000 j4_acc_t 1.443687 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 16.818187
|
||||
2025-06-17 20:42:37.763 end_speed 100.000000
|
||||
2025-06-17 20:42:37.763 trail_number2.887374
|
||||
2025-06-17 20:42:37.764 tcp_distance 288.737366
|
||||
2025-06-17 20:42:37.764 angle1_1 = -11.002804 angle2_1 = 84.112190 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -87.199585 angle2_2 = 152.604431 z2 = -4.457100 r2 = -1027.920044
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
2025-06-18 10:34:31.782 ROBOT_ERROR_CODE = 1004
|
||||
2025-06-18 10:34:31.782
|
||||
0 : 0 0 0 0 0 0
|
||||
1 : 0 0 0 0 0 0
|
||||
2 : 0 0 0 0 0 0
|
||||
3 : 0 0 0 0 0 0
|
||||
4 : 0 0 0 0 0 0
|
||||
5 : 0 0 0 0 0 0
|
||||
6 : 0 0 0 0 0 0
|
||||
7 : 0 0 0 0 0 0
|
||||
8 : 0 0 0 0 0 0
|
||||
9 : 0 0 0 0 0 0
|
||||
10 : 0 0 0 0 0 0
|
||||
11 : 0 0 0 0 0 0
|
||||
12 : 0 0 0 0 0 0
|
||||
13 : 0 0 0 0 0 0
|
||||
14 : 0 0 0 0 0 0
|
||||
15 : 9999 9999 9999 9999 9999 0
|
||||
2025-06-18 11:15:52.792 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-18 11:15:52.794 robot connected
|
||||
2025-06-18 11:15:52.794 26
|
||||
2025-06-18 11:15:52.794 current generation=26
|
||||
2025-06-18 11:15:53.368 0x1a
|
||||
2025-06-18 11:15:54.234 initial joint2 4435335
|
||||
2025-06-18 11:15:54.234 C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\\j4_pid.txt do not exist
|
||||
2025-06-18 11:15:54.234 robot WritePID
|
||||
2025-06-18 11:15:54.541 initial joint1 -1267505
|
||||
2025-06-18 11:15:54.601 initial joint2 4435335
|
||||
2025-06-18 11:15:54.646 initial joint3 -13307
|
||||
2025-06-18 11:15:54.692 initial joint4 -25058597
|
||||
2025-06-18 11:15:54.707 initial joint1 -1267485
|
||||
2025-06-18 11:15:54.754 initial joint2 4435335
|
||||
2025-06-18 11:15:54.800 initial joint3 -13307
|
||||
2025-06-18 11:15:54.847 initial joint4 -25058598
|
||||
2025-06-18 11:15:54.862 initial joint1 -1267485
|
||||
2025-06-18 11:15:54.908 initial joint2 4435334
|
||||
2025-06-18 11:15:54.954 initial joint3 -13307
|
||||
2025-06-18 11:15:54.999 initial joint4 -25058597
|
||||
2025-06-18 11:15:57.166 initial_thread initialized
|
||||
2025-06-18 11:15:57.167 servo enable
|
||||
2025-06-18 11:15:57.167 brake open
|
||||
2025-06-18 11:15:57.168 set_brake_state 0 1
|
||||
2025-06-18 11:15:57.381 robot initialized
|
||||
2025-06-18 11:15:57.951 get_scara_param -87.030098 152.275101 -4.568500 -1028.047607
|
||||
2025-06-18 11:15:57.951 get_scara_real_coor -87.030197 152.275101 -4.568500 -1028.047607
|
||||
2025-06-18 11:15:57.953 <09><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2><EFBFBD><EFBFBD>
|
||||
2025-06-18 11:15:57.953 position -1267467.625000 4435333.500000 -13306.720703 -25058600.000000 -206213.781250 2532595.750000 -211242.203125 -25356388.000000
|
||||
2025-06-18 11:15:57.953 speed 72870.523438 65325.320313 67955.757813 12268.488281
|
||||
2025-06-18 11:15:57.953 set_first_position_after_initial
|
||||
2025-06-18 11:15:57.954 movej_old start_pos: -87.030098 152.275085 -4.568500 -1028.047607 end_pos: -87.030098 152.275009 -4.568500 -1028.047607 org_sp 10.000000 end_sp 0.558927
|
||||
2025-06-18 11:15:58.244 J3 Belt Meilage=40.924805km
|
||||
@@ -1 +1 @@
|
||||
5c4765cc5751b3038bbbfc77461925fc32c32c7429e0f32c686d1470e388eeb2
|
||||
2e053c921742f81621ab65b09d7f7c29b32f8c9095d4d6c6b15c9b1eb3d7c317
|
||||
|
||||
@@ -137,3 +137,4 @@ C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDe
|
||||
C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\OfficeOpenXml.Extension.AspNetCore.dll
|
||||
C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\EPPlus.xml
|
||||
C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\obj\x64\Debug\CSharpDemo.csproj.SuggestedBindingRedirects.cache
|
||||
C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\obj\x64\Debug\HitBotCSharpDemo.ParameterInputForm.resources
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO.Ports;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HitBotCSharpDemo
|
||||
@@ -12,20 +13,34 @@ namespace HitBotCSharpDemo
|
||||
{
|
||||
private SerialPort serialPort;
|
||||
private System.Windows.Forms.Timer temperatureTimer;
|
||||
private System.Windows.Forms.Timer settingTemperatureTimer;
|
||||
private string[] temperatureCommands = {
|
||||
"TC1:TCACTUALTEMP?@0\r",
|
||||
"TC1:TCACTUALTEMP?@1\r",
|
||||
"TC1:TCACTUALTEMP?@2\r",
|
||||
"TC1:TCACTUALTEMP?@3\r"
|
||||
};
|
||||
private string[] settingtempCommands =
|
||||
{
|
||||
"TC1:TCSETTEMP?@0\r",
|
||||
"TC1:TCSETTEMP?@1\r",
|
||||
"TC1:TCSETTEMP?@2\r",
|
||||
"TC1:TCSETTEMP?@3\r"
|
||||
};
|
||||
private Label[] temperatureLabels;
|
||||
private Label[] settingTemperatureLabels;
|
||||
private int currentCommandIndex = 0;
|
||||
private int currentSettingCommandIndex = 0;
|
||||
|
||||
private string receivedData = "";
|
||||
public tempControl(Label[] labels)
|
||||
|
||||
public tempControl(Label[] labels, Label[] setting_labels)
|
||||
{
|
||||
temperatureLabels = labels;
|
||||
settingTemperatureLabels = setting_labels;
|
||||
InitializeSerialPort();
|
||||
InitializeTemperatureTimer();
|
||||
InitializeSettingTemperatureTimer();
|
||||
}
|
||||
public void LoadAvailablePorts(ComboBox comboBox)
|
||||
{
|
||||
@@ -62,6 +77,7 @@ namespace HitBotCSharpDemo
|
||||
{
|
||||
// 串口已打开,执行关闭操作
|
||||
temperatureTimer.Stop(); // 停止温度查询定时器
|
||||
settingTemperatureTimer.Stop(); // 停止设定温度查询定时器
|
||||
serialPort.Close();
|
||||
UpdateUIStatus(false, button, comboBox);
|
||||
MessageBox.Show("串口已关闭", "提示",
|
||||
@@ -78,6 +94,8 @@ namespace HitBotCSharpDemo
|
||||
}
|
||||
serialPort.Open();
|
||||
temperatureTimer.Start(); // 启动温度查询定时器
|
||||
StartSettingTemperatureTimerWithDelay();// 延迟200ms启动设定温度查询定时器
|
||||
|
||||
UpdateUIStatus(true, button, comboBox);
|
||||
MessageBox.Show($"串口 {serialPort.PortName} 已成功打开", "提示",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
@@ -111,6 +129,7 @@ namespace HitBotCSharpDemo
|
||||
try
|
||||
{
|
||||
temperatureTimer.Stop(); // 停止温度查询定时器
|
||||
settingTemperatureTimer.Stop(); // 停止设定温度查询定时器
|
||||
serialPort.Close();
|
||||
UpdateUIStatus(false, button, comboBox);
|
||||
}
|
||||
@@ -131,7 +150,9 @@ namespace HitBotCSharpDemo
|
||||
try
|
||||
{
|
||||
temperatureTimer?.Stop();
|
||||
settingTemperatureTimer?.Stop(); // 停止设定温度定时器
|
||||
temperatureTimer?.Dispose();
|
||||
settingTemperatureTimer?.Dispose(); // 释放设定温度定时器
|
||||
if (serialPort != null && serialPort.IsOpen)
|
||||
{
|
||||
serialPort.Close();
|
||||
@@ -151,8 +172,7 @@ namespace HitBotCSharpDemo
|
||||
serialPort.DataBits = 8; // 数据位
|
||||
serialPort.StopBits = StopBits.One; // 停止位
|
||||
serialPort.Parity = Parity.None; // 奇偶校验
|
||||
// 可选:添加数据接收事件处理
|
||||
serialPort.DataReceived += SerialPort_DataReceived;
|
||||
serialPort.DataReceived += SerialPort_DataReceived; //添加数据接收事件处理
|
||||
}
|
||||
private void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
@@ -204,6 +224,30 @@ namespace HitBotCSharpDemo
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.StartsWith("TC1:TCSETTEMP="))
|
||||
{
|
||||
string[] parts = data.Split('@');
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
string temperaturePart = parts[0];
|
||||
string addressPart = parts[1];
|
||||
string[] tempParts = temperaturePart.Split('=');
|
||||
if (tempParts.Length == 2)
|
||||
{
|
||||
string temperatureValue = tempParts[1];
|
||||
int address = int.Parse(addressPart);
|
||||
UpdateSettingTemperatureLabel(address, temperatureValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
//else if (data.StartsWith("TC1:TCRAMPSPEED="))
|
||||
//{
|
||||
// ProcessRampSpeedData(data);
|
||||
//}
|
||||
else if (data.StartsWith("CMD:REPLY="))
|
||||
{
|
||||
ProcessCommandReply(data);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -228,12 +272,120 @@ namespace HitBotCSharpDemo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessCommandReply(string data)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 解析格式:CMD:REPLY=1@3
|
||||
string[] parts = data.Split('@');
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
string replyPart = parts[0];
|
||||
string addressPart = parts[1];
|
||||
|
||||
string[] replyParts = replyPart.Split('=');
|
||||
if (replyParts.Length == 2)
|
||||
{
|
||||
int errorCode = int.Parse(replyParts[1]);
|
||||
int address = int.Parse(addressPart);
|
||||
|
||||
// 处理错误码
|
||||
string message = GetErrorMessage(errorCode);
|
||||
|
||||
// 在UI线程中显示消息
|
||||
if (temperatureLabels[0].InvokeRequired)
|
||||
{
|
||||
temperatureLabels[0].Invoke(new Action(() =>
|
||||
{
|
||||
ShowCommandResult(address, errorCode, message);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowCommandResult(address, errorCode, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"解析命令回复时发生错误: {ex.Message}");
|
||||
}
|
||||
}
|
||||
// 获取错误码对应的消息
|
||||
private string GetErrorMessage(int errorCode)
|
||||
{
|
||||
switch (errorCode)
|
||||
{
|
||||
case 0:
|
||||
return "未找到子模块名称或参数名称";
|
||||
case 1:
|
||||
return "设定命令正确执行";
|
||||
case 2:
|
||||
return "未找到参数名称";
|
||||
case 3:
|
||||
return "命令被禁止";
|
||||
case 4:
|
||||
return "参数值超范围";
|
||||
case 5:
|
||||
return "其它或未知错误";
|
||||
case 6:
|
||||
return "命令格式语法错误";
|
||||
case 7:
|
||||
return "通讯命令里有校验错误";
|
||||
case 8:
|
||||
return "保存正确执行";
|
||||
default:
|
||||
return $"未知错误码: {errorCode}";
|
||||
}
|
||||
}
|
||||
private void ShowCommandResult(int address, int errorCode, string message)
|
||||
{
|
||||
if (errorCode == 1)
|
||||
{
|
||||
// 设置成功,显示成功消息
|
||||
MessageBox.Show($"下位机{address + 1}号 RAMPSPEED设置成功", "提示",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 设置失败,显示错误消息
|
||||
MessageBox.Show($"下位机{address + 1}号 RAMPSPEED设置失败\n错误码: {errorCode}\n错误信息: {message}",
|
||||
"错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSettingTemperatureLabel(int address, string temperature)
|
||||
{
|
||||
if (address >= 0 && address < settingTemperatureLabels.Length)
|
||||
{
|
||||
// 使用Invoke确保在UI线程中更新界面
|
||||
if (settingTemperatureLabels[address].InvokeRequired)
|
||||
{
|
||||
settingTemperatureLabels[address].Invoke(new Action(() =>
|
||||
{
|
||||
settingTemperatureLabels[address].Text = $"{temperature}°C";
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
settingTemperatureLabels[address].Text = $"{temperature}°C";
|
||||
}
|
||||
}
|
||||
}
|
||||
private void InitializeTemperatureTimer()
|
||||
{
|
||||
temperatureTimer = new System.Windows.Forms.Timer();
|
||||
temperatureTimer.Interval = 1000; // 1秒间隔
|
||||
temperatureTimer.Interval = 500; // 0.5秒间隔
|
||||
temperatureTimer.Tick += TemperatureTimer_Tick;
|
||||
}
|
||||
private void InitializeSettingTemperatureTimer()
|
||||
{
|
||||
settingTemperatureTimer = new System.Windows.Forms.Timer();
|
||||
settingTemperatureTimer.Interval = 500; // 0.5秒间隔,与实际温度错开
|
||||
settingTemperatureTimer.Tick += SettingTemperatureTimer_Tick;
|
||||
}
|
||||
private void TemperatureTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (serialPort != null && serialPort.IsOpen)
|
||||
@@ -252,6 +404,32 @@ namespace HitBotCSharpDemo
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SettingTemperatureTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (serialPort != null && serialPort.IsOpen)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 发送当前索引对应的设定温度查询命令
|
||||
serialPort.Write(settingtempCommands[currentSettingCommandIndex]);
|
||||
// 更新索引,循环发送四个命令
|
||||
currentSettingCommandIndex = (currentSettingCommandIndex + 1) % settingtempCommands.Length;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"发送设定温度查询命令时发生错误: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
private async void StartSettingTemperatureTimerWithDelay()
|
||||
{
|
||||
await Task.Delay(200); // 延迟200ms
|
||||
if (serialPort != null && serialPort.IsOpen)
|
||||
{
|
||||
settingTemperatureTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateUIStatus(bool isPortOpen, Button button, ComboBox comboBox)
|
||||
{
|
||||
if (isPortOpen)
|
||||
@@ -265,6 +443,30 @@ namespace HitBotCSharpDemo
|
||||
comboBox.Enabled = true; // 串口关闭时启用选择框
|
||||
}
|
||||
}
|
||||
public bool IsSerialPortOpen()
|
||||
{
|
||||
return serialPort != null && serialPort.IsOpen;
|
||||
}
|
||||
public void SendCommand(string command)
|
||||
{
|
||||
if (serialPort != null && serialPort.IsOpen)
|
||||
{
|
||||
try
|
||||
{
|
||||
serialPort.Write(command);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"发送命令失败: {ex.Message}", "错误",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("串口未打开", "提示",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user