Beispiel #1
0
 /// <summary>
 /// 保存修改下发机器人速度
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSaveRobotSpeed_Click(object sender, EventArgs e)
 {
     //更新全局变量
     Global.RobotAutoSpeed   = Convert.ToInt32(nudRobotAutoSpeed.Value);
     Global.RobotManualSpeed = Convert.ToInt32(nudRobotManualSpeed.Value);
     Global.RobotMoveSpeed   = Convert.ToInt32(nudRobotMoveSpeed.Value);
     //保存至INI文件
     Global.AProductINI.IniWriteValue("机器人参数", "机器人自动速度", Global.RobotAutoSpeed.ToString());
     Global.AProductINI.IniWriteValue("机器人参数", "机器人手动速度", Global.RobotManualSpeed.ToString());
     Global.AProductINI.IniWriteValue("机器人参数", "机器人插补速度", Global.RobotMoveSpeed.ToString());
     //下发至机器人全局保存变量
     FrmIniRobot.RobotSpel.SetVar("AutoSpeed", Global.RobotAutoSpeed);
     FrmIniRobot.RobotSpel.SetVar("ManualSpeed", Global.RobotManualSpeed);
     FrmIniRobot.RobotSpel.SetVar("MoveSpeed", Global.RobotMoveSpeed);
     //实时修改机器人速度
     if (Global.RobotReady)
     {
         if (FrmIniRobot.RobotSpel.MemSw("AutoMode"))
         {
             FrmIniRobot.RobotSpeed(Global.RobotAutoSpeed, Global.RobotMoveSpeed);
         }
         else
         {
             FrmIniRobot.RobotSpeed(Global.RobotManualSpeed, Global.RobotMoveSpeed);
         }
     }
     showMeesage("机器人速度下发成功", 1);
 }
Beispiel #2
0
        private void tsbtnExit_Click(object sender, EventArgs e)  //退出系统
        {
            if (MessageBox.Show("是否退出系统?", "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Common.myLog.writeOperateContent("退出系统", Global.UserPermission, Global.UserPermission);
                IO.PLCReceiveStart = false; //关闭刷新IO线程
                statusToolsStart   = false; //关闭状态栏刷新线程
                if (Global.RobotReady)
                {
                    FrmIniRobot.RobotDisconnect();
                }
                FrmIniRobot.RobotSpel.Dispose();//释放机器人SKD资源
                if (Global.ConnectSuccess1)
                {
                    smart200_1.Write(Global.M_AutoMode, false); //切换手动模式
                    smart200_1.Write(Global.M_ManualMode, true);
                    smart200_1.ConnectClose();                  //关闭与PLC1的连接
                }

                if (Global.ConnectSuccess2)
                {
                    smart200_2.ConnectClose();//关闭与PLC2的连接
                }
                Application.DoEvents();
                Application.Exit();
            }
        }
Beispiel #3
0
        /// <summary>
        /// 下载至机器人
        /// </summary>
        private void downloadRobotVar()
        {
            try
            {
                if (Global.RobotReady)
                {
                    FrmIniRobot.RobotSpel.SetVar("GrapDelayTime", Global.RobotGripDelay / 1000);
                    FrmIniRobot.RobotSpel.SetVar("CamDelay", Global.CamDelay / 1000);
                    FrmIniRobot.RobotSpel.SetVar("AutoSpeed", Global.RobotAutoSpeed);
                    FrmIniRobot.RobotSpel.SetVar("ManualSpeed", Global.RobotManualSpeed);
                    FrmIniRobot.RobotSpel.SetVar("MoveSpeed", Global.RobotMoveSpeed);
                    FrmIniRobot.RobotSpel.SetVar("zh", Global.RobotSafeHeight);
                    FrmIniRobot.RobotSpel.SetVar("CamNGLimit", Global.CamNGlimit);
                    FrmIniRobot.RobotSpel.SetVar("ProductVNSelect$", Global.CamProductSelect);
                    FrmIniRobot.RobotSpel.SetVar("PhotoSavePath$", Global.PhotoSavePath);
                    FrmIniRobot.RobotSendBool("CamUpAEnable", Global.CamAUpEnable);
                    FrmIniRobot.RobotSendBool("CamDownAEnable", Global.CamADownEnable);
                    FrmIniRobot.RobotSendBool("CamUpBEnable", Global.CamBUpEnable);
                    FrmIniRobot.RobotSendBool("CamDownBEnable", Global.CamBDownEnable);
                    FrmIniRobot.RobotSendBool("PhotoPassSaveEnable", Global.PhotoPassSaveEnable);
                    FrmIniRobot.RobotSendBool("PhotoNGSaveEnable", Global.PhotoNGSaveEnable);
                    FrmIniRobot.RobotSendBool("CamDownExceedEnable", Global.CamDownExceedEnable);

                    showMeesage("下载至机器人成功", 0);
                }
                else
                {
                    showMeesage("参数已保存,机器人未连接,未下载!", 1);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                showMeesage("下载至机器人失败", 1);
            }
        }
Beispiel #4
0
 private void btnRobotStart_Click(object sender, EventArgs e)
 {
     FrmIniRobot.RobotStar(true);
 }