徐孝锋 пре 8 месеци
родитељ
комит
94e049b83e

+ 15 - 13
TeamAAS-VM/Services/CameraCalibrationService.cs

@@ -773,17 +773,7 @@ namespace TeamAAS_VP.Services
             if (calibrationInfo == null) return (false, null, null, null);
             if (robot == null || !robot.IsConnected) return (false, null, null, null);
 
-            double IntervalX = calibrationInfo.Width / 2;
-            double IntervalY = calibrationInfo.Height / 2;
-            Vector<double> P1 = Vector<double>.Build.Dense(new double[] { -IntervalX, -IntervalY });
-            Vector<double> P2 = Vector<double>.Build.Dense(new double[] { 0, -IntervalY });
-            Vector<double> P3 = Vector<double>.Build.Dense(new double[] { IntervalX, -IntervalY });
-            Vector<double> P4 = Vector<double>.Build.Dense(new double[] { IntervalX, 0 });
-            Vector<double> P5 = Vector<double>.Build.Dense(new double[] { 0, 0 });
-            Vector<double> P6 = Vector<double>.Build.Dense(new double[] { -IntervalX, 0 });
-            Vector<double> P7 = Vector<double>.Build.Dense(new double[] { -IntervalX, IntervalY });
-            Vector<double> P8 = Vector<double>.Build.Dense(new double[] { 0, IntervalY });
-            Vector<double> P9 = Vector<double>.Build.Dense(new double[] { IntervalX, IntervalY });
+            
             //发送校准的参数
             await robot.CalibParameAsync(calibrationInfo.Pick, calibrationInfo.Speed, calibrationInfo.Accel, calibrationInfo.Power, calibrationInfo.WaitSuction, calibrationInfo.WaitBlow);
 
@@ -818,7 +808,7 @@ namespace TeamAAS_VP.Services
 
                 calibrationInfo.RobotCameraRotationMatrix = robotCameraRotationMatrix.RotationMatrix.ToArray();
             }
-            else if (calibrationInfo.CameraMount== Enums.CameraMount.MobileDown_XYPlatform && calibrationInfo.CalibTechP0Mode== Enums.CalibTechP0Mode.CameraAutoFindP0)
+            else if (calibrationInfo.CameraMount== Enums.CameraMount.MobileDown_XYPlatform)
             {
                 //移动机器人至中心位置
                 await robot.CalibMotionAsync(calibrationInfo.CenterPoint, 0);
@@ -840,11 +830,23 @@ namespace TeamAAS_VP.Services
                 }
                 calibrationInfo.CenterPoint.X = (float)autoMoveResult.X;
                 calibrationInfo.CenterPoint.Y = (float)autoMoveResult.Y;
-                calibrationInfo.MarkPoint = calibrationInfo.CenterPoint.Clone();
+                //calibrationInfo.MarkPoint = calibrationInfo.CenterPoint.Clone();
 
                 calibrationInfo.RobotCameraRotationMatrix = robotCameraRotationMatrix.RotationMatrix.ToArray();
             }
 
+            double IntervalX = calibrationInfo.Width / 2;
+            double IntervalY = calibrationInfo.Height / 2;
+            Vector<double> P1 = Vector<double>.Build.Dense(new double[] { -IntervalX, -IntervalY });
+            Vector<double> P2 = Vector<double>.Build.Dense(new double[] { 0, -IntervalY });
+            Vector<double> P3 = Vector<double>.Build.Dense(new double[] { IntervalX, -IntervalY });
+            Vector<double> P4 = Vector<double>.Build.Dense(new double[] { IntervalX, 0 });
+            Vector<double> P5 = Vector<double>.Build.Dense(new double[] { 0, 0 });
+            Vector<double> P6 = Vector<double>.Build.Dense(new double[] { -IntervalX, 0 });
+            Vector<double> P7 = Vector<double>.Build.Dense(new double[] { -IntervalX, IntervalY });
+            Vector<double> P8 = Vector<double>.Build.Dense(new double[] { 0, IntervalY });
+            Vector<double> P9 = Vector<double>.Build.Dense(new double[] { IntervalX, IntervalY });
+
             /// <summary>
             /// 机器人与相机之间的旋转矩阵
             /// </summary>

+ 15 - 15
TeamAAS-VM/ViewModels/Calibration/FixedUpCameraFindP0ViewModel.cs

