private void buttonRotateDec_Click(object sender, EventArgs e) { var btn = (Button)sender; if (isXyzMode) { if (btn.Text.Contains("X")) { DensoControl.Only().Rotate1(1, -int.Parse(textBoxXRotateStep.Text)); } if (btn.Text.Contains("Y")) { DensoControl.Only().Rotate1(2, -int.Parse(textBoxYRotateStep.Text)); } if (btn.Text.Contains("Z")) { DensoControl.Only().Rotate1(3, -int.Parse(textBoxZRotateStep.Text)); } } else { if (btn.Text.Contains("4")) { DensoControl.Only().MoveObjectAng(1, 4, -int.Parse(textBoxXRotateStep.Text)); } if (btn.Text.Contains("5")) { DensoControl.Only().MoveObjectAng(1, 5, -int.Parse(textBoxYRotateStep.Text)); } if (btn.Text.Contains("6")) { DensoControl.Only().MoveObjectAng(1, 6, -int.Parse(textBoxZRotateStep.Text)); } } }
private void buttonMoveZInc_Click(object sender, EventArgs e) { int step; if (int.TryParse(textBoxZStep.Text, out step)) { if (isXyzMode) { if (step > 0 && step < 500) { DensoControl.Only().MoveObjectPos(1, 3, step); return; } } else { if (step > 0 && step < 30) { DensoControl.Only().MoveObjectAng(1, 3, step); return; } } } MessageBox.Show("Step not in Range!"); }
private void buttonClearError_Click(object sender, EventArgs e) { //if (MessageBox.Show("Move Robot Home?", "Home", // MessageBoxButtons.OKCancel, // MessageBoxIcon.Question, // MessageBoxDefaultButton.Button1) // == DialogResult.OK) //{ // DensoControl.Only().GoHome(); //} DensoControl.Only().Controller.ClearError(); DensoControl.Only().TakeArm(); }
private void buttonMoveJ2_Click(object sender, EventArgs e) { int p; if (int.TryParse(textBoxJ2.Text, out p) && p >= 10 && p < 100) { DensoControl.Only().Robot.MoveJ(2, p); } else { MessageBox.Show("Point Index Not In Range!"); } }
private void buttonExtSpeed_Click(object sender, EventArgs e) { int speed; if (int.TryParse(textBoxSetExtSpeed.Text, out speed) && speed > 0 && speed <= 90) { DensoControl.Only().Robot.ExtSpeed(speed); } else { MessageBox.Show("Speed Not In Range!"); } }
private void buttonConnect_Click(object sender, EventArgs e) { DensoControl.Only().Init(); if (!DensoControl.Only().IsInitialized) { return; } //init ui //Controller dataGridViewController.Rows.Clear(); foreach (var s in DensoController.ControllerVarStrings) { dataGridViewController.Rows.Add(s); } //P foreach (var p in DensoControl.Only().Controller.ControllerPointsPVars) { dataGridViewPointsP.Rows.Add(p.Key); } //J foreach (var p in DensoControl.Only().Controller.ControllerPointsJVars) { dataGridViewPointsJ.Rows.Add(p.Key); } //Robot dataGridViewRobot.Rows.Clear(); foreach (var s in DensoRobot.RobotVarStrings) { dataGridViewRobot.Rows.Add(s); } ////Task //dataGridViewTask.Rows.Clear(); //foreach (var s in DensoTask.TaskVarStrings) //{ // dataGridViewTask.Rows.Add(s); //} timerUpdate.Interval = 800; timerUpdate.Enabled = true; }
private void buttonTeach_Click(object sender, EventArgs e) { if (DensoControl.Only().Controller.ControllerPointsPVars.ContainsKey(comboBoxPointIndex.Text)) { DensoControl.Only().Controller.ControllerPointsPVars[comboBoxPointIndex.Text].Value = DensoControl.Only().Robot.CurPosVar.Value; MessageBox.Show("Teach " + comboBoxPointIndex.Text + ":" + DensoControl.GetPString(DensoControl.Only().Robot.CurPosVar)); } if (DensoControl.Only().Controller.ControllerPointsJVars.ContainsKey(comboBoxJointIndex.Text)) { DensoControl.Only().Controller.ControllerPointsJVars[comboBoxJointIndex.Text].Value = DensoControl.Only().Robot.CurAngVar.Value; MessageBox.Show("Teach " + comboBoxJointIndex.Text + ":" + DensoControl.GetJString(DensoControl.Only().Robot.CurAngVar)); } }
public static DensoControl Only() { return(ins ?? (ins = new DensoControl())); }
private void timerUpdate_Tick(object sender, EventArgs e) { #region //controller status try { textBoxMode.Text = DensoControl.Only().Controller.ControllerCaoVars["@MODE"].Value.ToString(); } catch (Exception) { textBoxMode.Text = "?"; } try { textBoxAutoMode.Text = DensoControl.Only().Controller.ControllerCaoVars["@AUTO_ENABLE"].Value.ToString(); } catch (Exception) { textBoxAutoMode.Text = "?"; } try { textBoxEmgency.Text = DensoControl.Only().Controller.ControllerCaoVars["@EMERGENCY_STOP"].Value.ToString(); } catch (Exception) { textBoxEmgency.Text = "?"; } try { textBoxNormalStatus.Text = DensoControl.Only().Controller.ControllerCaoVars["@NORMAL_STATUS"].Value.ToString(); } catch (Exception) { textBoxNormalStatus.Text = "?"; } try { textBoxErrorCode.Text = DensoControl.Only().Controller.ControllerCaoVars["@ERROR_CODE"].Value.ToString(); } catch (Exception) { textBoxErrorCode.Text = "?"; } try { textBoxErrorCodeInfo.Text = DensoControl.Only().Controller.ControllerCaoVars["@ERROR_DESCRIPTION"].Value.ToString(); } catch (Exception) { textBoxErrorCodeInfo.Text = "?"; } ////robot slave task //try //{ // textBoxRobotSlaveTask.Text = DensoControl.Only().RobslaveTask.TaskCaoVars["@STATUS"].Value.ToString(); //} //catch (Exception) //{ // textBoxRobotSlaveTask.Text = "?"; //} //robot status try { textBoxMotorStatus.Text = DensoControl.Only().Robot.RobCaoVars["@SERVO_ON"].Value.ToString(); } catch (Exception) { textBoxMotorStatus.Text = "???"; } try { textBoxBusyStatus.Text = DensoControl.Only().Robot.RobCaoVars["@BUSY_STATUS"].Value.ToString(); } catch (Exception) { textBoxBusyStatus.Text = "???"; } try { // Current Position textBoxCurPos.Text = DensoControl.GetPString(DensoControl.Only().Robot.RobCaoVars["@CURRENT_POSITION"]); } catch (Exception) { textBoxCurPos.Text = "P(?,?,?,?,?,?,?)"; } try { // Current Position textBoxCurAngle.Text = DensoControl.GetJString(DensoControl.Only().Robot.RobCaoVars["@CURRENT_ANGLE"]); } catch (Exception) { textBoxCurAngle.Text = "J(?,?,?,?,?,?,?)"; } try { // Current Position textBoxCurTrans.Text = DensoControl.GetTString(DensoControl.Only().Robot.RobCaoVars["@CURRENT_TRANS"]); } catch (Exception) { textBoxCurTrans.Text = "T(?,?,?,?,?,?,?,?,?,?)"; } try { textBoxWorkStatus.Text = DensoControl.Only().Robot.RobCaoVars["@CURRENT_WORK"].Value.ToString(); } catch (Exception) { textBoxWorkStatus.Text = "???"; } try { textBoxToolStatus.Text = DensoControl.Only().Robot.RobCaoVars["@CURRENT_TOOL"].Value.ToString(); } catch (Exception) { textBoxToolStatus.Text = "???"; } try { textBoxSpeed.Text = DensoControl.Only().Robot.RobCaoVars["@SPEED"].Value.ToString(); } catch (Exception) { textBoxSpeed.Text = "???"; } try { textBoxExtSpeed.Text = DensoControl.Only().Robot.RobCaoVars["@EXTSPEED"].Value.ToString(); } catch (Exception) { textBoxExtSpeed.Text = "???"; } #endregion var sts = DensoControl.Only().ControllerStatus; for (var i = 0; i < sts.Count; i++) { dataGridViewController.Rows[i].Cells[1].Value = sts[i]; } var sts1 = DensoControl.Only().RobotStatus; for (var i = 0; i < sts1.Count; i++) { dataGridViewRobot.Rows[i].Cells[1].Value = sts1[i]; } if (timerIndex++ > 5) { timerIndex = 0; for (var i = 0; i < DensoControl.Only().Controller.ControllerPointsPVars.Count; i++) { var str = DensoControl.GetPString(DensoControl.Only().Controller.ControllerPointsPVars["P" + i]); dataGridViewPointsP.Rows[i].Cells[1].Value = str; } for (var i = 0; i < DensoControl.Only().Controller.ControllerPointsJVars.Count; i++) { var str = DensoControl.GetJString(DensoControl.Only().Controller.ControllerPointsJVars["J" + i]); dataGridViewPointsJ.Rows[i].Cells[1].Value = str; } } //List<string> sts2 = DensoControl.Only().RobslaveTaskStatus; //for (int i = 0; i < sts2.Count; i++) //{ // dataGridViewTask.Rows[i].Cells[1].Value = sts2[i]; //} }
private void buttonDefTool_Click(object sender, EventArgs e) { DensoControl.Only().Robot.DefTool(1, new[] { 0, 0, 0, 0, 0, 0f }); }
private void buttonChangeTool_Click(object sender, EventArgs e) { DensoControl.Only().Robot.ChangeTool(int.Parse(textBoxChangeToolIndex.Text)); }
private void buttonGivearm_Click(object sender, EventArgs e) { DensoControl.Only().GiveArm(); }
private void buttonDisconnect_Click(object sender, EventArgs e) { timerUpdate.Enabled = false; DensoControl.Only().Close(); }
public void DefTool(int index, float[] p) { Execute("DefTool", "1", DensoControl.GetPString(p)); }