266 lines
9.4 KiB
C#
266 lines
9.4 KiB
C#
/*
|
|
* Copyright (c) 2025 LG Electronics Inc.
|
|
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
|
*/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
using VisionAligner;
|
|
using VisionCommon;
|
|
|
|
namespace VisionSequence.Setup {
|
|
/// <summary>
|
|
/// 캘리브레이션 플랜의 아이템
|
|
/// </summary>
|
|
public class PlanItem : INotifyPropertyChanged {
|
|
/// <summary>프로퍼티 변경 이벤트 핸들러</summary>
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
#region Calibration Binding Properties
|
|
/// <summary>FOV ID</summary>
|
|
public int FovId { get; set; }
|
|
/// <summary>플랜아이템의 스텝 번호</summary>
|
|
public string Step { get; set; }
|
|
/// <summary>플랜아이템의 캘리브레이션 목적</summary>
|
|
public string Purpose { get; set; }
|
|
/// <summary>플랜아이템의 축과 방향</summary>
|
|
public string Target { get; set; }
|
|
/// <summary>플랜아이템의 모터 이동 목적</summary>
|
|
public string Action { get; set; }
|
|
/// <summary>X축 상대위치 이동량</summary>
|
|
public string X { get; set; }
|
|
/// <summary>Y축 상대위치 이동량</summary>
|
|
public string Y { get; set; }
|
|
/// <summary>T축 상대위치 회전량</summary>
|
|
public string T { get; set; }
|
|
|
|
private string _imagePosX;
|
|
/// <summary>캘리브레이션 패턴 검출 이미지 좌표X</summary>
|
|
public string ImagePosX {
|
|
get {
|
|
return _imagePosX;
|
|
}
|
|
set {
|
|
_imagePosX = value;
|
|
OnPropertyChanged("ImagePosX");
|
|
}
|
|
}
|
|
|
|
private string _imagePosY;
|
|
/// <summary>캘리브레이션 패턴 검출 이미지 좌표Y</summary>
|
|
public string ImagePosY {
|
|
get {
|
|
return _imagePosY;
|
|
}
|
|
set {
|
|
_imagePosY = value;
|
|
OnPropertyChanged("ImagePosY");
|
|
}
|
|
}
|
|
|
|
private string _staticPosX;
|
|
/// <summary>캘리브레이션 패턴 검출 자재 좌표X</summary>
|
|
public string StaticPosX {
|
|
get {
|
|
return _staticPosX;
|
|
}
|
|
set {
|
|
_staticPosX = value;
|
|
OnPropertyChanged("StaticPosX");
|
|
}
|
|
}
|
|
|
|
private string _staticPosY;
|
|
/// <summary>캘리브레이션 패턴 검출 자재 좌표Y</summary>
|
|
public string StaticPosY {
|
|
get {
|
|
return _staticPosY;
|
|
}
|
|
set {
|
|
_staticPosY = value;
|
|
OnPropertyChanged("StaticPosY");
|
|
}
|
|
}
|
|
|
|
private string _resultT;
|
|
/// <summary>캘리브레이션 패턴 검출 T</summary>
|
|
public string ResultT {
|
|
get {
|
|
return _resultT;
|
|
}
|
|
set {
|
|
_resultT = value;
|
|
OnPropertyChanged("ResultT");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
/// <param name="step">플랜아이템의 스텝 번호</param>
|
|
/// <param name="purpose">플랜아이템의 캘리브레이션 목적</param>
|
|
/// <param name="target">플랜아이템의 축과 방향</param>
|
|
/// <param name="action">플랜아이템의 모터 이동 목적</param>
|
|
/// <param name="x">X축 상대위치 이동량</param>
|
|
/// <param name="y">Y축 상대위치 이동량</param>
|
|
/// <param name="t">T축 상대위치 회전량</param>
|
|
public PlanItem(string step, string purpose, string target, string action, string x, string y, string t) {
|
|
FovId = -1;
|
|
Step = step;
|
|
Purpose = purpose;
|
|
Target = target;
|
|
Action = action;
|
|
X = x;
|
|
Y = y;
|
|
T = t;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
public PlanItem() { }
|
|
|
|
/// <summary>
|
|
/// 복제(Deep Copy)
|
|
/// </summary>
|
|
/// <returns>플랜 아이템</returns>
|
|
public PlanItem Clone() {
|
|
return new PlanItem() {
|
|
FovId = this.FovId,
|
|
Step = this.Step,
|
|
Purpose = this.Purpose,
|
|
Target = this.Target,
|
|
Action = this.Action,
|
|
X = this.X,
|
|
Y = this.Y,
|
|
T = this.T,
|
|
ImagePosX = this.ImagePosX,
|
|
ImagePosY = this.ImagePosY,
|
|
StaticPosX = this.StaticPosX,
|
|
StaticPosY = this.StaticPosY,
|
|
ResultT = this.ResultT,
|
|
};
|
|
}
|
|
|
|
protected void OnPropertyChanged([CallerMemberName] string propertyName = null) {
|
|
if (string.IsNullOrEmpty(propertyName)) {
|
|
return;
|
|
}
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 캘리브레이션 결과의 아이템
|
|
/// </summary>
|
|
public class CalResultItem : ICloneable {
|
|
/// <summary>공정 수행 시간</summary>
|
|
public string Time { get; set; }
|
|
/// <summary>FOV ID</summary>
|
|
public int FovId { get; set; }
|
|
/// <summary>플랜아이템의 스텝 번호</summary>
|
|
public string Step { get; set; }
|
|
/// <summary>플랜아이템의 캘리브레이션 목적</summary>
|
|
public string Purpose { get; set; }
|
|
/// <summary>플랜아이템의 축과 방향</summary>
|
|
public string Target { get; set; }
|
|
/// <summary>플랜아이템의 모터 이동 목적</summary>
|
|
public string Action { get; set; }
|
|
/// <summary>X축 상대위치 이동량</summary>
|
|
public string X { get; set; }
|
|
/// <summary>Y축 상대위치 이동량</summary>
|
|
public string Y { get; set; }
|
|
/// <summary>T축 상대위치 회전량</summary>
|
|
public string T { get; set; }
|
|
/// <summary>캘리브레이션 패턴 검출 이미지 좌표X</summary>
|
|
public string ImagePosX { get; set; }
|
|
/// <summary>캘리브레이션 패턴 검출 이미지 좌표Y</summary>
|
|
public string ImagePosY { get; set; }
|
|
/// <summary>캘리브레이션 패턴 검출 자재 좌표X</summary>
|
|
public string StaticPosX { get; set; }
|
|
/// <summary>캘리브레이션 패턴 검출 자재 좌표Y</summary>
|
|
public string StaticPosY { get; set; }
|
|
/// <summary>캘리브레이션 패턴 검출 T</summary>
|
|
public string ResultT { get; set; }
|
|
|
|
/// <summary>
|
|
/// Clone (Deep Copy)
|
|
/// </summary>
|
|
/// <returns>CalResultItem</returns>
|
|
public object Clone() {
|
|
return new CalResultItem() {
|
|
Time = this.Time,
|
|
FovId = this.FovId,
|
|
Step = this.Step,
|
|
Purpose = this.Purpose,
|
|
Target = this.Target,
|
|
Action = this.Action,
|
|
X = this.X,
|
|
Y = this.Y,
|
|
T = this.T,
|
|
ImagePosX = this.ImagePosX,
|
|
ImagePosY = this.ImagePosY,
|
|
StaticPosX = this.StaticPosX,
|
|
StaticPosY = this.StaticPosY,
|
|
ResultT = this.ResultT,
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Calibration 아이템 항목 매니저
|
|
/// </summary>
|
|
public class CalItemManager : ItemManagerBase {
|
|
private static readonly object _Lock = new object();
|
|
|
|
/// <summary>
|
|
/// Calibration 아이템 항목을 Get한다
|
|
/// </summary>
|
|
/// <param name="subSysInfo">서브 시스템 정보</param>
|
|
/// <param name="planItem">플랜 아이템</param>
|
|
/// <returns>Calibration 아이템 항목</returns>
|
|
public static CalResultItem GetCalItem(SubSysInfo subSysInfo, PlanItem planItem) {
|
|
lock (_Lock) {
|
|
return new CalResultItem() {
|
|
Time = GetTimeStamp(subSysInfo, planItem),
|
|
FovId = planItem.FovId,
|
|
Step = planItem.Step,
|
|
Purpose = planItem.Purpose,
|
|
Target = planItem.Target,
|
|
Action = planItem.Action,
|
|
X = planItem.X,
|
|
Y = planItem.Y,
|
|
T = planItem.T,
|
|
ImagePosX = planItem.ImagePosX,
|
|
ImagePosY = planItem.ImagePosY,
|
|
StaticPosX = planItem.StaticPosX,
|
|
StaticPosY = planItem.StaticPosY,
|
|
ResultT = planItem.ResultT,
|
|
};
|
|
}
|
|
}
|
|
|
|
public static PlanItem CalItemToPlanItem(CalResultItem calResultItem) {
|
|
return new PlanItem() {
|
|
FovId = calResultItem.FovId,
|
|
Step = calResultItem.Step,
|
|
Purpose = calResultItem.Purpose,
|
|
Target = calResultItem.Target,
|
|
Action = calResultItem.Action,
|
|
X = calResultItem.X,
|
|
Y = calResultItem.Y,
|
|
T = calResultItem.T,
|
|
ImagePosX = calResultItem.ImagePosX,
|
|
ImagePosY = calResultItem.ImagePosY,
|
|
StaticPosX = calResultItem.StaticPosX,
|
|
StaticPosY = calResultItem.StaticPosY,
|
|
ResultT = calResultItem.ResultT,
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|