@@ -86,7 +86,6 @@ namespace TeamAAS_VP.ViewModels.Calibration
             set
             {
                 SetProperty(ref _ExposureTime, value);
-                SelectCalibration.ExposureTime = value;
                 if (Camera != null)
                 {
                     try
@@ -112,7 +111,6 @@ namespace TeamAAS_VP.ViewModels.Calibration
             set
             {
                 SetProperty(ref _Gain, value);
-                SelectCalibration.Gain = value;
                 if (Camera != null)
                 {
                     try
@@ -375,6 +373,7 @@ namespace TeamAAS_VP.ViewModels.Calibration
                 if (!isSuccess)
                 {
                     MessageBox.Show("移动至移动至标定块放置位置,取标定块失败!");
+                    return;
                 }
                 //打开吸气
                 Robot.CalibOutIO(true);
@@ -385,6 +384,7 @@ namespace TeamAAS_VP.ViewModels.Calibration
                 if (!isSuccess)
                 {
                     MessageBox.Show("移动至下相机位置失败!");
+                    return;
                 }
 
                 var calibResult = await CaptureAndProcess(new double[] { SelectCalibration.DownCameraPoint.X, SelectCalibration.DownCameraPoint.Y, SelectCalibration.DownCameraPoint.U });
@@ -408,11 +408,12 @@ namespace TeamAAS_VP.ViewModels.Calibration
                     }
                     SelectCalibration.MarkPoint.X = (float)p0[0];
                     SelectCalibration.MarkPoint.Y = (float)p0[1];
-                    MessageBox.Show($"P0点计算成功!X:{calibResult.X},Y:{calibResult.Y}");
+                    //MessageBox.Show($"P0点计算成功!X:{calibResult.X},Y:{calibResult.Y}");
                 }
                 else
                 {
                     MessageBox.Show("未找到P0点,请调整工件位置后重试!");
+                    return;
                 }
 
                 // 3.移动至标定块放置位置,放下标定块
@@ -427,6 +428,7 @@ namespace TeamAAS_VP.ViewModels.Calibration
                 else
                 {
                     MessageBox.Show("移动至标定块放置位置,放下标定块失败!");
+                    return;
                 }
 
                 // 4.Z轴上升安全高度
@@ -436,6 +438,7 @@ namespace TeamAAS_VP.ViewModels.Calibration
                 if (!isSuccess)
                 {
                     MessageBox.Show("Z轴上升至安全高度失败!");
+                    return;
                 }
 
                 //完成提示
@@ -623,17 +626,14 @@ namespace TeamAAS_VP.ViewModels.Calibration
             {
                 SelectCalibration.FixedUpCameraFindP0Info = new FixedUpCameraFindP0Info();
             }
-            if (ToolBlockEdit.Subject == null)
+            string prcPath = FilePath.CalibrationPath + "//" + SelectCalibration.Name + "//" + "FixedUpCameraTool.vpp";
+            if (File.Exists(prcPath))
             {
-                string prcPath = FilePath.CalibrationPath + "//" + SelectCalibration.Name + "//" + "FixedUpCameraTool.vpp";
-                if (File.Exists(prcPath))
-                {
-                    ToolBlockEdit.Subject = CogSerializer.LoadObjectFromFile(prcPath) as CogToolBlock;
-                }
-                else
-                {
-                    ToolBlockEdit.Subject = CogSerializer.LoadObjectFromFile(FilePath.CalibrationToolblockPath) as CogToolBlock;
-                }
+                ToolBlockEdit.Subject = CogSerializer.LoadObjectFromFile(prcPath) as CogToolBlock;
+            }
+            else
+            {
+                ToolBlockEdit.Subject = CogSerializer.LoadObjectFromFile(FilePath.CalibrationToolblockPath) as CogToolBlock;
             }
 
             if (SelectCalibration.RobotId != Guid.Empty)
@@ -653,8 +653,8 @@ namespace TeamAAS_VP.ViewModels.Calibration
                 SelectedCalibration = CalibrationList.FirstOrDefault(c => c.Id == SelectCalibration.FixedUpCameraFindP0Info.CalibrationId);
             }
 
-            ExposureTime = SelectCalibration.ExposureTime;
-            Gain = SelectCalibration.Gain;
+            ExposureTime = SelectCalibration.FixedUpCameraFindP0Info.ExposureTime==0?5000: SelectCalibration.FixedUpCameraFindP0Info.ExposureTime;
+            Gain = SelectCalibration.FixedUpCameraFindP0Info.Gain;
 
         }
 

+ 8 - 0
TeamAAS-VM/ViewModels/Product/ProductParamsViewModel.cs

@@ -349,6 +349,14 @@ namespace TeamAAS_VP.ViewModels.Product
                 {
                     MoveDownCamera2LockPhotoProcedure = ProcedureModels.FirstOrDefault(p => p.Id == SelectProduct.MoveDownCamera2LockPhotoProcedureId);
                 }
+                if (SelectProduct.MoveDownCamer1PickPhotoProcedureId != Guid.Empty)
+                {
+                    MoveDownCamer1PickPhotoProcedureId = ProcedureModels.FirstOrDefault(p => p.Id == SelectProduct.MoveDownCamer1PickPhotoProcedureId);
+                }
+                if (SelectProduct.MoveDownCamer2PickPhotoProcedureId != Guid.Empty)
+                {
+                    MoveDownCamer2PickPhotoProcedureId = ProcedureModels.FirstOrDefault(p => p.Id == SelectProduct.MoveDownCamer2PickPhotoProcedureId);
+                }
             }
             catch (Exception ex)
             {