1 相机查看增加曝光/增益默认值

2 料盘搬运改为原来的相机查看料盘中心
3 增加料盘搬运时是否屏蔽真空吸
master
lhiven 1 year ago
parent 831fdc81e2
commit 93ceaf876d

@ -896,5 +896,16 @@ namespace Rs.Framework
return SysConfigParam.GetValue<int>(nameof(TurnoverTrayHaveOrNotGrayArea));
}
}
/// <summary>
/// 料盘搬运屏蔽真空吸
/// </summary>
public static bool TakeTrayDisableVac
{
get
{
return true;
}
}
}
}

@ -29,9 +29,11 @@ namespace Rs.MotionPlat.Flow
,
,
,
,
,
,
,
}
public enum ETakeStatus
@ -101,14 +103,14 @@ namespace Rs.MotionPlat.Flow
case ETakeTrayFlowStep.:
//double centerX = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterX");
//double centerY = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterY");
//double cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
//double cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
double cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
double cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
targetX = SysConfigParam.GetValue<double>($"{m_fromTray.ToString()}TakeTrayX");
targetY = SysConfigParam.GetValue<double>($"{m_fromTray.ToString()}TakeTrayY");
Motion.ErrorCode errCode = AxisControl.LoadX.MovePos(targetX, GlobalVar.TakeTraySpeed);
Motion.ErrorCode errCode = AxisControl.LoadX.MovePos(targetX + cameraCenterX, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
errCode = AxisControl.LoadY.MovePos(targetY, GlobalVar.TakeTraySpeed);
errCode = AxisControl.LoadY.MovePos(targetY+ cameraCenterY, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)
@ -159,17 +161,23 @@ namespace Rs.MotionPlat.Flow
logInfo =GetClassName()+ $"检测上下气缸动位OK";
MessageQueue.Instance.Insert(logInfo);
stopwatch.Stop();
Ops.On("夹爪真空吸");
logInfo = GetClassName() + $"打开夹爪夹爪真空吸";
Ops.On("夹爪气缸电磁阀");
logInfo = GetClassName() + $"夹爪气缸on";
MessageQueue.Instance.Insert(logInfo);
Thread.Sleep(150);
Thread.Sleep(1000);
if (!GlobalVar.TakeTrayDisableVac)
{
Ops.On("夹爪真空吸");
logInfo = GetClassName() + $"打开夹爪夹爪真空吸";
MessageQueue.Instance.Insert(logInfo);
}
Ops.Off($"{(int)m_fromTray}号料仓斜推气缸");
logInfo = GetClassName() + $"关闭{m_fromTray}号料仓斜推气缸";
MessageQueue.Instance.Insert(logInfo);
Ops.Off($"{(int)m_toTray}号料仓斜推气缸");
logInfo = GetClassName() + $"关闭{m_toTray}号料仓斜推气缸";
MessageQueue.Instance.Insert(logInfo);
Thread.Sleep(200);
step = ETakeTrayFlowStep.;
}
else if (stopwatch.ElapsedMilliseconds > 5000)
@ -198,7 +206,14 @@ namespace Rs.MotionPlat.Flow
{
logInfo = $"检测到上下气缸原位OK";
stopwatch.Restart();
step = ETakeTrayFlowStep.;
if(GlobalVar.TakeTrayDisableVac)
{
step = ETakeTrayFlowStep.;
}
else
{
step = ETakeTrayFlowStep.;
}
}
}
else
@ -246,15 +261,15 @@ namespace Rs.MotionPlat.Flow
//centerX = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterX");
//centerY = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterY");
//cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
//cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
targetX = SysConfigParam.GetValue<double>($"{m_toTray.ToString()}TakeTrayX");
targetY = SysConfigParam.GetValue<double>($"{m_toTray.ToString()}TakeTrayY");
errCode = AxisControl.LoadX.MovePos(targetX+2, GlobalVar.TakeTraySpeed);
errCode = AxisControl.LoadX.MovePos(targetX+ cameraCenterX, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
errCode = AxisControl.LoadY.MovePos(targetY - 1, GlobalVar.TakeTraySpeed);
errCode = AxisControl.LoadY.MovePos(targetY+ cameraCenterY - 2, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)
@ -309,18 +324,27 @@ namespace Rs.MotionPlat.Flow
logInfo = GetClassName()+ "检测到上下气缸动位 OK";
MessageQueue.Instance.Insert(logInfo);
stopwatch.Stop();
Ops.Off("夹爪真空吸");
logInfo = GetClassName() + "夹爪真空吸 off";
MessageQueue.Instance.Insert(logInfo);
Thread.Sleep(10);
Ops.On("夹爪真空破");
logInfo = GetClassName() + "夹爪真空破 on";
MessageQueue.Instance.Insert(logInfo);
Thread.Sleep(200);
Ops.Off("夹爪真空破");
logInfo = GetClassName() + "夹爪真空破 off";
if(!GlobalVar.TakeTrayDisableVac)
{
Ops.Off("夹爪真空吸");
logInfo = GetClassName() + "夹爪真空吸 off";
MessageQueue.Instance.Insert(logInfo);
Thread.Sleep(10);
Ops.On("夹爪真空破");
logInfo = GetClassName() + "夹爪真空破 on";
MessageQueue.Instance.Insert(logInfo);
Thread.Sleep(200);
Ops.Off("夹爪真空破");
logInfo = GetClassName() + "夹爪真空破 off";
MessageQueue.Instance.Insert(logInfo);
}
Ops.Off("夹爪气缸电磁阀");
logInfo = GetClassName() + $"夹爪气缸off";
MessageQueue.Instance.Insert(logInfo);
step = ETakeTrayFlowStep.;
Thread.Sleep(1000);
stopwatch.Restart();
step = ETakeTrayFlowStep.;
}
}
else
@ -333,6 +357,24 @@ namespace Rs.MotionPlat.Flow
stopwatch.Restart();
}
break;
case ETakeTrayFlowStep.:
if(stopwatch.ElapsedMilliseconds<5000)
{
if(Ops.IsOn("夹爪气缸原位"))
{
step = ETakeTrayFlowStep.;
}
}
else
{
logInfo = "夹爪气缸原位检测异常,请处理后点击确定";
MessageQueue.Instance.Warn(GetClassName() + logInfo);
TestCenterMessageBox.Show(AlarmConstID.UpDownCylinderExceptionAlarm, logInfo, ETipButton.Ok);
TestCenterMessageBox.WaitResult(AlarmConstID.UpDownCylinderExceptionAlarm);
stopwatch.Stop();
stopwatch.Restart();
}
break;
case ETakeTrayFlowStep.:
Ops.Off("上下气缸电磁阀动位");
logInfo = GetClassName() + "上下气缸电磁阀动位 off";
@ -346,7 +388,15 @@ namespace Rs.MotionPlat.Flow
case ETakeTrayFlowStep.:
if (Ops.IsOn("上下气缸原位") || GlobalVar.VirtualAxis)
{
step = ETakeTrayFlowStep.;
if(GlobalVar.TakeTrayDisableVac)
{
step = ETakeTrayFlowStep.;
}
else
{
step = ETakeTrayFlowStep.;
}
}
break;
case ETakeTrayFlowStep.:
@ -354,9 +404,7 @@ namespace Rs.MotionPlat.Flow
{
logInfo = GetClassName()+$"放料盘完成,料盘搬运结束";
MessageQueue.Instance.Insert(logInfo);
finisehd = true;
TakeStatus = ETakeStatus.TakeOK;
dumpTrayFinishedEvent?.Invoke();
step = ETakeTrayFlowStep.;
//if (mLoadUnloadType == ELoadUnloadType.Load)
//{
// StockManager.Instance.Load(m_toTray, EStockTrayLoadMode.AfterTakeTray);
@ -372,6 +420,11 @@ namespace Rs.MotionPlat.Flow
step = ETakeTrayFlowStep.;
}
break;
case ETakeTrayFlowStep.:
finisehd = true;
TakeStatus = ETakeStatus.TakeOK;
dumpTrayFinishedEvent?.Invoke();
break;
}
Thread.Sleep(10);
}

