|
|
@@ -62,7 +62,11 @@ namespace TeamAAS_VP.Services
|
|
|
Matrix<double> RobotCameraRotationMatrix = null;
|
|
|
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ bool isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -109,7 +113,11 @@ namespace TeamAAS_VP.Services
|
|
|
RPoint RobotU = calibrationInfo.CenterPoint.Clone();
|
|
|
RobotU.U += (float)calibrationInfo.Angle;
|
|
|
//移动机器人中心点
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -118,7 +126,11 @@ namespace TeamAAS_VP.Services
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
|
|
|
//机器人U轴旋转
|
|
|
- await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -127,7 +139,11 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -149,7 +165,11 @@ namespace TeamAAS_VP.Services
|
|
|
double offsety = (P0.Y - curPixel.Y) * pixelScaleY;
|
|
|
var pos = RobotCameraRotationMatrix.Inverse() * Vector<double>.Build.Dense(new double[] { offsetx, offsety });
|
|
|
//移动机器人取标定块
|
|
|
- await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -160,7 +180,11 @@ namespace TeamAAS_VP.Services
|
|
|
RobotU.X += (float)pos[0];
|
|
|
RobotU.Y += (float)pos[1];
|
|
|
//机器人移动
|
|
|
- await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -169,7 +193,11 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -187,7 +215,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (Math.Abs(offsetx) < 1 && Math.Abs(offsetx) < 1)
|
|
|
{
|
|
|
//移动机器人取标定块
|
|
|
- await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -195,7 +227,11 @@ namespace TeamAAS_VP.Services
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
IsFinish = true;
|
|
|
break;
|
|
|
}
|
|
|
@@ -247,7 +283,11 @@ namespace TeamAAS_VP.Services
|
|
|
Matrix<double> RobotCameraRotationMatrix = null;
|
|
|
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ bool isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
|
|
|
//计算相机与机器人坐标系的旋转矩阵
|
|
|
var robotCameraRotationMatrix = await AutoIdentifyRobotCameraRotationMatrix(calibrationInfo, robot, cancellationToken);
|
|
|
@@ -272,7 +312,11 @@ namespace TeamAAS_VP.Services
|
|
|
RobotU.U += (float)calibrationInfo.Angle;
|
|
|
|
|
|
//机器人U轴旋转
|
|
|
- await robot.CalibMotionAsync(RobotU, RobotU.Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotU, RobotU.Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -314,7 +358,11 @@ namespace TeamAAS_VP.Services
|
|
|
calibrationInfo.Tool.Y = toolCoord.Y;
|
|
|
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, calibrationInfo.CenterPoint.Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, calibrationInfo.CenterPoint.Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
|
|
|
return (true, RobotCameraRotationMatrix, calibrationInfo.Tool.X, calibrationInfo.Tool.Y, pixelScaleX, pixelScaleY);
|
|
|
}
|
|
|
@@ -334,7 +382,11 @@ namespace TeamAAS_VP.Services
|
|
|
Matrix<double> RobotCameraRotationMatrix = null;
|
|
|
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ bool isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
|
|
|
if (calibrationInfo.Pick.PickPlaceModel == Enums.PickPlaceModel.Inhal)
|
|
|
{
|
|
|
@@ -380,7 +432,11 @@ namespace TeamAAS_VP.Services
|
|
|
RobotU.U += (float)calibrationInfo.Angle;
|
|
|
|
|
|
//机器人U轴旋转
|
|
|
- await robot.CalibMotionAsync(RobotU, RobotU.Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotU, RobotU.Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -422,7 +478,11 @@ namespace TeamAAS_VP.Services
|
|
|
calibrationInfo.Tool.Y = toolCoord.Y;
|
|
|
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, calibrationInfo.CenterPoint.Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, calibrationInfo.CenterPoint.Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
|
|
|
return (true, RobotCameraRotationMatrix, calibrationInfo.Tool.X, calibrationInfo.Tool.Y, pixelScaleX, pixelScaleY);
|
|
|
}
|
|
|
@@ -493,18 +553,27 @@ namespace TeamAAS_VP.Services
|
|
|
{
|
|
|
//移动距离,单位mm
|
|
|
float distance = ((float)calibrationInfo.Height) / 3;
|
|
|
+ bool isSuccess = false;
|
|
|
|
|
|
//-------------------------------------------P0-----------------------------------
|
|
|
//移动机器人至中心点
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, calibrationInfo.CenterPoint.Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, calibrationInfo.CenterPoint.Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -517,7 +586,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//相机拍照并处理图像
|
|
|
@@ -532,7 +605,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
//移动机器人至P0
|
|
|
- await robot.CalibMotionAsync(RobotP0, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotP0, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -540,7 +617,11 @@ namespace TeamAAS_VP.Services
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
//移动机器人至P1
|
|
|
- await robot.CalibMotionAsync(RobotP1, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotP1, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -548,12 +629,20 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//移动机器人至P1
|
|
|
- await robot.CalibMotionAsync(RobotP1, RobotP1.Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotP1, RobotP1.Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
@@ -573,7 +662,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
//移动机器人至P1
|
|
|
- await robot.CalibMotionAsync(RobotP1, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotP1, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -581,7 +674,11 @@ namespace TeamAAS_VP.Services
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
//移动机器人至P2
|
|
|
- await robot.CalibMotionAsync(RobotP2, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotP2, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -589,12 +686,20 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//移动机器人至P2
|
|
|
- await robot.CalibMotionAsync(RobotP2, RobotP2.Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotP2, RobotP2.Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
@@ -614,7 +719,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
//移动机器人至P2
|
|
|
- await robot.CalibMotionAsync(RobotP2, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotP2, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -622,7 +731,11 @@ namespace TeamAAS_VP.Services
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
//移动机器人至P0
|
|
|
- await robot.CalibMotionAsync(RobotP0, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotP0, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -630,12 +743,20 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//移动机器人至P0
|
|
|
- await robot.CalibMotionAsync(RobotP0, RobotP0.Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(RobotP0, RobotP0.Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0);
|
|
|
+ }
|
|
|
}
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
@@ -709,6 +830,7 @@ namespace TeamAAS_VP.Services
|
|
|
//中心点像素坐标
|
|
|
PointF P0 = new PointF((float)(result.ImageWidth / 2), (float)(result.ImageHeight / 2));
|
|
|
|
|
|
+ bool isSuccess = false;
|
|
|
var curpos = robot.GetRobotPos();
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
{
|
|
|
@@ -719,7 +841,11 @@ namespace TeamAAS_VP.Services
|
|
|
curpos.X += (float)pos[0];
|
|
|
curpos.Y += (float)pos[1];
|
|
|
//机器人移动
|
|
|
- await robot.CalibMotionAsync(curpos, curpos.Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(curpos, curpos.Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, 0, 0, 0);
|
|
|
+ }
|
|
|
await Task.Delay(200);
|
|
|
|
|
|
result = await CaptureAndProcessCallback();
|
|
|
@@ -777,12 +903,17 @@ namespace TeamAAS_VP.Services
|
|
|
//发送校准的参数
|
|
|
await robot.CalibParameAsync(calibrationInfo.Pick, calibrationInfo.Speed, calibrationInfo.Accel, calibrationInfo.Power, calibrationInfo.WaitSuction, calibrationInfo.WaitBlow);
|
|
|
|
|
|
+ bool isSuccess = false;
|
|
|
var P0 = Vector<double>.Build.Dense(new double[] { calibrationInfo.CenterPoint.X, calibrationInfo.CenterPoint.Y });
|
|
|
if (robot.Brand == Enums.RobotBrand.XYZ_Platform)
|
|
|
{
|
|
|
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
@@ -811,7 +942,11 @@ namespace TeamAAS_VP.Services
|
|
|
else if (calibrationInfo.CameraMount== Enums.CameraMount.MobileDown_XYPlatform)
|
|
|
{
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
@@ -1002,7 +1137,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.MobileJ4)
|
|
|
{
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
@@ -1028,7 +1167,11 @@ namespace TeamAAS_VP.Services
|
|
|
//移动机器人至i
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
- await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
@@ -1036,11 +1179,19 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- await robot.CalibMotionAsync(rPoints[i], rPoints[i].Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(rPoints[i], rPoints[i].Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
}
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
@@ -1059,7 +1210,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至i
|
|
|
- await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
@@ -1082,7 +1237,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
@@ -1321,13 +1480,18 @@ namespace TeamAAS_VP.Services
|
|
|
Tool = calibrationInfo.CenterPoint.Tool
|
|
|
});
|
|
|
|
|
|
+ bool isSuccess = false;
|
|
|
List<Vector<double>> TestPos = new List<Vector<double>>();
|
|
|
for (int i = 0; i < rPoints.Count; i++)
|
|
|
{
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至i
|
|
|
- await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null);
|
|
|
+ }
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null);
|
|
|
@@ -1335,12 +1499,20 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//移动机器人至i
|
|
|
- await robot.CalibMotionAsync(rPoints[i], rPoints[i].Z);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(rPoints[i], rPoints[i].Z);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null);
|
|
|
+ }
|
|
|
}
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
@@ -1361,7 +1533,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至i
|
|
|
- await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null);
|
|
|
+ }
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
}
|
|
|
@@ -1375,7 +1551,11 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ isSuccess = await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ if (!isSuccess)
|
|
|
+ {
|
|
|
+ return (false, null);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//RMS(均方根值) 标定偏差
|