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

+ 10 - 10
TeamAAS-VM/Core/Robots/XYZU_Robot.cs

@@ -1096,11 +1096,11 @@ namespace TeamAAS_VP.Core.Robots
                 {
                     isError = (bool)res[axis.State.PausedNode];
                 }
-                if (isError)
-                {
-                    isAnyError = true;
-                    break;
-                }
+                //if (isError)
+                //{
+                //    isAnyError = true;
+                //    break;
+                //}
                 //检查是否到位和位置一致
                 float targetPos = 0;
                 switch (axis.Name)
@@ -1114,11 +1114,11 @@ namespace TeamAAS_VP.Core.Robots
                 //如果定位完成且位置一致,则此轴完成,如果有错误则失败
                 if (!(posOk && Math.Abs(actualPos - targetPos) < 0.02))
                 {
-                    if (isError)
-                    {
-                        isAnyError = true;
-                        break;
-                    }
+                    //if (isError)
+                    //{
+                    //    isAnyError = true;
+                    //    break;
+                    //}
                     allOk = false;
                     break;
                 }

+ 9 - 0
TeamAAS-VM/Resources/Languages/Lang.Designer.cs

@@ -150,6 +150,15 @@ namespace TeamAAS_VP.Resources.Languages {
             }
         }
         
+        /// <summary>
+        ///   查找类似 独立XY移动相机 的本地化字符串。
+        /// </summary>
+        public static string CameraMount_MobileDownIndependentXYPlatform {
+            get {
+                return ResourceManager.GetString("CameraMount_MobileDownIndependentXYPlatform", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   查找类似 XY模组移动向下 的本地化字符串。
         /// </summary>

+ 3 - 0
TeamAAS-VM/Resources/Languages/Lang.resx

@@ -2126,4 +2126,7 @@
   <data name="通过移动至下相机拍照位置拍照计算P0" xml:space="preserve">
     <value>通过移动至下相机拍照位置,拍照得到P0,然后放回原位</value>
   </data>
+  <data name="CameraMount_MobileDownIndependentXYPlatform" xml:space="preserve">
+    <value>独立XY移动相机</value>
+  </data>
 </root>

+ 26 - 6
TeamAAS-VM/Services/CameraCalibrationService.cs

@@ -441,7 +441,11 @@ namespace TeamAAS_VP.Services
             Matrix<double> RobotCameraRotationMatrix = null;
 
             //移动机器人至待机位置
-            await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
+            bool isFinished = await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
+            if (!isFinished)
+            {
+                return (false, null, 0, 0, 0, 0);
+            }
             if (cancellationToken.IsCancellationRequested)
             {
                 return (false, null, 0, 0, 0, 0);
@@ -460,7 +464,7 @@ namespace TeamAAS_VP.Services
             }
 
             //移动独立模组至待机点
-            bool isFinished = await ((XYZU_Robot)robot).WaitCameraMoveFinishedAsync(calibrationInfo.CameraMotionModuleIndex, calibrationInfo.IndependentDownCameraMotionModulePoint);
+            isFinished = await ((XYZU_Robot)robot).WaitCameraMoveFinishedAsync(calibrationInfo.CameraMotionModuleIndex, calibrationInfo.IndependentDownCameraMotionModulePoint);
             if (!isFinished)
             {
                 return (false, null, 0, 0, 0, 0);
@@ -495,14 +499,22 @@ namespace TeamAAS_VP.Services
             RPoint RobotU = calibrationInfo.CenterPoint.Clone();
             RobotU.U += (float)calibrationInfo.Angle;
             //移动机器人中心点
-            await robot.CalibMotionAsync(calibrationInfo.CenterPoint, null);
+            isFinished=await robot.CalibMotionAsync(calibrationInfo.CenterPoint, calibrationInfo.CenterPoint.Z);
+            if (!isFinished)
+            {
+                return (false, null, 0, 0, 0, 0);
+            }
             if (cancellationToken.IsCancellationRequested)
             {
                 return (false, null, 0, 0, 0, 0);
             }
 
             //机器人U轴旋转
-            await robot.CalibMotionAsync(RobotU, null);
+            isFinished = await robot.CalibMotionAsync(RobotU, RobotU.Z); 
+            if (!isFinished)
+            {
+                return (false, null, 0, 0, 0, 0);
+            }
             if (cancellationToken.IsCancellationRequested)
             {
                 return (false, null, 0, 0, 0, 0);
@@ -527,7 +539,11 @@ namespace TeamAAS_VP.Services
                 RobotU.X += (float)pos[0];
                 RobotU.Y += (float)pos[1];
                 //机器人移动
-                await robot.CalibMotionAsync(RobotU, null);
+                isFinished = await robot.CalibMotionAsync(RobotU, RobotU.Z);
+                if (!isFinished)
+                {
+                    return (false, null, 0, 0, 0, 0);
+                }
                 if (cancellationToken.IsCancellationRequested)
                 {
                     return (false, null, 0, 0, 0, 0);
@@ -545,7 +561,11 @@ namespace TeamAAS_VP.Services
                 if (Math.Abs(offsetx) < 1 && Math.Abs(offsetx) < 1)
                 {
                     //移动机器人至待机位置
-                    await robot.CalibMotionAsync(calibrationInfo.HomePoint, null);
+                    isFinished=await robot.CalibMotionAsync(calibrationInfo.CenterPoint, calibrationInfo.CenterPoint.Z);
+                    if (!isFinished)
+                    {
+                        return (false, null, 0, 0, 0, 0);
+                    }
                     IsFinish = true;
                     break;
                 }

+ 5 - 0
TeamAAS-VM/ViewModels/Calibration/CalibrationDistortionViewModel.cs

@@ -9,6 +9,7 @@ using Prism.Regions;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Windows;
 using Team.FFFeederService.Interfaces;
@@ -124,6 +125,10 @@ namespace TeamAAS_VP.ViewModels.Calibration
             try
             {
                 string calibToolPath = FilePath.CalibrationPath + "//" + SelectCalibration.Name + "//" + "CalibCheckerboard.vpp";
+                if (!Directory.Exists(Path.GetDirectoryName(calibToolPath)))
+                {
+                    Directory.CreateDirectory(Path.GetDirectoryName(calibToolPath));
+                }
                 SelectCalibration.CalibCheckerboardTool = CalibCheckerboardEdit.Subject;
                 //保存校准工具
                 CogSerializer.SaveObjectToFile(CalibCheckerboardEdit.Subject, calibToolPath);

+ 7 - 1
TeamAAS-VM/Views/Calibration/CalibrationDistortion.xaml

@@ -22,6 +22,12 @@
              d:Width="1024"
              d:Background="White"
              FontFamily="{DynamicResource DefaultFont}">
+    <b:Interaction.Triggers>
+        <b:EventTrigger EventName="Loaded">
+            <b:InvokeCommandAction Command="{Binding LoadedCommand}" />
+        </b:EventTrigger>
+    </b:Interaction.Triggers>
+    
     <Grid>
         <Grid.RowDefinitions>
             <RowDefinition Height="auto" />
@@ -60,7 +66,7 @@
             <Grid>
                 <wf:WindowsFormsHost Grid.Column="0"
                                      Margin="0,0,0,35">
-                    <vp:CogCalibCheckerboardEditV2 x:Name="ToolBlockEditV2" />
+                    <vp:CogCalibCheckerboardEditV2 x:Name="CalibCheckerboardEditV2" />
                 </wf:WindowsFormsHost>
                 <Button Content="{lex:Loc 运行流程}"
                         Width="100"

+ 3 - 0
TeamAAS-VM/Views/Calibration/CalibrationDistortion.xaml.cs

@@ -1,4 +1,6 @@
 using System.Windows.Controls;
+using TeamAAS_VP.Core.Robots;
+using TeamAAS_VP.ViewModels.Calibration;
 
 namespace TeamAAS_VP.Views.Calibration
 {
@@ -10,6 +12,7 @@ namespace TeamAAS_VP.Views.Calibration
         public CalibrationDistortion()
         {
             InitializeComponent();
+            ((CalibrationDistortionViewModel)DataContext).CalibCheckerboardEdit = this.CalibCheckerboardEditV2;
         }
     }
 }