@ -910,7 +910,6 @@
this.groupBox5.TabIndex = 47;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Dist";
this.groupBox5.Visible = false;
//
// btnSaveDist
//

@ -39,8 +39,8 @@ namespace Rs.MotionPlat.SysConfig
try
{
ImageProcess.ClearManualTrigger();
HikCamera.Instance.SetExposure("upCamera", GlobalVar.UpCameraExposureTime);
HikCamera.Instance.SetGain("upCamera", GlobalVar.UpCameraGain);
HikCamera.Instance.SetExposure("upCamera", float.Parse(txtUpCameraExposureTime.Text));
HikCamera.Instance.SetGain("upCamera", float.Parse(txtUpCameraGain.Text));
HikCamera.Instance.SetTrigger("upCamera", ETriggerMode.Manual);
AxisControl.LoadX.ComparePulse(2, false);
HObject image = null;

@ -35,16 +35,16 @@
this.btnDownCameraGrab = new System.Windows.Forms.Button();
this.btnUpCameraGrab = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.himgNozzle8 = new ChoiceTech.Halcon.Control.HWindow_Final();
this.label4 = new System.Windows.Forms.Label();
this.txtUpCameraExposureTime = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.txtDownCameraGain = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtUpCameraGain = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtDownCameraExposureTime = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtDownCameraGain = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtUpCameraExposureTime = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
@ -134,6 +134,20 @@
this.panel2.Size = new System.Drawing.Size(633, 748);
this.panel2.TabIndex = 4;
//
// himgNozzle8
//
this.himgNozzle8.BackColor = System.Drawing.Color.Transparent;
this.himgNozzle8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.himgNozzle8.Dock = System.Windows.Forms.DockStyle.Fill;
this.himgNozzle8.DrawModel = false;
this.himgNozzle8.ForeColor = System.Drawing.Color.White;
this.himgNozzle8.Image = null;
this.himgNozzle8.Location = new System.Drawing.Point(0, 0);
this.himgNozzle8.Margin = new System.Windows.Forms.Padding(4);
this.himgNozzle8.Name = "himgNozzle8";
this.himgNozzle8.Size = new System.Drawing.Size(633, 701);
this.himgNozzle8.TabIndex = 15;
//
// panel3
//
this.panel3.Controls.Add(this.txtDownCameraGain);
@ -150,37 +164,42 @@
this.panel3.Size = new System.Drawing.Size(633, 47);
this.panel3.TabIndex = 14;
//
// himgNozzle8
// txtDownCameraGain
//
this.himgNozzle8.BackColor = System.Drawing.Color.Transparent;
this.himgNozzle8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.himgNozzle8.Dock = System.Windows.Forms.DockStyle.Fill;
this.himgNozzle8.DrawModel = false;
this.himgNozzle8.ForeColor = System.Drawing.Color.White;
this.himgNozzle8.Image = null;
this.himgNozzle8.Location = new System.Drawing.Point(0, 0);
this.himgNozzle8.Margin = new System.Windows.Forms.Padding(4);
this.himgNozzle8.Name = "himgNozzle8";
this.himgNozzle8.Size = new System.Drawing.Size(633, 701);
this.himgNozzle8.TabIndex = 15;
this.txtDownCameraGain.Location = new System.Drawing.Point(556, 16);
this.txtDownCameraGain.Name = "txtDownCameraGain";
this.txtDownCameraGain.Size = new System.Drawing.Size(65, 21);
this.txtDownCameraGain.TabIndex = 3;
this.txtDownCameraGain.Text = "8";
this.txtDownCameraGain.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtDownCameraGain_KeyUp);
//
// label4
// label3
//
this.label4.AutoSize = true;
this.label4.ForeColor = System.Drawing.Color.White;
this.label4.Location = new System.Drawing.Point(12, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(71, 12);
this.label4.TabIndex = 2;
this.label4.Text = "上相机曝光:";
this.label3.AutoSize = true;
this.label3.ForeColor = System.Drawing.Color.White;
this.label3.Location = new System.Drawing.Point(482, 20);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(71, 12);
this.label3.TabIndex = 2;
this.label3.Text = "下相机增益:";
//
// txtUpCameraExposureTime
// txtUpCameraGain
//
this.txtUpCameraExposureTime.Location = new System.Drawing.Point(86, 12);
this.txtUpCameraExposureTime.Name = "txtUpCameraExposureTime";
this.txtUpCameraExposureTime.Size = new System.Drawing.Size(65, 21);
this.txtUpCameraExposureTime.TabIndex = 3;
this.txtUpCameraExposureTime.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtUpCameraExposureTime_KeyUp);
this.txtUpCameraGain.Location = new System.Drawing.Point(237, 13);
this.txtUpCameraGain.Name = "txtUpCameraGain";
this.txtUpCameraGain.Size = new System.Drawing.Size(65, 21);
this.txtUpCameraGain.TabIndex = 3;
this.txtUpCameraGain.Text = "3";
this.txtUpCameraGain.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtUpCameraGain_KeyUp);
//
// txtDownCameraExposureTime
//
this.txtDownCameraExposureTime.Location = new System.Drawing.Point(405, 15);
this.txtDownCameraExposureTime.Name = "txtDownCameraExposureTime";
this.txtDownCameraExposureTime.Size = new System.Drawing.Size(65, 21);
this.txtDownCameraExposureTime.TabIndex = 3;
this.txtDownCameraExposureTime.Text = "50";
this.txtDownCameraExposureTime.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtDownCameraExposureTime_KeyUp);
//
// label1
//
@ -192,14 +211,6 @@
this.label1.TabIndex = 2;
this.label1.Text = "上相机增益:";
//
// txtUpCameraGain
//
this.txtUpCameraGain.Location = new System.Drawing.Point(237, 13);
this.txtUpCameraGain.Name = "txtUpCameraGain";
this.txtUpCameraGain.Size = new System.Drawing.Size(65, 21);
this.txtUpCameraGain.TabIndex = 3;
this.txtUpCameraGain.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtUpCameraGain_KeyUp);
//
// label2
//
this.label2.AutoSize = true;
@ -210,31 +221,24 @@
this.label2.TabIndex = 2;
this.label2.Text = "下相机曝光:";
//
// txtDownCameraExposureTime
//
this.txtDownCameraExposureTime.Location = new System.Drawing.Point(405, 15);
this.txtDownCameraExposureTime.Name = "txtDownCameraExposureTime";
this.txtDownCameraExposureTime.Size = new System.Drawing.Size(65, 21);
this.txtDownCameraExposureTime.TabIndex = 3;
this.txtDownCameraExposureTime.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtDownCameraExposureTime_KeyUp);
//
// label3
// txtUpCameraExposureTime
//
this.label3.AutoSize = true;
this.label3.ForeColor = System.Drawing.Color.White;
this.label3.Location = new System.Drawing.Point(482, 20);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(71, 12);
this.label3.TabIndex = 2;
this.label3.Text = "下相机增益:";
this.txtUpCameraExposureTime.Location = new System.Drawing.Point(86, 12);
this.txtUpCameraExposureTime.Name = "txtUpCameraExposureTime";
this.txtUpCameraExposureTime.Size = new System.Drawing.Size(65, 21);
this.txtUpCameraExposureTime.TabIndex = 3;
this.txtUpCameraExposureTime.Text = "50";
this.txtUpCameraExposureTime.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtUpCameraExposureTime_KeyUp);
//
// txtDownCameraGain
// label4
//
this.txtDownCameraGain.Location = new System.Drawing.Point(556, 16);
this.txtDownCameraGain.Name = "txtDownCameraGain";
this.txtDownCameraGain.Size = new System.Drawing.Size(65, 21);
this.txtDownCameraGain.TabIndex = 3;
this.txtDownCameraGain.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtDownCameraGain_KeyUp);
this.label4.AutoSize = true;
this.label4.ForeColor = System.Drawing.Color.White;
this.label4.Location = new System.Drawing.Point(12, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(71, 12);
this.label4.TabIndex = 2;
this.label4.Text = "上相机曝光:";
//
// LookCamera
//

@ -214,8 +214,10 @@ namespace Rs.MotionPlat.SysConfig
tostock = ETrayType.Empty2;
StockManager.Instance.GetStock(fromstock).Load(EStockTrayLoadMode.Whole, null);
TakeTrayFlow.Instance.Take(fromstock, tostock,
null,
null,
() => {
StockManager.Instance.GetStock(fromstock).ChangeStatus(EStockTrayStatus.Unloaded);
},
() => {
StockManager.Instance.GetStock(tostock).Unload(EStockTrayUnLoadMode.Whole, null);
});

Loading…
Cancel
Save