|
|
@@ -127,6 +127,7 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
IsExecuting= true;
|
|
|
try
|
|
|
{
|
|
|
+
|
|
|
if (Robot == null || !Robot.IsConnected)
|
|
|
{
|
|
|
_eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = "机器人未连接,无法执行取料拍照点位矫正!", Duration = 1 });
|
|
|
@@ -180,7 +181,7 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ _cts = new CancellationTokenSource();
|
|
|
//移动机器人至拍照点位,拍照
|
|
|
var rpoint = new RPoint()
|
|
|
{
|
|
|
@@ -206,11 +207,11 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
//移动机器人至拍照点位,拍照
|
|
|
rpoint = new RPoint()
|
|
|
{
|
|
|
- X = screwCameraPoint[0].X_Position,
|
|
|
- Y = screwCameraPoint[0].Y_Position,
|
|
|
- Z = screwCameraPoint[0].Z_Position_Start,
|
|
|
- U = screwCameraPoint[0].U_Position,
|
|
|
- V = screwCameraPoint[0].R_Position,
|
|
|
+ X = screwCameraPoint[1].X_Position,
|
|
|
+ Y = screwCameraPoint[1].Y_Position,
|
|
|
+ Z = screwCameraPoint[1].Z_Position_Start,
|
|
|
+ U = screwCameraPoint[1].U_Position,
|
|
|
+ V = screwCameraPoint[1].R_Position,
|
|
|
};
|
|
|
await Robot.CalibMotionAsync(rpoint, 0);
|
|
|
if (_cts.IsCancellationRequested)
|
|
|
@@ -248,13 +249,13 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
|
|
|
for (int i = 0; i < product.ScrewPoints.Count; i++)
|
|
|
{
|
|
|
- var localPoint = new PointF(product.ScrewCameraPoints[i].X_Position, product.ScrewCameraPoints[i].Y_Position);
|
|
|
+ var localPoint = new PointF(product.ScrewPoints[i].X_Position, product.ScrewPoints[i].Y_Position);
|
|
|
var worldPoint = local.ToOldCoord(localPoint.X, localPoint.Y);
|
|
|
var point = product.ScrewCameraPoints[i].Clone();
|
|
|
point.X_Position = (float)worldPoint[0];
|
|
|
point.Y_Position = (float)worldPoint[1];
|
|
|
//计算当前点的高度与screwCameraLocalPoint1的Z轴之间的偏差
|
|
|
- var deltaZ = product.ScrewPoints[i].Z_Position_Start - screwCameraPoint[0].Z_Position_Start;
|
|
|
+ var deltaZ = product.ScrewPoints[i].Z_Position_Start - screwCameraLocalPoint1.Z_Position_Start;
|
|
|
|
|
|
//计算相机去拍照点位
|
|
|
point.X_Position+= cameraOffsetX;
|
|
|
@@ -292,10 +293,10 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- catch (Exception)
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
-
|
|
|
- throw;
|
|
|
+ LogHelper.WriteLogError("通过移动相机自动校准锁付点位是出错!",ex);
|
|
|
+ _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
|
|
|
}
|
|
|
finally
|
|
|
{
|