Browse Source

新增独立移动相机点位的完整支持

本次提交实现了对“独立移动相机点位”的全流程支持,包括:
- 数据模型中新增 IndependentCamerPoints 属性;
- PLC地址配置中增加 Out_IndependentCamer,并初始化各轴参数地址;
- 管理逻辑支持独立移动相机点位的PLC下发;
- 点位示教功能支持独立移动相机点位的坐标获取与赋值;
- 界面增加独立移动相机点位类型的选择与管理;
- 相关切换与处理逻辑同步支持该点位类型。
提升了系统的灵活性和扩展性。
孝锋 徐 8 months ago
parent
commit
af803abd5c

+ 7 - 0
TeamAAS-VM/Core/Management.cs

@@ -1030,6 +1030,13 @@ namespace TeamAAS_VP.Core
                     await item.WriteToPlcAddress(addressConfig.Out_CheckCamera, plc);
                 }
             }
+            if (current.IndependentCamerPoints != null && current.IndependentCamerPoints.Count > 0)
+            {
+                foreach (var item in current.IndependentCamerPoints)
+                {
+                    await item.WriteToPlcAddress(addressConfig.Out_IndependentCamer, plc);
+                }
+            }
         }
 
         /// <summary>

+ 29 - 0
TeamAAS-VM/Models/PLC/PlcAddressConfig.cs

@@ -268,6 +268,16 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _CheckCamera, value); }
         }
 
+        private PlcPointAddress _IndependentCamer = new PlcPointAddress();
+        /// <summary>
+        /// 独立移动相机点位参数
+        /// </summary>
+        public PlcPointAddress Out_IndependentCamer
+        {
+            get { return _IndependentCamer; }
+            set { SetProperty(ref _IndependentCamer, value); }
+        }
+
         private PlcAddress _Out_ScrewTeachNum;
         /// <summary>
         /// 披头矫正的模式,1:初始化时矫正,2:每个产品矫正一次,3:每颗螺丝矫正一次
@@ -779,6 +789,25 @@ namespace TeamAAS_VP.Models.PLC
             Out_CheckCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Feeder";
             Out_CheckCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].ScrewProNum";
 
+            // Out_IndependentCamer(独立移动相机点位)初始化并赋地址
+            Out_IndependentCamer = EnsurePoint(Out_IndependentCamer);
+            Out_IndependentCamer.Description = "独立移动相机点位参数";
+            Out_IndependentCamer.X_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].X_Position";
+            Out_IndependentCamer.X_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].X_Velocity";
+            Out_IndependentCamer.Y_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Y_Position";
+            Out_IndependentCamer.Y_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Y_Velocity";
+            Out_IndependentCamer.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Z_Position_Start";
+            Out_IndependentCamer.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Z_Velocity_Start";
+            Out_IndependentCamer.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Z_Position_Stop";
+            Out_IndependentCamer.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Z_Velocity_Stop";
+            Out_IndependentCamer.U_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].U_Position";
+            Out_IndependentCamer.U_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].U_Velocity";
+            Out_IndependentCamer.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].R_Position";
+            Out_IndependentCamer.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].R_Velocity";
+            Out_IndependentCamer.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Torque";
+            Out_IndependentCamer.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Feeder";
+            Out_IndependentCamer.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].ScrewProNum";
+
             // Out_CheckCamera(附加轴点位)初始化并赋地址,
 
             Out_ScrewTeachNum = Ensure(Out_ScrewTeachNum);

+ 10 - 0
TeamAAS-VM/Models/Product/ProductModel.cs

@@ -416,6 +416,16 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _CheckCameraPoints, value); }
         }
 
+        private ObservableCollection<PlcPoint> _IndependentCamerPoints = new ObservableCollection<PlcPoint>();
+        /// <summary>
+        /// 独立移动相机步进坐标系点位
+        /// </summary>
+        public ObservableCollection<PlcPoint> IndependentCamerPoints
+        {
+            get { return _IndependentCamerPoints; }
+            set { SetProperty(ref _IndependentCamerPoints, value); }
+        }
+
         private bool _IsLoad;
         /// <summary>
         /// 是否已加载

+ 20 - 0
TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

@@ -668,6 +668,23 @@ namespace TeamAAS_VP.ViewModels.Product
                     _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
                     return;
                 }
+                else if (SelectedIndex == 6)
+                {
+                    //弹窗用户是否确认要示教该点位
+                    if (MessageBox.Show($"确认要示教点位 {SelectedPoint.Number} 吗?", "示教点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                    {
+                        return;
+                    }
+                    var curpos1 = await Robot.GetCameraPosAsync(SelectedPoint.Number);
+                    //将当前点位转换为产品Local坐标系下的点位
+                    SelectedPoint.X_Position = (float)curpos1.X;
+                    SelectedPoint.Y_Position = (float)curpos1.Y;
+                    SelectedPoint.Z_Position_Start = curpos1.Z;
+                    SelectedPoint.U_Position = curpos1.U;
+                    SelectedPoint.R_Position = curpos1.V;
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                    return;
+                }
                 else
                 {
                     //弹窗用户是否确认要示教该点位
@@ -828,6 +845,9 @@ namespace TeamAAS_VP.ViewModels.Product
                 case 5:
                     Points = SelectProduct.CheckCameraPoints;
                     break;
+                case 6:
+                    Points = SelectProduct.IndependentCamerPoints;
+                    break;
                 default:
                     break;
             }

+ 13 - 0
TeamAAS-VM/Views/Product/PlcPointParams.xaml

@@ -283,6 +283,19 @@
                                 </ListBoxItem.Style>
                                 <TextBlock Text="复检点位" />
                             </ListBoxItem>
+                            <!--独立移动相机-->
+                            <ListBoxItem>
+                                <ListBoxItem.Style>
+                                    <Style TargetType="ListBoxItem"
+                                           BasedOn="{StaticResource MaterialDesign3.NavigationBarPrimaryListBoxItem}">
+                                        <Setter Property="materialDesign:NavigationBarAssist.SelectedIcon"
+                                                Value="Circle" />
+                                        <Setter Property="materialDesign:NavigationBarAssist.UnselectedIcon"
+                                                Value="CircleOutline" />
+                                    </Style>
+                                </ListBoxItem.Style>
+                                <TextBlock Text="独立移动相机" />
+                            </ListBoxItem>
                         </ListBox>
                         <!--点位列表操作按钮面板-->
                         <StackPanel DockPanel.Dock="Bottom"