| | |
| | | namespace A032.Process.Calibration |
| | | { |
| | | [Device("Calibration_9P_Dynamic", "动态9点标定", EnumHelper.DeviceAttributeType.OperationConfigCtrl)] |
| | | public partial class CtrlCalib9PDynamic : UserControl, IConfigCtrl<CameraBase, CalibrationConfigCollection> |
| | | public partial class CtrlCalib9PDynamic : UserControl//, IConfigCtrl<CameraBase, CalibrationConfigCollection> |
| | | { |
| | | PubSubCenter PubSubCenter = PubSubCenter.GetInstance(); |
| | | AutoResetEvent _confirmHandle = new AutoResetEvent(false); |
| | |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | public CtrlCalib9PDynamic(ProcessControl process, IDevice device, IOperationConfig config, Action<List<CalibrationConfig>> finalCalculation) |
| | | public CtrlCalib9PDynamic(ProcessControl process, CalibrationConfigCollection calibConfig, AGVBindUnit bind, PathPosition position, Action<CalibrationConfigCollection, AGVBindUnit, PathPosition> finalCalculation) |
| | | { |
| | | InitializeComponent(); |
| | | |
| | | ProcessControl = process; |
| | | Camera = device as CameraBase; |
| | | Config = config as CalibrationConfigCollection; |
| | | |
| | | Config = calibConfig as CalibrationConfigCollection; |
| | | |
| | | Camera = bind.Camera as CameraBase; |
| | | |
| | | Bind = bind; |
| | | Position = position; |
| | | FinalCalculation = finalCalculation; |
| | | } |
| | | |
| | | public CalibrationConfigCollection Config { get; set; } |
| | | public CameraBase Camera { get; set; } |
| | | public ProcessControl ProcessControl { get; set; } |
| | | public Action<List<CalibrationConfig>> FinalCalculation { get; set; } |
| | | AGVBindUnit Bind { get; set; } |
| | | PathPosition Position { get; set; } |
| | | Action<AGVBindUnit, int, int> CommuAction; |
| | | CalibrationConfigCollection Config { get; set; } |
| | | CameraBase Camera { get; set; } |
| | | ProcessControl ProcessControl { get; set; } |
| | | Action<CalibrationConfigCollection, AGVBindUnit, PathPosition> FinalCalculation { get; set; } |
| | | |
| | | public CalibrationConfigCollection GetConfig() |
| | | { |
| | |
| | | |
| | | _canvas.LoadImage(Config.Configs[index].Image); |
| | | _canvas.Elements.Clear(); |
| | | CrossHair ch = new CrossHair(new CalibrationPoint(Config.Configs[index].ImageMarkPoint, Config.Configs[index].CurrentPlatPoint)); |
| | | var config = Config.Configs[index]; |
| | | CrossHair ch = new CrossHair(new CalibrationPoint(new CustomizedPoint(config.ImageMarkPoint.X, config.ImageMarkPoint.Y), new CustomizedPoint(config.PlatPoint.X, config.PlatPoint.Y))); |
| | | _canvas.Elements.Add(ch); |
| | | |
| | | tsslInfo.Text = $"步骤{index + 1}完成"; |
| | | |
| | | if (chkManualConfirm.Checked) |
| | | { |
| | | this.Invoke(new Action(() => btnContinueCalib.Visible = true)); ; |
| | | this.Invoke(new Action(() => btnContinueCalib.Visible = true)); ; |
| | | _confirmHandle.WaitOne(); |
| | | } |
| | | |
| | |
| | | { |
| | | _canvas.LoadImage(stepConfig.Image); |
| | | _canvas.Elements.Clear(); |
| | | _canvas.Elements.Add(new CrossHair(new CalibrationPoint(stepConfig.ImageMarkPoint, stepConfig.CurrentPlatPoint))); |
| | | |
| | | CrossHair ch = new CrossHair(new CalibrationPoint(new CustomizedPoint(stepConfig.ImageMarkPoint.X, stepConfig.ImageMarkPoint.Y), new CustomizedPoint(stepConfig.PlatPoint.X, stepConfig.PlatPoint.Y))); |
| | | _canvas.Elements.Add(ch); |
| | | } |
| | | } |
| | | |
| | | private void btnStartCalib_Click(object sender, EventArgs e) |
| | | { |
| | | if (chkOfflineCalib.Checked) |
| | | { |
| | | //ProcessControl.Calibration_Pick_9P_Dynamic_Offline(Config.Configs); |
| | | } |
| | | else |
| | | { |
| | | //ProcessControl.SendCalibStartSignal(Config.TriggerAddress); |
| | | } |
| | | //if (chkOfflineCalib.Checked) |
| | | //{ |
| | | // //ProcessControl.Calibration_Pick_9P_Dynamic_Offline(Config.Configs); |
| | | //} |
| | | //else |
| | | //{ |
| | | // //ProcessControl.SendCalibStartSignal(Config.TriggerAddress); |
| | | //} |
| | | |
| | | ProcessControl.MultipleStepsProcess(Config, Bind); |
| | | } |
| | | |
| | | private void btnLoadOfflineImages_Click(object sender, EventArgs e) |
| | |
| | | |
| | | private void btnStepRun_Click(object sender, EventArgs e) |
| | | { |
| | | //CalibrationConfig config = propGridConfig.SelectedObject as CalibrationConfig; |
| | | CalibrationConfig config = propGridConfig.SelectedObject as CalibrationConfig; |
| | | //if (!chkOfflineRun.Checked) |
| | | //{ |
| | | // ProcessControl.CalibMarkPoint(Camera, config, _selectedStepIndex + 1); |
| | |
| | | //} |
| | | |
| | | //tsslInfo.Text = $"单步运算完成。标记点坐标:{config.ImageMarkPoint.X},{config.ImageMarkPoint.Y}"; |
| | | |
| | | ProcessControl.SingleStepProcess(config, Bind, _selectedStepIndex); |
| | | tsslInfo.Text = $"单步运算完成。标记点坐标:{config.ImageMarkPoint.X},{config.ImageMarkPoint.Y}"; |
| | | } |
| | | |
| | | private void btnCalcuMatrix_Click(object sender, EventArgs e) |
| | | { |
| | | FinalCalculation.Invoke(Config.Configs); |
| | | FinalCalculation.Invoke(Config, Bind, Position); |
| | | } |
| | | |
| | | private void btnSnap_Click(object sender, EventArgs e) |