晶体检测
This commit is contained in:
@@ -2,15 +2,330 @@
|
||||
using MvCameraControl;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HitBotCSharpDemo
|
||||
{
|
||||
public class CameraManager
|
||||
{
|
||||
|
||||
private string configFilePath = "Camera_config.txt";
|
||||
readonly DeviceTLayerType enumTLayerType = DeviceTLayerType.MvGigEDevice | DeviceTLayerType.MvUsbDevice
|
||||
| DeviceTLayerType.MvGenTLGigEDevice | DeviceTLayerType.MvGenTLCXPDevice | DeviceTLayerType.MvGenTLCameraLinkDevice | DeviceTLayerType.MvGenTLXoFDevice;
|
||||
List<IDeviceInfo> deviceInfoList = new List<IDeviceInfo>();
|
||||
IDevice device = null;
|
||||
bool isGrabbing = false;
|
||||
Thread receiveThread = null;
|
||||
private IFrameOut frameForSave;
|
||||
private readonly object saveImageLock = new object();
|
||||
// 添加曝光参数控制变量
|
||||
private float currentExposure = 10000f; // 默认曝光时间
|
||||
private float currentGain = 0f; // 默认增益
|
||||
|
||||
private void InitializeCamera()
|
||||
{
|
||||
// 枚举设备
|
||||
int nRet = DeviceEnumerator.EnumDevices(enumTLayerType, out deviceInfoList);
|
||||
if (nRet != MvError.MV_OK)
|
||||
{
|
||||
MessageBox.Show($"枚举设备失败!,{nRet}");
|
||||
return;
|
||||
}
|
||||
// 如果有设备,自动连接第一个
|
||||
if (deviceInfoList.Count > 0)
|
||||
{
|
||||
ConnectFirstCamera();
|
||||
}
|
||||
}
|
||||
private void ConnectFirstCamera()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 创建设备
|
||||
IDeviceInfo deviceInfo = deviceInfoList[0];
|
||||
device = DeviceFactory.CreateDevice(deviceInfo);
|
||||
// 打开设备
|
||||
int result = device.Open();
|
||||
if (result != MvError.MV_OK)
|
||||
{
|
||||
MessageBox.Show($"打开设备失败!,{result}");
|
||||
return;
|
||||
}
|
||||
// GigE设备优化
|
||||
if (device is IGigEDevice)
|
||||
{
|
||||
IGigEDevice gigEDevice = device as IGigEDevice;
|
||||
int optionPacketSize;
|
||||
result = gigEDevice.GetOptimalPacketSize(out optionPacketSize);
|
||||
if (result == MvError.MV_OK)
|
||||
{
|
||||
device.Parameters.SetIntValue("GevSCPSPacketSize", (long)optionPacketSize);
|
||||
}
|
||||
}
|
||||
// 设置采集模式
|
||||
device.Parameters.SetEnumValueByString("AcquisitionMode", "Continuous");
|
||||
device.Parameters.SetEnumValueByString("TriggerMode", "Off");
|
||||
|
||||
SetCameraParameters(currentExposure, currentGain);
|
||||
|
||||
// 启动图像采集
|
||||
StartGrabbing();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("连接相机失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
private void StartGrabbing()
|
||||
{
|
||||
if (device == null) return;
|
||||
try
|
||||
{
|
||||
isGrabbing = true;
|
||||
receiveThread = new Thread(ReceiveThreadProcess);
|
||||
receiveThread.Start();
|
||||
// 开始采集
|
||||
int result = device.StreamGrabber.StartGrabbing();
|
||||
if (result != MvError.MV_OK)
|
||||
{
|
||||
isGrabbing = false;
|
||||
receiveThread.Join();
|
||||
MessageBox.Show("开始采集失败!" + result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("启动采集线程失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
public void ReceiveThreadProcess()
|
||||
{
|
||||
while (isGrabbing)
|
||||
{
|
||||
IFrameOut frameOut;
|
||||
int nRet = device.StreamGrabber.GetImageBuffer(1000, out frameOut);
|
||||
|
||||
if (MvError.MV_OK == nRet)
|
||||
{
|
||||
// 保存帧信息用于拍照
|
||||
lock (saveImageLock)
|
||||
{
|
||||
if (frameForSave != null)
|
||||
{
|
||||
frameForSave.Dispose();
|
||||
}
|
||||
frameForSave = frameOut.Clone() as IFrameOut;
|
||||
}
|
||||
// 显示图像到PictureBox
|
||||
try
|
||||
{
|
||||
//if (cam_feed.IsHandleCreated)
|
||||
//{
|
||||
// device.ImageRender.DisplayOneFrame(cam_feed.Handle, frameOut.Image);
|
||||
//}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理显示异常
|
||||
Console.WriteLine("显示图像异常: " + ex.Message);
|
||||
}
|
||||
device.StreamGrabber.FreeImageBuffer(frameOut);
|
||||
}
|
||||
else
|
||||
{
|
||||
Thread.Sleep(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void LoadCameraConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(configFilePath))
|
||||
{
|
||||
string[] lines = File.ReadAllLines(configFilePath);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (line.StartsWith("Exposure="))
|
||||
{
|
||||
if (float.TryParse(line.Substring(9), out float exposure))
|
||||
currentExposure = exposure;
|
||||
}
|
||||
else if (line.StartsWith("Gain="))
|
||||
{
|
||||
if (float.TryParse(line.Substring(5), out float gain))
|
||||
currentGain = gain;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("加载相机配置失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
private void SaveCameraConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] config = new string[]
|
||||
{
|
||||
$"Exposure={currentExposure}",
|
||||
$"Gain={currentGain}"
|
||||
};
|
||||
File.WriteAllLines(configFilePath, config);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("保存相机配置失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void TakePhoto()
|
||||
{
|
||||
if (frameForSave == null)
|
||||
{
|
||||
MessageBox.Show("没有可用的图像数据!");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
string fileName = "Photo_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".jpg";
|
||||
|
||||
ImageFormatInfo imageFormatInfo = new ImageFormatInfo();
|
||||
imageFormatInfo.FormatType = ImageFormatType.Jpeg;
|
||||
imageFormatInfo.JpegQuality = 90;
|
||||
lock (saveImageLock)
|
||||
{
|
||||
int result = device.ImageSaver.SaveImageToFile(fileName, frameForSave.Image, imageFormatInfo, CFAMethod.Optimal);
|
||||
if (result == MvError.MV_OK)
|
||||
{
|
||||
MessageBox.Show($"照片已保存: {fileName}");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("保存照片失败!" + result);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("拍照失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
//private void ShowCameraParameterDialog()
|
||||
//{
|
||||
// if (device == null)
|
||||
// {
|
||||
// MessageBox.Show("相机未连接!");
|
||||
// return;
|
||||
// }
|
||||
// // 创建参数调整窗体
|
||||
// using (Form paramForm = new Form())
|
||||
// {
|
||||
// paramForm.Text = "相机参数设置";
|
||||
// paramForm.Size = new Size(300, 200);
|
||||
// paramForm.StartPosition = FormStartPosition.CenterParent;
|
||||
// // 曝光时间设置
|
||||
// Label lblExposure = new Label() { Text = "曝光时间:", Location = new Point(10, 20), Size = new Size(80, 20) };
|
||||
// TextBox txtExposure = new TextBox() { Location = new Point(100, 18), Size = new Size(100, 20), Text = currentExposure.ToString() };
|
||||
// // 增益设置
|
||||
// Label lblGain = new Label() { Text = "增益:", Location = new Point(10, 50), Size = new Size(80, 20) };
|
||||
// TextBox txtGain = new TextBox() { Location = new Point(100, 48), Size = new Size(100, 20), Text = currentGain.ToString() };
|
||||
// // 确定按钮
|
||||
// Button btnOK = new Button() { Text = "应用", Location = new Point(50, 100), Size = new Size(60, 30) };
|
||||
// btnOK.Click += (s, e) => {
|
||||
// try
|
||||
// {
|
||||
// float exposure = float.Parse(txtExposure.Text);
|
||||
// float gain = float.Parse(txtGain.Text);
|
||||
|
||||
// SetCameraParameters(exposure, gain);
|
||||
// paramForm.Close();
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// MessageBox.Show("请输入正确的数值!");
|
||||
// }
|
||||
// };
|
||||
// // 取消按钮
|
||||
// Button btnCancel = new Button() { Text = "取消", Location = new Point(130, 100), Size = new Size(60, 30) };
|
||||
// btnCancel.Click += (s, e) => paramForm.Close();
|
||||
// paramForm.Controls.AddRange(new Control[] { lblExposure, txtExposure, lblGain, txtGain, btnOK, btnCancel });
|
||||
// paramForm.ShowDialog(this);
|
||||
// }
|
||||
//}
|
||||
|
||||
private void SetCameraParameters(float exposure, float gain)
|
||||
{
|
||||
if (device == null) return;
|
||||
try
|
||||
{
|
||||
// 设置曝光时间
|
||||
device.Parameters.SetEnumValue("ExposureAuto", 0); // 关闭自动曝光
|
||||
int result = device.Parameters.SetFloatValue("ExposureTime", exposure);
|
||||
if (result != MvError.MV_OK)
|
||||
{
|
||||
MessageBox.Show("设置曝光时间失败!" + result);
|
||||
return;
|
||||
}
|
||||
// 设置增益
|
||||
device.Parameters.SetEnumValue("GainAuto", 0); // 关闭自动增益
|
||||
result = device.Parameters.SetFloatValue("Gain", gain);
|
||||
if (result != MvError.MV_OK)
|
||||
{
|
||||
MessageBox.Show("设置增益失败!" + result);
|
||||
return;
|
||||
}
|
||||
currentExposure = exposure;
|
||||
currentGain = gain;
|
||||
SaveCameraConfig();
|
||||
|
||||
//MessageBox.Show("参数设置成功!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("设置参数失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
//protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
//{
|
||||
// // 停止采集
|
||||
// if (isGrabbing)
|
||||
// {
|
||||
// isGrabbing = false;
|
||||
// if (receiveThread != null && receiveThread.IsAlive)
|
||||
// {
|
||||
// receiveThread.Join();
|
||||
// }
|
||||
// }
|
||||
// // 关闭设备
|
||||
// if (device != null)
|
||||
// {
|
||||
// device.StreamGrabber.StopGrabbing();
|
||||
// device.Close();
|
||||
// device.Dispose();
|
||||
// device = null;
|
||||
// }
|
||||
// // 释放帧缓存
|
||||
// lock (saveImageLock)
|
||||
// {
|
||||
// if (frameForSave != null)
|
||||
// {
|
||||
// frameForSave.Dispose();
|
||||
// frameForSave = null;
|
||||
// }
|
||||
// }
|
||||
// // 终结SDK
|
||||
// SDKSystem.Finalize();
|
||||
|
||||
// base.OnFormClosing(e);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
35
HitBotCSharpDemo/ShowForm.Designer.cs
generated
35
HitBotCSharpDemo/ShowForm.Designer.cs
generated
@@ -115,6 +115,8 @@
|
||||
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.button1 = new System.Windows.Forms.Button();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.tac_MainForm.SuspendLayout();
|
||||
this.tap_Axis.SuspendLayout();
|
||||
this.grb_R.SuspendLayout();
|
||||
@@ -130,6 +132,7 @@
|
||||
this.tap_Cam.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cam_feed)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btn_Init
|
||||
@@ -991,6 +994,8 @@
|
||||
//
|
||||
// tap_Cam
|
||||
//
|
||||
this.tap_Cam.Controls.Add(this.pictureBox1);
|
||||
this.tap_Cam.Controls.Add(this.button1);
|
||||
this.tap_Cam.Controls.Add(this.cam_feed);
|
||||
this.tap_Cam.Controls.Add(this.cam_shooting);
|
||||
this.tap_Cam.Controls.Add(this.init_pos_btn);
|
||||
@@ -1008,18 +1013,18 @@
|
||||
//
|
||||
// cam_feed
|
||||
//
|
||||
this.cam_feed.Location = new System.Drawing.Point(426, 52);
|
||||
this.cam_feed.Location = new System.Drawing.Point(422, 143);
|
||||
this.cam_feed.Name = "cam_feed";
|
||||
this.cam_feed.Size = new System.Drawing.Size(675, 552);
|
||||
this.cam_feed.Size = new System.Drawing.Size(333, 300);
|
||||
this.cam_feed.TabIndex = 8;
|
||||
this.cam_feed.TabStop = false;
|
||||
this.cam_feed.Click += new System.EventHandler(this.cam_feed_Click);
|
||||
//
|
||||
// cam_shooting
|
||||
//
|
||||
this.cam_shooting.Location = new System.Drawing.Point(743, 639);
|
||||
this.cam_shooting.Location = new System.Drawing.Point(527, 492);
|
||||
this.cam_shooting.Name = "cam_shooting";
|
||||
this.cam_shooting.Size = new System.Drawing.Size(128, 43);
|
||||
this.cam_shooting.Size = new System.Drawing.Size(143, 43);
|
||||
this.cam_shooting.TabIndex = 7;
|
||||
this.cam_shooting.Text = "拍摄";
|
||||
this.cam_shooting.UseVisualStyleBackColor = true;
|
||||
@@ -1121,6 +1126,25 @@
|
||||
this.rit_Coord.Text = "";
|
||||
this.rit_Coord.TextChanged += new System.EventHandler(this.rit_Coord_TextChanged);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(892, 492);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(161, 43);
|
||||
this.button1.TabIndex = 9;
|
||||
this.button1.Text = "开始目标检测";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click_2);
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(797, 143);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(333, 300);
|
||||
this.pictureBox1.TabIndex = 10;
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
|
||||
//
|
||||
// ShowForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
|
||||
@@ -1162,6 +1186,7 @@
|
||||
this.tap_Cam.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.cam_feed)).EndInit();
|
||||
this.panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -1254,6 +1279,8 @@
|
||||
private System.Windows.Forms.Button init_pos_btn;
|
||||
private System.Windows.Forms.Button cam_shooting;
|
||||
private System.Windows.Forms.PictureBox cam_feed;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using TcpserverExDll;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace HitBotCSharpDemo
|
||||
{
|
||||
public partial class ShowForm : Form
|
||||
@@ -48,21 +51,24 @@ namespace HitBotCSharpDemo
|
||||
Thread receiveThread = null;
|
||||
private IFrameOut frameForSave;
|
||||
private readonly object saveImageLock = new object();
|
||||
// 添加曝光参数控制变量
|
||||
private float currentExposure = 10000f; // 默认曝光时间
|
||||
private float currentGain = 0f; // 默认增益
|
||||
|
||||
private TcpClient tcpClient;
|
||||
private NetworkStream networkStream;
|
||||
private Thread detectionThread;
|
||||
private bool isDetectionRunning = false;
|
||||
private const int SERVER_PORT = 8888; // Python服务器端口
|
||||
private const string SERVER_IP = "192.168.124.4"; // 本机IP
|
||||
|
||||
private CameraManager camManager;
|
||||
private ControlBeanEx robot;
|
||||
public ShowForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
TcpserverEx.net_port_initial();
|
||||
robot = TcpserverEx.get_robot(74);//替换为自己的机器的id号
|
||||
// 初始化SDK
|
||||
SDKSystem.Initialize();
|
||||
// 初始化相机
|
||||
//InitializeCamera();
|
||||
SDKSystem.Initialize(); // 初始化SDK
|
||||
//InitializeCamera(); // 初始化相机
|
||||
Control.CheckForIllegalCrossThreadCalls = false;
|
||||
}
|
||||
private void InitializeCamera()
|
||||
@@ -360,6 +366,7 @@ namespace HitBotCSharpDemo
|
||||
frameForSave = null;
|
||||
}
|
||||
}
|
||||
StopDetection();
|
||||
// 终结SDK
|
||||
SDKSystem.Finalize();
|
||||
|
||||
@@ -940,7 +947,6 @@ namespace HitBotCSharpDemo
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
TakePhoto();
|
||||
@@ -950,5 +956,256 @@ namespace HitBotCSharpDemo
|
||||
{
|
||||
ShowCameraParameterDialog();
|
||||
}
|
||||
|
||||
private void button1_Click_2(object sender, EventArgs e)
|
||||
{
|
||||
if (!isDetectionRunning)
|
||||
{
|
||||
// 连接到Python服务器
|
||||
if (ConnectToServer())
|
||||
{
|
||||
isDetectionRunning = true;
|
||||
detectionThread = new Thread(DetectionProcess);
|
||||
detectionThread.IsBackground = true;
|
||||
detectionThread.Start();
|
||||
|
||||
((Button)sender).Text = "停止检测";
|
||||
MessageBox.Show("目标检测已开始");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("连接服务器失败");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 停止检测
|
||||
StopDetection();
|
||||
((Button)sender).Text = "开始目标检测";
|
||||
MessageBox.Show("目标检测已停止");
|
||||
}
|
||||
}
|
||||
|
||||
private void pictureBox1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (pictureBox1.Image != null)
|
||||
{
|
||||
// 创建一个新窗口显示大图
|
||||
Form imageForm = new Form();
|
||||
imageForm.Text = "检测结果";
|
||||
imageForm.StartPosition = FormStartPosition.CenterParent;
|
||||
imageForm.Size = new Size(800, 600);
|
||||
|
||||
PictureBox largePictureBox = new PictureBox();
|
||||
largePictureBox.Dock = DockStyle.Fill;
|
||||
largePictureBox.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
largePictureBox.Image = new Bitmap(pictureBox1.Image);
|
||||
|
||||
imageForm.Controls.Add(largePictureBox);
|
||||
imageForm.ShowDialog(this);
|
||||
|
||||
largePictureBox.Image.Dispose();
|
||||
}
|
||||
}
|
||||
private bool ConnectToServer()
|
||||
{
|
||||
try
|
||||
{
|
||||
tcpClient = new TcpClient();
|
||||
tcpClient.Connect(SERVER_IP, SERVER_PORT);
|
||||
networkStream = tcpClient.GetStream();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("连接服务器失败: " + ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 检测处理线程
|
||||
private void DetectionProcess()
|
||||
{
|
||||
while (isDetectionRunning)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 保存当前图像
|
||||
string imagePath = SaveCurrentImage();
|
||||
if (!string.IsNullOrEmpty(imagePath))
|
||||
{
|
||||
// 发送图像到Python服务器
|
||||
SendImageToServer(imagePath);
|
||||
|
||||
// 接收处理后的图像
|
||||
string receivedImagePath = ReceiveImageFromServer();
|
||||
if (!string.IsNullOrEmpty(receivedImagePath))
|
||||
{
|
||||
// 在UI线程中显示图像
|
||||
this.Invoke(new Action(() => DisplayDetectionResult(receivedImagePath)));
|
||||
}
|
||||
|
||||
// 删除临时图像文件
|
||||
if (File.Exists(imagePath))
|
||||
File.Delete(imagePath);
|
||||
}
|
||||
|
||||
// 等待1分钟
|
||||
Thread.Sleep(60000);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Invoke(new Action(() => MessageBox.Show("检测过程出错: " + ex.Message)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 保存当前图像
|
||||
private string SaveCurrentImage()
|
||||
{
|
||||
if (frameForSave == null) return null;
|
||||
|
||||
try
|
||||
{
|
||||
string fileName = "temp_detection_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
|
||||
string fullPath = Path.Combine(Application.StartupPath, fileName);
|
||||
|
||||
ImageFormatInfo imageFormatInfo = new ImageFormatInfo();
|
||||
imageFormatInfo.FormatType = ImageFormatType.Jpeg;
|
||||
imageFormatInfo.JpegQuality = 90;
|
||||
|
||||
lock (saveImageLock)
|
||||
{
|
||||
int result = device.ImageSaver.SaveImageToFile(fullPath, frameForSave.Image, imageFormatInfo, CFAMethod.Optimal);
|
||||
if (result == MvError.MV_OK)
|
||||
{
|
||||
return fullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("保存图像失败: " + ex.Message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// 发送图像到服务器
|
||||
private void SendImageToServer(string imagePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] imageData = File.ReadAllBytes(imagePath);
|
||||
byte[] imageSize = new byte[4];
|
||||
imageSize[0] = (byte)((imageData.Length >> 24) & 0xFF);
|
||||
imageSize[1] = (byte)((imageData.Length >> 16) & 0xFF);
|
||||
imageSize[2] = (byte)((imageData.Length >> 8) & 0xFF);
|
||||
imageSize[3] = (byte)(imageData.Length & 0xFF);
|
||||
|
||||
// 先发送图像大小
|
||||
networkStream.Write(imageSize, 0, 4);
|
||||
// 再发送图像数据
|
||||
networkStream.Write(imageData, 0, imageData.Length);
|
||||
networkStream.Flush();
|
||||
//MessageBox.Show($"发送图像成功,大小: {imageData.Length} 字节");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("发送图像失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
// 从服务器接收处理后的图像
|
||||
private string ReceiveImageFromServer()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 接收图像大小
|
||||
byte[] sizeBuffer = new byte[4];
|
||||
int bytesRead = 0;
|
||||
while (bytesRead < 4)
|
||||
{
|
||||
int read = networkStream.Read(sizeBuffer, bytesRead, 4 - bytesRead);
|
||||
if (read == 0) throw new Exception("连接断开");
|
||||
bytesRead += read;
|
||||
}
|
||||
|
||||
int imageSize = (sizeBuffer[0] << 24) | (sizeBuffer[1] << 16) |
|
||||
(sizeBuffer[2] << 8) | sizeBuffer[3];
|
||||
|
||||
//MessageBox.Show($"准备接收处理结果图像,大小: {imageSize} 字节");
|
||||
|
||||
|
||||
// 接收图像数据
|
||||
byte[] imageBuffer = new byte[imageSize];
|
||||
bytesRead = 0;
|
||||
while (bytesRead < imageSize)
|
||||
{
|
||||
int read = networkStream.Read(imageBuffer, bytesRead, imageSize - bytesRead);
|
||||
if (read == 0) throw new Exception("连接断开");
|
||||
bytesRead += read;
|
||||
}
|
||||
|
||||
// 保存接收到的图像
|
||||
string receivedImagePath = Path.Combine(Application.StartupPath,
|
||||
"received_detection_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg");
|
||||
File.WriteAllBytes(receivedImagePath, imageBuffer);
|
||||
|
||||
return receivedImagePath;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("接收图像失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
// 在pictureBox1中显示检测结果
|
||||
private void DisplayDetectionResult(string imagePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(imagePath))
|
||||
{
|
||||
// 如果pictureBox1之前有图像,先释放资源
|
||||
if (pictureBox1.Image != null)
|
||||
{
|
||||
pictureBox1.Image.Dispose();
|
||||
}
|
||||
|
||||
// 加载并显示新图像
|
||||
using (var fs = new FileStream(imagePath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
pictureBox1.Image = Image.FromStream(fs);
|
||||
}
|
||||
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
// 删除临时文件
|
||||
File.Delete(imagePath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("显示检测结果失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
// 停止检测
|
||||
private void StopDetection()
|
||||
{
|
||||
isDetectionRunning = false;
|
||||
|
||||
if (detectionThread != null && detectionThread.IsAlive)
|
||||
{
|
||||
detectionThread.Join(2000); // 等待2秒
|
||||
}
|
||||
|
||||
// 关闭网络连接
|
||||
try
|
||||
{
|
||||
networkStream?.Close();
|
||||
tcpClient?.Close();
|
||||
}
|
||||
catch { }
|
||||
|
||||
networkStream = null;
|
||||
tcpClient = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
HitBotCSharpDemo/bin/x64/Debug/Photo_20250610_155608.jpg
Normal file
BIN
HitBotCSharpDemo/bin/x64/Debug/Photo_20250610_155608.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
@@ -644,3 +644,357 @@
|
||||
2025-06-10 11:33:00.432 trail_number1.443221
|
||||
2025-06-10 11:33:00.432 tcp_distance 144.322098
|
||||
2025-06-10 11:33:00.433 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-10 12:01:51.719 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-10 12:01:51.720 robot connected
|
||||
2025-06-10 12:01:51.720 26
|
||||
2025-06-10 12:01:51.720 current generation=26
|
||||
2025-06-10 12:01:52.222 0x1a
|
||||
2025-06-10 12:01:53.058 initial joint2 2449951
|
||||
2025-06-10 12:01:53.058 C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\\j4_pid.txt do not exist
|
||||
2025-06-10 12:01:53.058 robot WritePID
|
||||
2025-06-10 12:01:53.370 initial joint1 -160246
|
||||
2025-06-10 12:01:53.418 initial joint2 2449951
|
||||
2025-06-10 12:01:53.464 initial joint3 -219819
|
||||
2025-06-10 12:01:53.512 initial joint4 -25369362
|
||||
2025-06-10 12:01:53.521 initial joint1 -160245
|
||||
2025-06-10 12:01:53.593 initial joint2 2449951
|
||||
2025-06-10 12:01:53.630 initial joint3 -219823
|
||||
2025-06-10 12:01:53.670 initial joint4 -25369364
|
||||
2025-06-10 12:01:53.686 initial joint1 -160248
|
||||
2025-06-10 12:01:53.736 initial joint2 2449951
|
||||
2025-06-10 12:01:53.768 initial joint3 -219825
|
||||
2025-06-10 12:01:53.816 initial joint4 -25369364
|
||||
2025-06-10 12:01:55.895 initial_thread initialized
|
||||
2025-06-10 12:01:55.897 servo enable
|
||||
2025-06-10 12:01:55.897 brake open
|
||||
2025-06-10 12:01:55.900 set_brake_state 0 1
|
||||
2025-06-10 12:01:56.111 robot initialized
|
||||
2025-06-10 12:01:56.705 get_scara_param -11.003600 84.112396 -75.472298 -1005.721802
|
||||
2025-06-10 12:01:56.705 get_scara_real_coor -11.003300 84.112396 -75.472298 -1005.721619
|
||||
2025-06-10 12:01:56.705 set_first_position_after_initial
|
||||
2025-06-10 12:01:56.706 movej_old start_pos: -11.003600 84.112396 -75.472298 -1005.721802 end_pos: -11.003600 84.112297 -75.472298 -1005.721802 org_sp 10.000000 end_sp 0.805957
|
||||
2025-06-10 12:01:57.001 J3 Belt Meilage=40.894260km
|
||||
2025-06-10 12:02:01.293 30 30 30 30
|
||||
2025-06-10 12:02:01.294 new_movej_xyz_lr 274.065002 -302.743805 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-10 12:02:01.295 goal_angle -60.720737 27.061800
|
||||
2025-06-10 12:02:01.296 new_movej_angle -60.720737 27.061800 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-10 12:02:01.296 z1 -75.472298 z2 -75.466103
|
||||
2025-06-10 12:02:01.296 angle1_1 -11.003600 angle2_1 84.112297 z1 -75.472298 r1 -1005.721802
|
||||
2025-06-10 12:02:01.296 angle1_2 -60.720737 angle2_2 27.061800 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-10 12:02:01.297 speed 100.000000
|
||||
2025-06-10 12:02:01.297 tcp_distance 498.312805
|
||||
2025-06-10 12:02:01.299 new_end_speed 100.000000 j1_acc_t 2.491564 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 21.824898
|
||||
2025-06-10 12:02:01.299 new_end_speed 100.000000 j2_acc_t 2.491564 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 25.044106
|
||||
2025-06-10 12:02:01.300 new_end_speed 100.000000 j3_acc_t 2.491564 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 0.002720
|
||||
2025-06-10 12:02:01.300 new_end_speed 100.000000 j4_acc_t 2.491564 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 0.000348
|
||||
2025-06-10 12:02:01.300 end_speed 100.000000
|
||||
2025-06-10 12:02:01.300 trail_number4.983128
|
||||
2025-06-10 12:02:01.300 tcp_distance 498.312805
|
||||
2025-06-10 12:02:01.302 angle1_1 = -11.003600 angle2_1 = 84.112297 z1 = -75.472298 r1 = -1005.721802 angle1_2 = -60.720737 angle2_2 = 27.061800 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-10 12:02:06.061 30 30 30 30
|
||||
2025-06-10 12:02:06.061 new_movej_xyz_lr 274.065002 -137.158203 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-10 12:02:06.061 goal_angle -67.226128 86.401024
|
||||
2025-06-10 12:02:06.061 new_movej_angle -67.226128 86.401024 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-10 12:02:06.061 z1 -75.466103 z2 -75.466103
|
||||
2025-06-10 12:02:06.061 angle1_1 -60.720737 angle2_1 27.061800 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-10 12:02:06.061 angle1_2 -67.226128 angle2_2 86.401024 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-10 12:02:06.061 speed 100.000000
|
||||
2025-06-10 12:02:06.061 tcp_distance 171.494293
|
||||
2025-06-10 12:02:06.061 new_end_speed 100.000000 j1_acc_t 0.857471 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 8.297963
|
||||
2025-06-10 12:02:06.061 new_end_speed 100.000000 j2_acc_t 0.857471 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 75.690262
|
||||
2025-06-10 12:02:06.061 new_end_speed 100.000000 j3_acc_t 0.857471 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 0.000000
|
||||
2025-06-10 12:02:06.061 new_end_speed 100.000000 j4_acc_t 0.857471 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 0.000000
|
||||
2025-06-10 12:02:06.061 end_speed 100.000000
|
||||
2025-06-10 12:02:06.061 trail_number1.714943
|
||||
2025-06-10 12:02:06.061 tcp_distance 171.494293
|
||||
2025-06-10 12:02:06.348 angle1_1 = -60.720737 angle2_1 = 27.061800 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -67.226128 angle2_2 = 86.401024 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-10 12:02:07.776 30 30 30 30
|
||||
2025-06-10 12:02:07.777 new_movej_xyz_lr 274.065002 5.965300 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-10 12:02:07.777 goal_angle -44.911705 98.661697
|
||||
2025-06-10 12:02:07.777 new_movej_angle -44.911705 98.661697 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-10 12:02:07.777 z1 -75.466103 z2 -75.466103
|
||||
2025-06-10 12:02:07.777 angle1_1 -67.226128 angle2_1 86.401024 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-10 12:02:07.778 angle1_2 -44.911705 angle2_2 98.661697 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-10 12:02:07.778 speed 100.000000
|
||||
2025-06-10 12:02:07.778 tcp_distance 144.069748
|
||||
2025-06-10 12:02:07.778 new_end_speed 100.000000 j1_acc_t 0.720349 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 33.881371
|
||||
2025-06-10 12:02:07.778 new_end_speed 100.000000 j2_acc_t 0.720349 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 18.616140
|
||||
2025-06-10 12:02:07.779 new_end_speed 100.000000 j3_acc_t 0.720349 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 0.000000
|
||||
2025-06-10 12:02:07.779 new_end_speed 100.000000 j4_acc_t 0.720349 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 0.000000
|
||||
2025-06-10 12:02:07.779 end_speed 100.000000
|
||||
2025-06-10 12:02:07.780 trail_number1.440697
|
||||
2025-06-10 12:02:07.780 tcp_distance 144.069748
|
||||
2025-06-10 12:02:08.106 angle1_1 = -67.226128 angle2_1 = 86.401024 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -44.911705 angle2_2 = 98.661697 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-10 12:02:09.480 30 30 30 30
|
||||
2025-06-10 12:02:09.480 new_movej_xyz_lr 274.065002 149.383698 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-10 12:02:09.480 goal_angle -11.002804 84.112190
|
||||
2025-06-10 12:02:09.480 new_movej_angle -11.002804 84.112190 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-10 12:02:09.480 z1 -75.466103 z2 -75.466103
|
||||
2025-06-10 12:02:09.480 angle1_1 -44.911705 angle2_1 98.661697 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-10 12:02:09.480 angle1_2 -11.002804 angle2_2 84.112190 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-10 12:02:09.480 speed 100.000000
|
||||
2025-06-10 12:02:09.480 tcp_distance 144.322098
|
||||
2025-06-10 12:02:09.480 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-10 12:02:09.480 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-10 12:02:09.480 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-10 12:02:09.480 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-10 12:02:09.480 end_speed 100.000000
|
||||
2025-06-10 12:02:09.480 trail_number1.443221
|
||||
2025-06-10 12:02:09.491 tcp_distance 144.322098
|
||||
2025-06-10 12:02:09.607 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-10 15:55:37.275 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-10 15:55:37.275 robot connected
|
||||
2025-06-10 15:55:37.275 26
|
||||
2025-06-10 15:55:37.275 current generation=26
|
||||
2025-06-10 15:55:37.784 0x1a
|
||||
2025-06-10 15:55:38.607 initial joint2 2449951
|
||||
2025-06-10 15:55:38.607 C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\\j4_pid.txt do not exist
|
||||
2025-06-10 15:55:38.607 robot WritePID
|
||||
2025-06-10 15:55:38.911 initial joint1 -160239
|
||||
2025-06-10 15:55:38.947 initial joint2 2449953
|
||||
2025-06-10 15:55:39.027 initial joint3 -219814
|
||||
2025-06-10 15:55:39.083 initial joint4 -25369364
|
||||
2025-06-10 15:55:39.096 initial joint1 -160239
|
||||
2025-06-10 15:55:39.134 initial joint2 2449953
|
||||
2025-06-10 15:55:39.165 initial joint3 -219814
|
||||
2025-06-10 15:55:39.233 initial joint4 -25369365
|
||||
2025-06-10 15:55:39.250 initial joint1 -160239
|
||||
2025-06-10 15:55:39.318 initial joint2 2449956
|
||||
2025-06-10 15:55:39.366 initial joint3 -219819
|
||||
2025-06-10 15:55:39.427 initial joint4 -25369365
|
||||
2025-06-10 15:55:41.644 initial_thread initialized
|
||||
2025-06-10 15:55:41.644 servo enable
|
||||
2025-06-10 15:55:41.644 brake open
|
||||
2025-06-10 15:55:41.645 set_brake_state 0 1
|
||||
2025-06-10 15:55:41.856 robot initialized
|
||||
2025-06-10 15:55:42.412 get_scara_param -11.002800 84.112701 -75.470200 -1005.720886
|
||||
2025-06-10 15:55:42.412 get_scara_real_coor -11.002700 84.112503 -75.470497 -1005.720886
|
||||
2025-06-10 15:55:42.412 <09><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2><EFBFBD><EFBFBD>
|
||||
2025-06-10 15:55:42.412 position -160239.890625 2449960.000000 -219822.890625 -25369366.000000 -654064.062500 2873721.500000 -219810.953125 -24758210.000000
|
||||
2025-06-10 15:55:42.412 speed 33908.214844 14548.696289 4.098415 25178.853516
|
||||
2025-06-10 15:55:42.412 set_first_position_after_initial
|
||||
2025-06-10 15:55:42.412 movej_old start_pos: -11.002800 84.112701 -75.470200 -1005.720886 end_pos: -11.002800 84.112701 -75.470200 -1005.720886 org_sp 10.000000 end_sp 10.000000
|
||||
2025-06-10 15:55:42.729 J3 Belt Meilage=40.896538km
|
||||
2025-06-10 15:55:44.709 30 30 30 30
|
||||
2025-06-10 15:55:44.714 new_movej_xyz_lr 274.065002 -302.743805 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-10 15:55:44.714 goal_angle -60.720737 27.061800
|
||||
2025-06-10 15:55:44.714 new_movej_angle -60.720737 27.061800 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-10 15:55:44.714 z1 -75.470200 z2 -75.466103
|
||||
2025-06-10 15:55:44.714 angle1_1 -11.002800 angle2_1 84.112701 z1 -75.470200 r1 -1005.720886
|
||||
2025-06-10 15:55:44.716 angle1_2 -60.720737 angle2_2 27.061800 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-10 15:55:44.716 speed 100.000000
|
||||
2025-06-10 15:55:44.716 tcp_distance 498.318756
|
||||
2025-06-10 15:55:44.716 new_end_speed 100.000000 j1_acc_t 2.491594 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 21.824972
|
||||
2025-06-10 15:55:44.717 new_end_speed 100.000000 j2_acc_t 2.491594 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 25.043966
|
||||
2025-06-10 15:55:44.717 new_end_speed 100.000000 j3_acc_t 2.491594 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 0.001798
|
||||
2025-06-10 15:55:44.717 new_end_speed 100.000000 j4_acc_t 2.491594 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 0.000054
|
||||
2025-06-10 15:55:44.717 end_speed 100.000000
|
||||
2025-06-10 15:55:44.717 trail_number4.983188
|
||||
2025-06-10 15:55:44.717 tcp_distance 498.318756
|
||||
2025-06-10 15:55:44.717 angle1_1 = -11.002800 angle2_1 = 84.112701 z1 = -75.470200 r1 = -1005.720886 angle1_2 = -60.720737 angle2_2 = 27.061800 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-10 15:55:49.967 30 30 30 30
|
||||
2025-06-10 15:55:49.967 new_movej_xyz_lr 93.989304 -37.882999 -4.457100 -1027.920044 100.000000 0.000000 1
|
||||
2025-06-10 15:55:49.967 goal_angle -87.199585 152.604431
|
||||
2025-06-10 15:55:49.967 new_movej_angle -87.199585 152.604431 -4.457100 -1027.920044 0.000000 100.000000
|
||||
2025-06-10 15:55:49.968 z1 -75.466103 z2 -4.457100
|
||||
2025-06-10 15:55:49.968 angle1_1 -60.720737 angle2_1 27.061800 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-10 15:55:49.968 angle1_2 -87.199585 angle2_2 152.604431 z2 -4.457100 r2 -1027.920044
|
||||
2025-06-10 15:55:49.968 speed 100.000000
|
||||
2025-06-10 15:55:49.968 tcp_distance 360.555389
|
||||
2025-06-10 15:55:49.969 new_end_speed 100.000000 j1_acc_t 1.802777 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 16.064789
|
||||
2025-06-10 15:55:49.969 new_end_speed 100.000000 j2_acc_t 1.802777 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 76.167061
|
||||
2025-06-10 15:55:49.969 new_end_speed 100.000000 j3_acc_t 1.802777 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 43.081356
|
||||
2025-06-10 15:55:49.969 new_end_speed 100.000000 j4_acc_t 1.802777 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 13.468219
|
||||
2025-06-10 15:55:49.969 end_speed 100.000000
|
||||
2025-06-10 15:55:49.970 trail_number3.605554
|
||||
2025-06-10 15:55:49.970 tcp_distance 360.555389
|
||||
2025-06-10 15:55:49.971 angle1_1 = -60.720737 angle2_1 = 27.061800 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -87.199585 angle2_2 = 152.604431 z2 = -4.457100 r2 = -1027.920044
|
||||
2025-06-10 15:55:54.110 30 30 30 30
|
||||
2025-06-10 15:55:54.111 new_movej_xyz_lr 274.065002 149.383698 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-10 15:55:54.111 goal_angle -11.002804 84.112190
|
||||
2025-06-10 15:55:54.111 new_movej_angle -11.002804 84.112190 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-10 15:55:54.111 z1 -4.457100 z2 -75.466103
|
||||
2025-06-10 15:55:54.112 angle1_1 -87.199585 angle2_1 152.604431 z1 -4.457100 r1 -1027.920044
|
||||
2025-06-10 15:55:54.112 angle1_2 -11.002804 angle2_2 84.112190 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-10 15:55:54.112 speed 100.000000
|
||||
2025-06-10 15:55:54.112 tcp_distance 288.589417
|
||||
2025-06-10 15:55:54.112 new_end_speed 100.000000 j1_acc_t 1.442947 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 57.756939
|
||||
2025-06-10 15:55:54.112 new_end_speed 100.000000 j2_acc_t 1.442947 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 51.916920
|
||||
2025-06-10 15:55:54.113 new_end_speed 100.000000 j3_acc_t 1.442947 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 53.824619
|
||||
2025-06-10 15:55:54.113 new_end_speed 100.000000 j4_acc_t 1.442947 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 16.826810
|
||||
2025-06-10 15:55:54.113 end_speed 100.000000
|
||||
2025-06-10 15:55:54.113 trail_number2.885894
|
||||
2025-06-10 15:55:54.113 tcp_distance 288.589417
|
||||
2025-06-10 15:55:54.114 angle1_1 = -87.199585 angle2_1 = 152.604431 z1 = -4.457100 r1 = -1027.920044 angle1_2 = -11.002804 angle2_2 = 84.112190 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-10 15:55:58.257 30 30 30 30
|
||||
2025-06-10 15:55:58.257 new_movej_xyz_lr 274.065002 5.965300 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-10 15:55:58.257 goal_angle -44.911705 98.661697
|
||||
2025-06-10 15:55:58.257 new_movej_angle -44.911705 98.661697 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-10 15:55:58.257 z1 -75.466103 z2 -75.466103
|
||||
2025-06-10 15:55:58.257 angle1_1 -11.002804 angle2_1 84.112190 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-10 15:55:58.257 angle1_2 -44.911705 angle2_2 98.661697 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-10 15:55:58.257 speed 100.000000
|
||||
2025-06-10 15:55:58.257 tcp_distance 144.406967
|
||||
2025-06-10 15:55:58.257 new_end_speed 100.000000 j1_acc_t 0.722035 j1_avg_time 0.000000 j1_max_acc 237.000000 j1_max_sp 51.365715
|
||||
2025-06-10 15:55:58.266 new_end_speed 100.000000 j2_acc_t 0.722035 j2_avg_time 0.000000 j2_max_acc 2566.500000 j2_max_sp 22.039812
|
||||
2025-06-10 15:55:58.266 new_end_speed 100.000000 j3_acc_t 0.722035 j3_avg_time 0.000000 j3_max_acc 3869.100098 j3_max_sp 0.000000
|
||||
2025-06-10 15:55:58.266 new_end_speed 100.000000 j4_acc_t 0.722035 j4_avg_time 0.000000 j4_max_acc 1572.900024 j4_max_sp 0.000000
|
||||
2025-06-10 15:55:58.266 end_speed 100.000000
|
||||
2025-06-10 15:55:58.266 trail_number1.444070
|
||||
2025-06-10 15:55:58.266 tcp_distance 144.406967
|
||||
2025-06-10 15:55:58.266 angle1_1 = -11.002804 angle2_1 = 84.112190 z1 = -75.466103 r1 = -1005.721008 angle1_2 = -44.911705 angle2_2 = 98.661697 z2 = -75.466103 r2 = -1005.721008
|
||||
2025-06-10 15:56:00.103 30 30 30 30
|
||||
2025-06-10 15:56:00.104 new_movej_xyz_lr 274.065002 149.383698 -75.466103 -1005.721008 100.000000 0.000000 1
|
||||
2025-06-10 15:56:00.104 goal_angle -11.002804 84.112190
|
||||
2025-06-10 15:56:00.104 new_movej_angle -11.002804 84.112190 -75.466103 -1005.721008 0.000000 100.000000
|
||||
2025-06-10 15:56:00.105 z1 -75.466103 z2 -75.466103
|
||||
2025-06-10 15:56:00.105 angle1_1 -44.911705 angle2_1 98.661697 z1 -75.466103 r1 -1005.721008
|
||||
2025-06-10 15:56:00.105 angle1_2 -11.002804 angle2_2 84.112190 z2 -75.466103 r2 -1005.721008
|
||||
2025-06-10 15:56:00.105 speed 100.000000
|
||||
2025-06-10 15:56:00.105 tcp_distance 144.322098
|
||||
2025-06-10 15:56:00.106 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-10 15:56:00.106 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-10 15:56:00.106 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-10 15:56:00.106 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-10 15:56:00.106 end_speed 100.000000
|
||||
2025-06-10 15:56:00.106 trail_number1.443221
|
||||
2025-06-10 15:56:00.106 tcp_distance 144.322098
|
||||
2025-06-10 15:56:00.107 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-10 19:47:11.982 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-10 19:47:11.982 robot connected
|
||||
2025-06-10 19:47:11.982 26
|
||||
2025-06-10 19:47:11.982 current generation=26
|
||||
2025-06-10 19:47:12.496 0x1a
|
||||
2025-06-10 19:47:12.496 initial return 3 ĩ<>˹ؽڲ<D8BD><DAB2><EFBFBD><EFBFBD><EFBFBD><DEB6><EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>joint_homeʹ<65>ؽ<EFBFBD>ǿ<EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>
|
||||
2025-06-10 19:47:14.299 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-10 19:47:14.299 robot connected
|
||||
2025-06-10 19:47:14.299 26
|
||||
2025-06-10 19:47:14.299 current generation=26
|
||||
2025-06-10 19:47:14.803 0x1a
|
||||
2025-06-10 19:47:15.537 initial joint2 2449948
|
||||
2025-06-10 19:47:15.537 C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\\j4_pid.txt do not exist
|
||||
2025-06-10 19:47:15.537 robot WritePID
|
||||
2025-06-10 19:47:15.855 initial joint1 -160234
|
||||
2025-06-10 19:47:15.902 initial joint2 2449949
|
||||
2025-06-10 19:47:15.962 initial joint3 -219817
|
||||
2025-06-10 19:47:16.042 initial joint4 -25369363
|
||||
2025-06-10 19:47:16.078 initial joint1 -160230
|
||||
2025-06-10 19:47:16.126 initial joint2 2449950
|
||||
2025-06-10 19:47:16.172 initial joint3 -219820
|
||||
2025-06-10 19:47:16.226 initial joint4 -25369363
|
||||
2025-06-10 19:47:16.242 initial joint1 -160231
|
||||
2025-06-10 19:47:16.311 initial joint2 2449952
|
||||
2025-06-10 19:47:16.359 initial joint3 -219824
|
||||
2025-06-10 19:47:16.407 initial joint4 -25369365
|
||||
2025-06-10 19:47:18.598 initial_thread initialized
|
||||
2025-06-10 19:47:18.598 servo enable
|
||||
2025-06-10 19:47:18.598 brake open
|
||||
2025-06-10 19:47:18.598 set_brake_state 0 1
|
||||
2025-06-10 19:47:18.808 robot initialized
|
||||
2025-06-10 19:47:19.373 get_scara_param -11.002100 84.112503 -75.470901 -1005.720276
|
||||
2025-06-10 19:47:19.373 get_scara_real_coor -11.002100 84.112396 -75.471901 -1005.720398
|
||||
2025-06-10 19:47:19.373 <09><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2><EFBFBD><EFBFBD>
|
||||
2025-06-10 19:47:19.373 position -160229.687500 2449954.250000 -219824.937500 -25369366.000000 0.000000 0.000000 0.000000 0.000000
|
||||
2025-06-10 19:47:19.373 speed 11002.099609 84112.500000 75470.898438 1045185.687500
|
||||
2025-06-10 19:47:19.373 set_first_position_after_initial
|
||||
2025-06-10 19:47:19.376 movej_old start_pos: -11.002100 84.112503 -75.470901 -1005.720276 end_pos: -11.002100 84.112503 -75.470901 -1005.720276 org_sp 10.000000 end_sp 10.000000
|
||||
2025-06-10 19:47:19.651 J3 Belt Meilage=40.899017km
|
||||
2025-06-10 20:30:00.225 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-10 20:30:00.225 robot connected
|
||||
2025-06-10 20:30:00.225 26
|
||||
2025-06-10 20:30:00.226 current generation=26
|
||||
2025-06-10 20:30:00.728 0x1a
|
||||
2025-06-10 20:30:01.610 initial joint2 2449960
|
||||
2025-06-10 20:30:01.610 C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\\j4_pid.txt do not exist
|
||||
2025-06-10 20:30:01.611 robot WritePID
|
||||
2025-06-10 20:30:01.920 initial joint1 -160238
|
||||
2025-06-10 20:30:01.982 initial joint2 2449958
|
||||
2025-06-10 20:30:02.029 initial joint3 -219828
|
||||
2025-06-10 20:30:02.076 initial joint4 -25369366
|
||||
2025-06-10 20:30:02.091 initial joint1 -160230
|
||||
2025-06-10 20:30:02.138 initial joint2 2449959
|
||||
2025-06-10 20:30:02.201 initial joint3 -219830
|
||||
2025-06-10 20:30:02.263 initial joint4 -25369366
|
||||
2025-06-10 20:30:02.278 initial joint1 -160223
|
||||
2025-06-10 20:30:02.340 initial joint2 2449961
|
||||
2025-06-10 20:30:02.401 initial joint3 -219833
|
||||
2025-06-10 20:30:02.462 initial joint4 -25369367
|
||||
2025-06-10 20:30:04.662 initial_thread initialized
|
||||
2025-06-10 20:30:04.662 servo enable
|
||||
2025-06-10 20:30:04.662 brake open
|
||||
2025-06-10 20:30:04.663 set_brake_state 0 1
|
||||
2025-06-10 20:30:04.864 robot initialized
|
||||
2025-06-10 20:30:05.418 get_scara_param -11.001600 84.112801 -75.474998 -1005.719727
|
||||
2025-06-10 20:30:05.418 get_scara_real_coor -11.001600 84.112801 -75.473602 -1005.719727
|
||||
2025-06-10 20:30:05.418 <09><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2><EFBFBD><EFBFBD>
|
||||
2025-06-10 20:30:05.418 position -160222.421875 2449962.750000 -219836.859375 -25369368.000000 0.000000 0.000000 0.000000 0.000000
|
||||
2025-06-10 20:30:05.419 speed 11001.600586 84112.796875 75475.000000 1045185.812500
|
||||
2025-06-10 20:30:05.419 set_first_position_after_initial
|
||||
2025-06-10 20:30:05.420 movej_old start_pos: -11.001600 84.112793 -75.474998 -1005.719727 end_pos: -11.001600 84.112701 -75.474998 -1005.719727 org_sp 10.000000 end_sp 0.701496
|
||||
2025-06-10 20:30:05.708 J3 Belt Meilage=40.899433km
|
||||
2025-06-10 20:35:58.853 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-10 20:35:58.853 robot connected
|
||||
2025-06-10 20:35:58.853 26
|
||||
2025-06-10 20:35:58.853 current generation=26
|
||||
2025-06-10 20:35:59.360 0x1a
|
||||
2025-06-10 20:36:00.257 initial joint2 2449965
|
||||
2025-06-10 20:36:00.257 C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\\j4_pid.txt do not exist
|
||||
2025-06-10 20:36:00.257 robot WritePID
|
||||
2025-06-10 20:36:00.568 initial joint1 -160221
|
||||
2025-06-10 20:36:00.615 initial joint2 2449966
|
||||
2025-06-10 20:36:00.661 initial joint3 -219842
|
||||
2025-06-10 20:36:00.708 initial joint4 -25369368
|
||||
2025-06-10 20:36:00.723 initial joint1 -160221
|
||||
2025-06-10 20:36:00.785 initial joint2 2449967
|
||||
2025-06-10 20:36:00.849 initial joint3 -219843
|
||||
2025-06-10 20:36:00.894 initial joint4 -25369369
|
||||
2025-06-10 20:36:00.910 initial joint1 -160221
|
||||
2025-06-10 20:36:00.956 initial joint2 2449969
|
||||
2025-06-10 20:36:01.004 initial joint3 -219843
|
||||
2025-06-10 20:36:01.066 initial joint4 -25369371
|
||||
2025-06-10 20:36:03.239 initial_thread initialized
|
||||
2025-06-10 20:36:03.240 servo enable
|
||||
2025-06-10 20:36:03.240 brake open
|
||||
2025-06-10 20:36:03.240 set_brake_state 0 1
|
||||
2025-06-10 20:36:03.454 robot initialized
|
||||
2025-06-10 20:36:04.012 get_scara_param -11.001500 84.112999 -75.478104 -1005.719482
|
||||
2025-06-10 20:36:04.013 get_scara_real_coor -11.001500 84.113098 -75.477402 -1005.719482
|
||||
2025-06-10 20:36:04.013 <09><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2><EFBFBD><EFBFBD>
|
||||
2025-06-10 20:36:04.013 position -160220.953125 2449968.750000 -219845.906250 -25369368.000000 0.000000 0.000000 0.000000 0.000000
|
||||
2025-06-10 20:36:04.013 speed 11001.500000 84113.000000 75478.101563 1045185.812500
|
||||
2025-06-10 20:36:04.013 set_first_position_after_initial
|
||||
2025-06-10 20:36:04.014 movej_old start_pos: -11.001500 84.112999 -75.478104 -1005.719482 end_pos: -11.001500 84.112999 -75.478104 -1005.719482 org_sp 10.000000 end_sp 10.000000
|
||||
2025-06-10 20:36:04.321 J3 Belt Meilage=40.899490km
|
||||
2025-06-10 20:39:42.977 SDK_VERSION_V2.0.0.29_Release
|
||||
2025-06-10 20:39:42.977 robot connected
|
||||
2025-06-10 20:39:42.977 26
|
||||
2025-06-10 20:39:42.977 current generation=26
|
||||
2025-06-10 20:39:43.480 0x1a
|
||||
2025-06-10 20:39:44.378 initial joint2 2449973
|
||||
2025-06-10 20:39:44.378 C:\Users\fusy_\source\repos\HitBotCSharpDemo_x64\HitBotCSharpDemo\HitBotCSharpDemo\bin\x64\Debug\\j4_pid.txt do not exist
|
||||
2025-06-10 20:39:44.379 robot WritePID
|
||||
2025-06-10 20:39:44.684 initial joint1 -160220
|
||||
2025-06-10 20:39:44.731 initial joint2 2449972
|
||||
2025-06-10 20:39:44.778 initial joint3 -219847
|
||||
2025-06-10 20:39:44.825 initial joint4 -25369370
|
||||
2025-06-10 20:39:44.839 initial joint1 -160220
|
||||
2025-06-10 20:39:44.886 initial joint2 2449973
|
||||
2025-06-10 20:39:44.947 initial joint3 -219850
|
||||
2025-06-10 20:39:45.009 initial joint4 -25369371
|
||||
2025-06-10 20:39:45.039 initial joint1 -160220
|
||||
2025-06-10 20:39:45.085 initial joint2 2449975
|
||||
2025-06-10 20:39:45.146 initial joint3 -219849
|
||||
2025-06-10 20:39:45.207 initial joint4 -25369372
|
||||
2025-06-10 20:39:47.365 initial_thread initialized
|
||||
2025-06-10 20:39:47.366 servo enable
|
||||
2025-06-10 20:39:47.366 brake open
|
||||
2025-06-10 20:39:47.366 set_brake_state 0 1
|
||||
2025-06-10 20:39:47.569 robot initialized
|
||||
2025-06-10 20:39:48.154 get_scara_param -11.001500 84.113197 -75.479797 -1005.719482
|
||||
2025-06-10 20:39:48.154 get_scara_real_coor -11.001300 84.113197 -75.479500 -1005.719421
|
||||
2025-06-10 20:39:48.155 <09><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2><EFBFBD><EFBFBD>
|
||||
2025-06-10 20:39:48.155 position -160220.953125 2449974.500000 -219850.843750 -25369370.000000 0.000000 0.000000 0.000000 0.000000
|
||||
2025-06-10 20:39:48.155 speed 11001.500000 84113.203125 75479.796875 1045185.875000
|
||||
2025-06-10 20:39:48.155 set_first_position_after_initial
|
||||
2025-06-10 20:39:48.156 movej_old start_pos: -11.001500 84.113197 -75.479797 -1005.719482 end_pos: -11.001500 84.113197 -75.479797 -1005.719482 org_sp 10.000000 end_sp 10.000000
|
||||
2025-06-10 20:39:48.447 J3 Belt Meilage=40.899525km
|
||||
|
||||
BIN
HitBotCSharpDemo/bin/x64/Debug/temp_detection_20250610195424.jpg
Normal file
BIN
HitBotCSharpDemo/bin/x64/Debug/temp_detection_20250610195424.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
HitBotCSharpDemo/bin/x64/Debug/temp_detection_20250610201343.jpg
Normal file
BIN
HitBotCSharpDemo/bin/x64/Debug/temp_detection_20250610201343.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
HitBotCSharpDemo/bin/x64/Debug/temp_detection_20250610203008.jpg
Normal file
BIN
HitBotCSharpDemo/bin/x64/Debug/temp_detection_20250610203008.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user