|
|
@@ -14,6 +14,7 @@ using System.Threading.Tasks;
|
|
|
using System.Windows;
|
|
|
using TeamAAS_VP.Controls;
|
|
|
using TeamAAS_VP.Core;
|
|
|
+using TeamAAS_VP.Core.Robots;
|
|
|
using TeamAAS_VP.Interfaces;
|
|
|
using TeamAAS_VP.Models;
|
|
|
using TeamAAS_VP.Models.Calibration;
|
|
|
@@ -62,7 +63,7 @@ namespace TeamAAS_VP.Services
|
|
|
Matrix<double> RobotCameraRotationMatrix = null;
|
|
|
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -109,7 +110,7 @@ namespace TeamAAS_VP.Services
|
|
|
RPoint RobotU = calibrationInfo.CenterPoint.Clone();
|
|
|
RobotU.U += (float)calibrationInfo.Angle;
|
|
|
//移动机器人中心点
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -118,7 +119,7 @@ namespace TeamAAS_VP.Services
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
|
|
|
//机器人U轴旋转
|
|
|
- await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ await robot.CalibMotionAsync(RobotU, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -127,7 +128,7 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -149,7 +150,7 @@ 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);
|
|
|
+ await robot.CalibMotionAsync(RobotU, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -160,7 +161,7 @@ namespace TeamAAS_VP.Services
|
|
|
RobotU.X += (float)pos[0];
|
|
|
RobotU.Y += (float)pos[1];
|
|
|
//机器人移动
|
|
|
- await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ await robot.CalibMotionAsync(RobotU, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -169,7 +170,7 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -187,7 +188,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (Math.Abs(offsetx) < 1 && Math.Abs(offsetx) < 1)
|
|
|
{
|
|
|
//移动机器人取标定块
|
|
|
- await robot.CalibMotionAsync(RobotU, 0);
|
|
|
+ await robot.CalibMotionAsync(RobotU, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -195,7 +196,7 @@ namespace TeamAAS_VP.Services
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
IsFinish = true;
|
|
|
break;
|
|
|
}
|
|
|
@@ -247,7 +248,7 @@ namespace TeamAAS_VP.Services
|
|
|
Matrix<double> RobotCameraRotationMatrix = null;
|
|
|
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
|
|
|
|
|
|
//计算相机与机器人坐标系的旋转矩阵
|
|
|
var robotCameraRotationMatrix = await AutoIdentifyRobotCameraRotationMatrix(calibrationInfo, robot, cancellationToken);
|
|
|
@@ -334,7 +335,7 @@ namespace TeamAAS_VP.Services
|
|
|
Matrix<double> RobotCameraRotationMatrix = null;
|
|
|
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
|
|
|
|
|
|
if (calibrationInfo.Pick.PickPlaceModel == Enums.PickPlaceModel.Inhal)
|
|
|
{
|
|
|
@@ -427,6 +428,161 @@ namespace TeamAAS_VP.Services
|
|
|
return (true, RobotCameraRotationMatrix, calibrationInfo.Tool.X, calibrationInfo.Tool.Y, pixelScaleX, pixelScaleY);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 独立模组移动向下相机校准工具坐标
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="calibrationInfo"></param>
|
|
|
+ /// <param name="robot"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<(bool IsSuccess, Matrix<double> RotationMatrix, double ToolX, double ToolY, double PixelScaleX, double PixelScaleY)> CalibrateIndependentXYPlatformMovingDownCameraTool(CalibrationInfo calibrationInfo, IRobot robot, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ double pixelScaleX = 0;
|
|
|
+ double pixelScaleY = 0;
|
|
|
+ Matrix<double> RobotCameraRotationMatrix = null;
|
|
|
+
|
|
|
+ //移动机器人至待机位置
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
+ if (cancellationToken.IsCancellationRequested)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (calibrationInfo.Pick.PickPlaceModel == Enums.PickPlaceModel.Inhal)
|
|
|
+ {
|
|
|
+ //打开吸气
|
|
|
+ await robot.CalibOutIOAsync(true);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //张开夹爪
|
|
|
+ //夹爪张开为false,夹爪闭合为True
|
|
|
+ await robot.CalibOutIOAsync(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //移动独立模组至待机点
|
|
|
+ bool isFinished = await ((XYZU_Robot)robot).WaitCameraMoveFinishedAsync(calibrationInfo.CameraMotionModuleIndex, calibrationInfo.IndependentDownCameraMotionModulePoint);
|
|
|
+ if (!isFinished)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ var view = new ShowMessage(Lang.提示, Lang.请将校准块放置在吸嘴中心);
|
|
|
+ var result = await DialogHost.Show(view, "CalibToolDialog", null, null, null);
|
|
|
+ if (!((bool)result)) return (false, null, 0, 0, 0, 0);
|
|
|
+ if (calibrationInfo.Pick.PickPlaceModel == Enums.PickPlaceModel.Clamp)
|
|
|
+ {
|
|
|
+ //夹紧夹爪
|
|
|
+ await robot.CalibOutIOAsync(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ //计算相机与机器人坐标系的旋转矩阵
|
|
|
+ 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;
|
|
|
+ //相机拍照并处理图像
|
|
|
+ var photoResult = await CaptureAndProcessCallback();
|
|
|
+ if (!photoResult.IsSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+ PointF P0 = new PointF((float)(photoResult.X), (float)(photoResult.Y));
|
|
|
+
|
|
|
+ RPoint RobotU = calibrationInfo.CenterPoint.Clone();
|
|
|
+ RobotU.U += (float)calibrationInfo.Angle;
|
|
|
+ //移动机器人中心点
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
|
|
|
+ if (cancellationToken.IsCancellationRequested)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //机器人U轴旋转
|
|
|
+ await robot.CalibMotionAsync(RobotU, null);
|
|
|
+ if (cancellationToken.IsCancellationRequested)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //相机拍照并处理图像
|
|
|
+ photoResult = await CaptureAndProcessCallback();
|
|
|
+ if (!photoResult.IsSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+ PointF curPixel = new PointF((float)(photoResult.X), (float)(photoResult.Y));
|
|
|
+
|
|
|
+ bool IsFinish = false;
|
|
|
+ for (int i = 0; i < 10; i++)
|
|
|
+ {
|
|
|
+ //计算需要移动的偏移量,目的是逼近中心点
|
|
|
+ double offsetx = (P0.X - curPixel.X) * pixelScaleX;
|
|
|
+ double offsety = (P0.Y - curPixel.Y) * pixelScaleY;
|
|
|
+ var pos = RobotCameraRotationMatrix.Inverse() * Vector<double>.Build.Dense(new double[] { offsetx, offsety });
|
|
|
+
|
|
|
+ RobotU.X += (float)pos[0];
|
|
|
+ RobotU.Y += (float)pos[1];
|
|
|
+ //机器人移动
|
|
|
+ await robot.CalibMotionAsync(RobotU, null);
|
|
|
+ if (cancellationToken.IsCancellationRequested)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ photoResult = await CaptureAndProcessCallback();
|
|
|
+ if (!photoResult.IsSuccess)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+ curPixel = new PointF((float)(photoResult.X), (float)(photoResult.Y));
|
|
|
+ offsetx = P0.X - curPixel.X;
|
|
|
+ offsety = P0.Y - curPixel.Y;
|
|
|
+ //await Console.Out.WriteLineAsync($"移动后的差异:{offsetx},{offsety}");
|
|
|
+ if (Math.Abs(offsetx) < 1 && Math.Abs(offsetx) < 1)
|
|
|
+ {
|
|
|
+ //移动机器人至待机位置
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
+ IsFinish = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (cancellationToken.IsCancellationRequested)
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (IsFinish)
|
|
|
+ {
|
|
|
+ Vector<double> p0 = Vector<double>.Build.Dense(new double[] { calibrationInfo.CenterPoint.X, calibrationInfo.CenterPoint.Y });
|
|
|
+ Vector<double> p1 = Vector<double>.Build.Dense(new double[] { RobotU.X, RobotU.Y });
|
|
|
+ ToolCoord toolCoord = new ToolCoord();
|
|
|
+ double u1 = calibrationInfo.CenterPoint.U;
|
|
|
+ double u2 = RobotU.U;
|
|
|
+ if (robot.Brand == Enums.RobotBrand.Schneider)
|
|
|
+ {
|
|
|
+ u1 *= -1;
|
|
|
+ u2 *= -1;
|
|
|
+ }
|
|
|
+ toolCoord.ComputeTool(p0, p1, u1, u2);
|
|
|
+ if (calibrationInfo.Tool == null)
|
|
|
+ {
|
|
|
+ calibrationInfo.Tool = new RobotTool();
|
|
|
+ }
|
|
|
+ calibrationInfo.Tool.X = toolCoord.X;
|
|
|
+ calibrationInfo.Tool.Y = toolCoord.Y;
|
|
|
+ return (true, RobotCameraRotationMatrix, calibrationInfo.Tool.X, calibrationInfo.Tool.Y, pixelScaleX, pixelScaleY);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return (false, null, 0, 0, 0, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 通过未标定的相机校准工具坐标。
|
|
|
/// 当相机内参未知或未可靠标定时,通过已知机器人位姿与图像特征的对应关系反推工具坐标与像素尺度。
|
|
|
@@ -459,6 +615,10 @@ namespace TeamAAS_VP.Services
|
|
|
{
|
|
|
calibresult = await CalibrateJ4MovingDownCameraTool(calibrationInfo, robot, cancellationToken);
|
|
|
}
|
|
|
+ else if (calibrationInfo.CameraMount == Enums.CameraMount.MobileDown_IndependentXYPlatform)
|
|
|
+ {
|
|
|
+ calibresult = await CalibrateIndependentXYPlatformMovingDownCameraTool(calibrationInfo, robot, cancellationToken);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
return (false, null, 0, 0, 0, 0);
|
|
|
@@ -498,7 +658,7 @@ namespace TeamAAS_VP.Services
|
|
|
//移动机器人至中心点
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
}
|
|
|
@@ -517,7 +677,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
}
|
|
|
|
|
|
//相机拍照并处理图像
|
|
|
@@ -532,7 +692,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
//移动机器人至P0
|
|
|
- await robot.CalibMotionAsync(RobotP0, 0);
|
|
|
+ await robot.CalibMotionAsync(RobotP0, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -540,7 +700,7 @@ namespace TeamAAS_VP.Services
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
//移动机器人至P1
|
|
|
- await robot.CalibMotionAsync(RobotP1, 0);
|
|
|
+ await robot.CalibMotionAsync(RobotP1, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -548,7 +708,7 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -573,7 +733,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
//移动机器人至P1
|
|
|
- await robot.CalibMotionAsync(RobotP1, 0);
|
|
|
+ await robot.CalibMotionAsync(RobotP1, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -581,7 +741,7 @@ namespace TeamAAS_VP.Services
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
//移动机器人至P2
|
|
|
- await robot.CalibMotionAsync(RobotP2, 0);
|
|
|
+ await robot.CalibMotionAsync(RobotP2, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -589,7 +749,7 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -614,7 +774,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown && !calibrationInfo.FixedDownCameraNoReturnToHome)
|
|
|
{
|
|
|
//移动机器人至P2
|
|
|
- await robot.CalibMotionAsync(RobotP2, 0);
|
|
|
+ await robot.CalibMotionAsync(RobotP2, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -622,7 +782,7 @@ namespace TeamAAS_VP.Services
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
//移动机器人至P0
|
|
|
- await robot.CalibMotionAsync(RobotP0, 0);
|
|
|
+ await robot.CalibMotionAsync(RobotP0, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, 0, 0);
|
|
|
@@ -630,7 +790,7 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -773,7 +933,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo == null) return (false, null, null, null);
|
|
|
if (robot == null || !robot.IsConnected) return (false, null, null, null);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//发送校准的参数
|
|
|
await robot.CalibParameAsync(calibrationInfo.Pick, calibrationInfo.Speed, calibrationInfo.Accel, calibrationInfo.Power, calibrationInfo.WaitSuction, calibrationInfo.WaitBlow);
|
|
|
|
|
|
@@ -782,7 +942,7 @@ namespace TeamAAS_VP.Services
|
|
|
{
|
|
|
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
@@ -808,14 +968,15 @@ namespace TeamAAS_VP.Services
|
|
|
|
|
|
calibrationInfo.RobotCameraRotationMatrix = robotCameraRotationMatrix.RotationMatrix.ToArray();
|
|
|
}
|
|
|
- else if (calibrationInfo.CameraMount== Enums.CameraMount.MobileDown_XYPlatform)
|
|
|
+ else if (calibrationInfo.CameraMount == Enums.CameraMount.MobileDown_XYPlatform)
|
|
|
{
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
}
|
|
|
+
|
|
|
//计算相机与机器人坐标系的旋转矩阵
|
|
|
var robotCameraRotationMatrix = await AutoIdentifyRobotCameraRotationMatrix(calibrationInfo, robot, cancellationToken);
|
|
|
if (!robotCameraRotationMatrix.IsSuccess)
|
|
|
@@ -834,6 +995,15 @@ namespace TeamAAS_VP.Services
|
|
|
|
|
|
calibrationInfo.RobotCameraRotationMatrix = robotCameraRotationMatrix.RotationMatrix.ToArray();
|
|
|
}
|
|
|
+ else if (calibrationInfo.CameraMount == Enums.CameraMount.MobileDown_IndependentXYPlatform)
|
|
|
+ {
|
|
|
+ //移动独立模组至待机点
|
|
|
+ bool isFinished = await ((XYZU_Robot)robot).WaitCameraMoveFinishedAsync(calibrationInfo.CameraMotionModuleIndex, calibrationInfo.IndependentDownCameraMotionModulePoint);
|
|
|
+ if (!isFinished)
|
|
|
+ {
|
|
|
+ return (false, null, null, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
double IntervalX = calibrationInfo.Width / 2;
|
|
|
double IntervalY = calibrationInfo.Height / 2;
|
|
|
@@ -1002,7 +1172,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.MobileJ4)
|
|
|
{
|
|
|
//移动机器人至中心位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
@@ -1028,7 +1198,7 @@ namespace TeamAAS_VP.Services
|
|
|
//移动机器人至i
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
- await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ await robot.CalibMotionAsync(rPoints[i], null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
@@ -1036,7 +1206,7 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1059,7 +1229,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至i
|
|
|
- await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ await robot.CalibMotionAsync(rPoints[i], null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null, null, null);
|
|
|
@@ -1082,7 +1252,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
}
|
|
|
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
@@ -1327,7 +1497,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至i
|
|
|
- await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ await robot.CalibMotionAsync(rPoints[i], null);
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
{
|
|
|
return (false, null);
|
|
|
@@ -1335,7 +1505,7 @@ namespace TeamAAS_VP.Services
|
|
|
//关闭吸气
|
|
|
await robot.CalibOutIOAsync(false);
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1361,7 +1531,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至i
|
|
|
- await robot.CalibMotionAsync(rPoints[i], 0);
|
|
|
+ await robot.CalibMotionAsync(rPoints[i], null);
|
|
|
//打开吸气
|
|
|
await robot.CalibOutIOAsync(true);
|
|
|
}
|
|
|
@@ -1375,7 +1545,7 @@ namespace TeamAAS_VP.Services
|
|
|
if (calibrationInfo.CameraMount == Enums.CameraMount.FixedDown)
|
|
|
{
|
|
|
//移动机器人至待机位置
|
|
|
- await robot.CalibMotionAsync(calibrationInfo.HomePoint, 0);
|
|
|
+ await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
|
|
|
}
|
|
|
|
|
|
//RMS(均方根值) 标定偏差
|
|
|
@@ -1484,6 +1654,18 @@ namespace TeamAAS_VP.Services
|
|
|
return (true, calibrationTestResult);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 独立模组相机计算独立模组步进坐标系与绝对坐标系的刚体变换矩阵
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="markPoint"></param>
|
|
|
+ /// <param name="calibPoints"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public (bool IsSuccess, double[,] TransformationMatrix) CalculateIndependentCameraRigidTransformationMatrix(CalibrationInfo calibrationInfo, IRobot robot, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ //模组移动Mark至相机中心点,此时Mark的绝对坐标是:P0,步进坐标:P1
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public void Dispose()
|
|
|
{
|
|
|
GC.SuppressFinalize(this);
|