|
|
@@ -357,14 +357,14 @@ namespace TeamAAS_VP.Services
|
|
|
}
|
|
|
|
|
|
//计算相机与机器人坐标系的旋转矩阵
|
|
|
- var robotCameraRotationMatrix= await AutoIdentifyRobotCameraRotationMatrix(calibrationInfo, robot, cancellationToken);
|
|
|
+ var robotCameraRotationMatrix = await AutoIdentifyRobotCameraRotationMatrix(calibrationInfo, robot, cancellationToken);
|
|
|
if (!robotCameraRotationMatrix.IsSuccess)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
}
|
|
|
- pixelScaleX= robotCameraRotationMatrix.PixelScaleX;
|
|
|
- pixelScaleY= robotCameraRotationMatrix.PixelScaleY;
|
|
|
- RobotCameraRotationMatrix= robotCameraRotationMatrix.Item2;
|
|
|
+ pixelScaleX = robotCameraRotationMatrix.PixelScaleX;
|
|
|
+ pixelScaleY = robotCameraRotationMatrix.PixelScaleY;
|
|
|
+ RobotCameraRotationMatrix = robotCameraRotationMatrix.Item2;
|
|
|
|
|
|
//自动移动机器人至图像中心点位置
|
|
|
var autoMoveResult = await AutoMoveRobotToImageCenter(robot, RobotCameraRotationMatrix, pixelScaleX, pixelScaleY, cancellationToken);
|
|
|
@@ -372,8 +372,8 @@ namespace TeamAAS_VP.Services
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
}
|
|
|
- calibrationInfo.CenterPoint.X= (float)autoMoveResult.X;
|
|
|
- calibrationInfo.CenterPoint.Y= (float)autoMoveResult.Y;
|
|
|
+ calibrationInfo.CenterPoint.X = (float)autoMoveResult.X;
|
|
|
+ calibrationInfo.CenterPoint.Y = (float)autoMoveResult.Y;
|
|
|
|
|
|
|
|
|
RPoint RobotU = calibrationInfo.CenterPoint.Clone();
|
|
|
@@ -381,7 +381,7 @@ namespace TeamAAS_VP.Services
|
|
|
|
|
|
//机器人U轴旋转
|
|
|
await robot.CalibMotionAsync(RobotU, RobotU.Z);
|
|
|
- if(cancellationToken.IsCancellationRequested)
|
|
|
+ if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
}
|
|
|
@@ -449,7 +449,7 @@ namespace TeamAAS_VP.Services
|
|
|
(bool IsSuccess, Matrix<double> RotationMatrix, double ToolX, double ToolY, double PixelScaleX, double PixelScaleY) calibresult;
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
- calibresult = await CalibrateFixedDownCameraTool(calibrationInfo,robot,cancellationToken);
|
|
|
+ calibresult = await CalibrateFixedDownCameraTool(calibrationInfo, robot, cancellationToken);
|
|
|
}
|
|
|
else if (calibrationInfo.CameraMount == Enums.CameraMount.FixedUp)
|
|
|
{
|
|
|
@@ -467,10 +467,10 @@ namespace TeamAAS_VP.Services
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
}
|
|
|
-
|
|
|
- pixelScaleX= calibresult.PixelScaleX;
|
|
|
- pixelScaleY= calibresult.PixelScaleY;
|
|
|
- RobotCameraRotationMatrix= calibresult.RotationMatrix;
|
|
|
+
|
|
|
+ pixelScaleX = calibresult.PixelScaleX;
|
|
|
+ pixelScaleY = calibresult.PixelScaleY;
|
|
|
+ RobotCameraRotationMatrix = calibresult.RotationMatrix;
|
|
|
|
|
|
return (true, RobotCameraRotationMatrix, calibresult.ToolX, calibresult.ToolY, pixelScaleX, pixelScaleY);
|
|
|
}
|
|
|
@@ -533,7 +533,7 @@ namespace TeamAAS_VP.Services
|
|
|
{
|
|
|
//移动机器人至P0
|
|
|
await robot.CalibMotionAsync(RobotP0, 0);
|
|
|
- if(cancellationToken.IsCancellationRequested)
|
|
|
+ if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
}
|
|
|
@@ -818,6 +818,32 @@ namespace TeamAAS_VP.Services
|
|
|
|
|
|
calibrationInfo.RobotCameraRotationMatrix = robotCameraRotationMatrix.RotationMatrix.ToArray();
|
|
|
}
|
|
|
+ else if (calibrationInfo.CameraMount== Enums.CameraMount.MobileDown_XYPlatform && calibrationInfo.CalibTechP0Mode== Enums.CalibTechP0Mode.CameraAutoFindP0)
|
|
|
+ {
|
|
|
+ //移动机器人至中心位置
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ if (cancellationToken.IsCancellationRequested)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
+ //计算相机与机器人坐标系的旋转矩阵
|
|
|
+ var robotCameraRotationMatrix = await AutoIdentifyRobotCameraRotationMatrix(calibrationInfo, robot, cancellationToken);
|
|
|
+ if (!robotCameraRotationMatrix.IsSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
+ //自动移动机器人至图像中心点位置
|
|
|
+ var autoMoveResult = await AutoMoveRobotToImageCenter(robot, robotCameraRotationMatrix.RotationMatrix, robotCameraRotationMatrix.PixelScaleX, robotCameraRotationMatrix.PixelScaleY, cancellationToken);
|
|
|
+ if (!autoMoveResult.IsSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
+ calibrationInfo.CenterPoint.X = (float)autoMoveResult.X;
|
|
|
+ calibrationInfo.CenterPoint.Y = (float)autoMoveResult.Y;
|
|
|
+ calibrationInfo.MarkPoint = calibrationInfo.CenterPoint.Clone();
|
|
|
+
|
|
|
+ calibrationInfo.RobotCameraRotationMatrix = robotCameraRotationMatrix.RotationMatrix.ToArray();
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 机器人与相机之间的旋转矩阵
|