| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494 |
- using Cognex.VisionPro.CalibFix;
- using MathNet.Numerics.LinearAlgebra;
- using Newtonsoft.Json;
- using Prism.Mvvm;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Media.Media3D;
- using TeamAAS_VP.Enums;
- using TeamAAS_VP.Models.Robot;
- namespace TeamAAS_VP.Models.Calibration
- {
- [JsonObject(MemberSerialization.OptOut)]
- public class CalibrationInfo : BindableBase
- {
- private bool _IsCreate;
- /// <summary>
- /// 正在创建
- /// </summary>
- [JsonIgnore]
- public bool IsCreate
- {
- get { return _IsCreate; }
- set { SetProperty(ref _IsCreate, value); }
- }
- private Guid _Id;
- public Guid Id
- {
- get { return _Id; }
- set { SetProperty(ref _Id, value); }
- }
- private int _Index;
- /// <summary>
- /// 编号
- /// </summary>
- public int Index
- {
- get { return _Index; }
- set { SetProperty(ref _Index, value); }
- }
- private string _Name;
- /// <summary>
- /// 校准的名称
- /// </summary>
- public string Name
- {
- get { return _Name; }
- set { SetProperty(ref _Name, value); }
- }
- private DateTime _DateTime;
- public DateTime DateTime
- {
- get { return _DateTime; }
- set { SetProperty(ref _DateTime, value); }
- }
- private string _CameraName;
- /// <summary>
- /// 相机名称
- /// </summary>
- public string CameraName
- {
- get { return _CameraName; }
- set { SetProperty(ref _CameraName, value); }
- }
- private Guid _CameraID;
- /// <summary>
- /// 相机ID
- /// </summary>
- public Guid CameraID
- {
- get { return _CameraID; }
- set { SetProperty(ref _CameraID, value); }
- }
- private Guid _RobotId;
- /// <summary>
- /// 机器人
- /// </summary>
- public Guid RobotId
- {
- get { return _RobotId; }
- set { SetProperty(ref _RobotId, value); }
- }
- private Guid _FeederId;
- /// <summary>
- /// Feeder
- /// </summary>
- public Guid FeederId
- {
- get { return _FeederId; }
- set { SetProperty(ref _FeederId, value); }
- }
- private CameraMount _CameraMount;
- /// <summary>
- /// 相机安装方式
- /// </summary>
- public CameraMount CameraMount
- {
- get { return _CameraMount; }
- set { SetProperty(ref _CameraMount, value); }
- }
- private int _CameraMotionModuleIndex;
- /// <summary>
- /// 相机运动模块的编号
- /// </summary>
- public int CameraMotionModuleIndex
- {
- get { return _CameraMotionModuleIndex; }
- set { SetProperty(ref _CameraMotionModuleIndex, value); }
- }
- private PickInfo _Pick;
- /// <summary>
- /// 取料方式
- /// </summary>
- public PickInfo Pick
- {
- get { return _Pick; }
- set { SetProperty(ref _Pick, value); }
- }
- private int _Brightness;
- /// <summary>
- /// 光源亮度
- /// </summary>
- public int Brightness
- {
- get { return _Brightness; }
- set { SetProperty(ref _Brightness, value); }
- }
- private float _ExposureTime;
- /// <summary>
- /// 相机曝光时间
- /// </summary>
- public float ExposureTime
- {
- get { return _ExposureTime; }
- set { SetProperty(ref _ExposureTime, value); }
- }
- private float _Gain;
- /// <summary>
- /// 相机增益
- /// </summary>
- public float Gain
- {
- get { return _Gain; }
- set { SetProperty(ref _Gain, value); }
- }
- private CalibTechP0Mode _CalibTechP0Mode;
- /// <summary>
- /// 移动相机中心作为P0还是手动示教P0
- /// </summary>
- public CalibTechP0Mode CalibTechP0Mode
- {
- get { return _CalibTechP0Mode; }
- set { SetProperty(ref _CalibTechP0Mode, value); }
- }
- private RPoint _CenterPoint;
- /// <summary>
- /// 中心点
- /// </summary>
- public RPoint CenterPoint
- {
- get { return _CenterPoint; }
- set { SetProperty(ref _CenterPoint, value); }
- }
- private RPoint _HomePoint;
- /// <summary>
- /// 待机点
- /// </summary>
- public RPoint HomePoint
- {
- get { return _HomePoint; }
- set { SetProperty(ref _HomePoint, value); }
- }
- private double _Width;
- /// <summary>
- /// 机器人移动的范围X
- /// </summary>
- public double Width
- {
- get { return _Width; }
- set { SetProperty(ref _Width, value); }
- }
- private double _Height;
- /// <summary>
- /// 机器人移动的范围Y
- /// </summary>
- public double Height
- {
- get { return _Height; }
- set { SetProperty(ref _Height, value); }
- }
- private double _Angle = 180;
- /// <summary>
- /// 机器人移动的范围U
- /// </summary>
- public double Angle
- {
- get { return _Angle; }
- set { SetProperty(ref _Angle, value); }
- }
- private RobotTool _Tool;
- /// <summary>
- /// 工具坐标
- /// </summary>
- public RobotTool Tool
- {
- get { return _Tool; }
- set { SetProperty(ref _Tool, value); }
- }
- private RobotArm _Arm;
- /// <summary>
- /// Arm
- /// </summary>
- public RobotArm Arm
- {
- get { return _Arm; }
- set { SetProperty(ref _Arm, value); }
- }
- private int _Speed;
- public int Speed
- {
- get { return _Speed; }
- set { SetProperty(ref _Speed, value); }
- }
- private int _Accel;
- public int Accel
- {
- get { return _Accel; }
- set { SetProperty(ref _Accel, value); }
- }
- private int _WaitPhoto;
- public int WaitPhoto
- {
- get { return _WaitPhoto; }
- set { SetProperty(ref _WaitPhoto, value); }
- }
- private int _WaitSuction;
- /// <summary>
- /// 吸真空延时
- /// </summary>
- public int WaitSuction
- {
- get { return _WaitSuction; }
- set { SetProperty(ref _WaitSuction, value); }
- }
- private int _WaitBlow;
- /// <summary>
- /// 破真空延时
- /// </summary>
- public int WaitBlow
- {
- get { return _WaitBlow; }
- set { SetProperty(ref _WaitBlow, value); }
- }
- private bool _Power;
- public bool Power
- {
- get { return _Power; }
- set { SetProperty(ref _Power, value); }
- }
- private bool _FixedDownCameraNoReturnToHome;
- /// <summary>
- /// 固定向下相机时是否不需要每次回到待机点
- /// </summary>
- public bool FixedDownCameraNoReturnToHome
- {
- get { return _FixedDownCameraNoReturnToHome; }
- set { SetProperty(ref _FixedDownCameraNoReturnToHome, value); }
- }
- private bool _IsDistortionCorrection;
- /// <summary>
- /// 是否进行畸变校正
- /// </summary>
- public bool IsDistortionCorrection
- {
- get { return _IsDistortionCorrection; }
- set { SetProperty(ref _IsDistortionCorrection, value); }
- }
- private RPoint _MarkPoint;
- /// <summary>
- /// 特征点的坐标
- /// </summary>
- public RPoint MarkPoint
- {
- get { return _MarkPoint; }
- set { SetProperty(ref _MarkPoint, value); }
- }
- private RPoint _PutPoint;
- /// <summary>
- /// 移动相机时。通过下相机校准P0的标定快放置位置
- /// </summary>
- public RPoint PutPoint
- {
- get { return _PutPoint; }
- set { SetProperty(ref _PutPoint, value); }
- }
- //
- private RPoint _DownCameraPoint;
- /// <summary>
- /// 移动相机时。通过下相机校准P0的下相机拍照位置
- /// </summary>
- public RPoint DownCameraPoint
- {
- get { return _DownCameraPoint; }
- set { SetProperty(ref _DownCameraPoint, value); }
- }
- private RPoint _IndependentDownCameraMotionModulePoint;
- /// <summary>
- /// 独立的移动固定向下相机的模组位置
- /// </summary>
- public RPoint IndependentDownCameraMotionModulePoint
- {
- get { return _IndependentDownCameraMotionModulePoint; }
- set { SetProperty(ref _IndependentDownCameraMotionModulePoint, value); }
- }
- private double _IndependentDownCameraMotionModuleMoveX;
- /// <summary>
- /// 独立模组X轴移动的距离
- /// </summary>
- public double IndependentDownCameraMotionModuleMoveX
- {
- get { return _IndependentDownCameraMotionModuleMoveX; }
- set { SetProperty(ref _IndependentDownCameraMotionModuleMoveX, value); }
- }
- private double[,] _IndependentDownCameraMotionModuleRotationMatrix;
- /// <summary>
- /// 独立移动模组的旋转矩阵
- /// </summary>
- public double[,] IndependentDownCameraMotionModuleRotationMatrix
- {
- get { return _IndependentDownCameraMotionModuleRotationMatrix; }
- set { SetProperty(ref _IndependentDownCameraMotionModuleRotationMatrix, value); }
- }
- private double[,] _IndependentDownCameraMotionModuleTranslationMatrix;
- /// <summary>
- /// 独立移动模组的平移矩阵
- /// </summary>
- public double[,] IndependentDownCameraMotionModuleTranslationMatrix
- {
- get { return _IndependentDownCameraMotionModuleTranslationMatrix; }
- set { SetProperty(ref _IndependentDownCameraMotionModuleTranslationMatrix, value); }
- }
- private ObservableCollection<RobotPixelPoint> _CalibPoints;
- /// <summary>
- /// 9点校准点
- /// </summary>
- public ObservableCollection<RobotPixelPoint> CalibPoints
- {
- get { return _CalibPoints; }
- set { SetProperty(ref _CalibPoints, value); }
- }
- private double[,] _RobotCameraRotationMatrix;
- /// <summary>
- /// 机器人与相机之间的旋转矩阵
- /// </summary>
- public double[,] RobotCameraRotationMatrix
- {
- get { return _RobotCameraRotationMatrix; }
- set { SetProperty(ref _RobotCameraRotationMatrix, value); }
- }
- private double _PixelScaleX;
- /// <summary>
- /// 图像X方向像素与毫米缩放系数,mm/pixel
- /// </summary>
- public double PixelScaleX
- {
- get { return _PixelScaleX; }
- set { SetProperty(ref _PixelScaleX, value); }
- }
- private double _PixelScaleY;
- /// <summary>
- /// 图像Y方向像素与毫米缩放系数,mm/pixel
- /// </summary>
- public double PixelScaleY
- {
- get { return _PixelScaleY; }
- set { SetProperty(ref _PixelScaleY, value); }
- }
- private double[,] _AffineTransformationMaterial;
- /// <summary>
- /// 仿射变换2*3矩阵
- /// </summary>
- public double[,] AffineTransformationMaterial
- {
- get { return _AffineTransformationMaterial; }
- set { SetProperty(ref _AffineTransformationMaterial, value); }
- }
- private FixedUpCameraFindP0Info _FixedUpCameraFindP0Info;
- /// <summary>
- /// 移动相机时,下相机校准P0
- /// </summary>
- public FixedUpCameraFindP0Info FixedUpCameraFindP0Info
- {
- get { return _FixedUpCameraFindP0Info; }
- set { SetProperty(ref _FixedUpCameraFindP0Info, value); }
- }
- private CalibrationResult _CalibrationResult;
- /// <summary>
- /// 校准结果
- /// </summary>
- public CalibrationResult CalibrationResult
- {
- get { return _CalibrationResult; }
- set { SetProperty(ref _CalibrationResult, value); }
- }
- private CalibrationTestResult _CalibrationTestResult;
- public CalibrationTestResult CalibrationTestResult
- {
- get { return _CalibrationTestResult; }
- set { SetProperty(ref _CalibrationTestResult, value); }
- }
- /// <summary>
- /// 流程
- /// </summary>
- [JsonIgnore]
- public Cognex.VisionPro.ToolBlock.CogToolBlock ToolBlock { get; set; }
- [JsonIgnore]
- public CogCalibCheckerboardTool CalibCheckerboardTool { get; set; }
- public CalibrationInfo Clone()
- {
- try
- {
- return JsonConvert.DeserializeObject<CalibrationInfo>(JsonConvert.SerializeObject(this));
- }
- catch (Exception)
- {
- return this;
- }
- }
- }
- }
|