小修
This commit is contained in:
@@ -244,17 +244,60 @@ namespace HitBotCSharpDemo
|
||||
float y = cameraPositions[positionIndex][1];
|
||||
float z = cameraPositions[positionIndex][2];
|
||||
float r = cameraPositions[positionIndex][3];
|
||||
float safeZ = -97.6206f; // 安全Z轴高度
|
||||
|
||||
// 设置运动参数
|
||||
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)
|
||||
// 判断当前Z轴高度是否小于安全高度
|
||||
if (robot.z < safeZ)
|
||||
{
|
||||
MessageBox.Show($"移动到点位{positionIndex + 1}失败,返回值:{result}");
|
||||
// 移动z轴
|
||||
int result0 = robot.new_movej_xyz_lr(robot.x, robot.y, z, robot.rotation, 100, 0, currentHand);
|
||||
if (result0 != 1)
|
||||
{
|
||||
MessageBox.Show($"移动Z轴到安全高度失败,返回值:{result0}");
|
||||
return;
|
||||
}
|
||||
// 等待运动完成
|
||||
robot.wait_stop();
|
||||
robot.get_scara_param();
|
||||
|
||||
// 先移动XY轴和R轴
|
||||
int result1 = robot.new_movej_xyz_lr(x, y, robot.z, r, 100, 0, currentHand);
|
||||
if (result1 != 1)
|
||||
{
|
||||
MessageBox.Show($"移动到吸盘点位{positionIndex + 1}的XY位置失败,返回值:{result1}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int result1 = robot.new_movej_xyz_lr(x, y, robot.z, r, 100, 0, currentHand);
|
||||
if (result1 != 1)
|
||||
{
|
||||
MessageBox.Show($"移动到吸盘点位{positionIndex + 1}的XY位置失败,返回值:{result1}");
|
||||
return;
|
||||
}
|
||||
// 等待运动完成
|
||||
robot.wait_stop();
|
||||
robot.get_scara_param();
|
||||
// 移动z轴
|
||||
int result0 = robot.new_movej_xyz_lr(robot.x, robot.y, z, robot.rotation, 100, 0, currentHand);
|
||||
if (result0 != 1)
|
||||
{
|
||||
MessageBox.Show($"移动Z轴到安全高度失败,返回值:{result0}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 移动到指定位置
|
||||
//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)
|
||||
{
|
||||
@@ -282,7 +325,7 @@ namespace HitBotCSharpDemo
|
||||
float targetY = suctionCupPositions[positionIndex][1];
|
||||
float targetZ = suctionCupPositions[positionIndex][2];
|
||||
float targetR = suctionCupPositions[positionIndex][3];
|
||||
float safeZ = -97.6206f; // 安全Z轴高度
|
||||
float safeZ = -100f; // 安全Z轴高度
|
||||
robot.new_set_acc(30, 30, 30, 30); // 设置运动参数
|
||||
|
||||
// 判断当前Z轴高度是否小于安全高度
|
||||
@@ -371,6 +414,7 @@ namespace HitBotCSharpDemo
|
||||
|
||||
InitializeHeatingButtons();
|
||||
textBox10.Text = "9";
|
||||
textBox10.Enabled = false;
|
||||
}
|
||||
private void InitializeHeatingButtons()
|
||||
{
|
||||
@@ -1845,6 +1889,10 @@ namespace HitBotCSharpDemo
|
||||
|
||||
private void button18_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(!textBox10.Enabled)
|
||||
{
|
||||
textBox10.Enabled = false;
|
||||
}
|
||||
suctionCupControl.ToggleSerialPort(button18, comboBox3);
|
||||
}
|
||||
|
||||
@@ -1902,6 +1950,7 @@ namespace HitBotCSharpDemo
|
||||
comboBox4.SelectedIndex = 0;
|
||||
MessageBox.Show($"扫描完成,找到 {comboBox4.Items.Count} 个设备", "扫描结果",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
textBox10.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1911,6 +1960,7 @@ namespace HitBotCSharpDemo
|
||||
// 恢复按钮状态
|
||||
button13.Enabled = true;
|
||||
button13.Text = "扫描设备";
|
||||
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -169,8 +169,8 @@ namespace HitBotCSharpDemo
|
||||
{
|
||||
// 创建Modbus RTU主站
|
||||
master = ModbusSerialMaster.CreateRtu(suctioncupport);
|
||||
//master.Transport.ReadTimeout = 25; // 设置读取超时时间为25ms
|
||||
//master.Transport.WriteTimeout = 25; // 设置写入超时时间为25ms
|
||||
master.Transport.ReadTimeout = 30; // 设置读取超时时间为25ms
|
||||
master.Transport.WriteTimeout = 30; // 设置写入超时时间为25ms
|
||||
for (byte deviceId = (byte)startId; deviceId <= endId; deviceId++)
|
||||
{
|
||||
try
|
||||
@@ -276,8 +276,8 @@ namespace HitBotCSharpDemo
|
||||
// 更新使能状态
|
||||
enableStates[deviceId] = enable;
|
||||
string action = enable ? "使能" : "禁用";
|
||||
MessageBox.Show($"设备ID {deviceId} {action}命令发送成功", "操作成功",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
//MessageBox.Show($"设备ID {deviceId} {action}命令发送成功", "操作成功",
|
||||
// MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -143,8 +143,8 @@ namespace HitBotCSharpDemo
|
||||
PMSOptical_Close(ref deviceHandle);
|
||||
deviceHandle = IntPtr.Zero;
|
||||
UpdateUIStatus(false, button, comboBox);
|
||||
MessageBox.Show("变焦镜头设备已关闭", "提示",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
//MessageBox.Show("变焦镜头设备已关闭", "提示",
|
||||
// MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -165,8 +165,8 @@ namespace HitBotCSharpDemo
|
||||
if (finalCheck && bIsOpened)
|
||||
{
|
||||
UpdateUIStatus(true, button, comboBox);
|
||||
MessageBox.Show($"变焦镜头串口 {serialPort.PortName} 已成功打开", "提示",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
//MessageBox.Show($"变焦镜头串口 {serialPort.PortName} 已成功打开", "提示",
|
||||
// MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Binary file not shown.
Binary file not shown.
1656
HitBotCSharpDemo/bin/x64/Debug/SDK_LOG/id_74_2025-06-27.hilog
Normal file
1656
HitBotCSharpDemo/bin/x64/Debug/SDK_LOG/id_74_2025-06-27.hilog
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user