Exemple #1
0
        //SetGlobal?: 設定全域變數
        public string getStatusAll()
        {
            if ((ConnectStatus & CONNECTTYPE.CONNECTED) == 0)
            {
                return("");
            }
            try
            {
                //P.55 Acquires all the statuses of the robot.
                TsStatusAllS status = _Robot.GetStatusAll();
                //int JogCoordnate JOG-guided coordinate selection status
                //  0=Joint; 1=Tool; 2=Work; 3=World
                //Console.Write(status.JogCoordnate + ", ");

                //int MasterMode Master mode status
                //  0=Teaching; 1=Internal; 2=Ext.Sig; 3=Ext.Host(Ext.232C/ExtEther)
                //Console.Write(status.MasterMode + ", ");

                //int ServoStatus Servo status: 0=OFF; 1=ON
                //Console.Write(status.ServoStatus + ", ");

                //int EmergencySwitch Emergency Stop switch status: 0=OFF; 1=ON
                //Console.Write(status.EmergencySwitch + ", ");

                //int JogCoordnate JOG-guided coordinate selection status: 0=Joint; 1=Tool; 2=Work; 3=World
                //Console.Write(status.JogCoordnate + ", ");

                string messages = "";
                if (status.ServoStatus == 0)
                {
                    messages += "ServoStatus=OFF";
                }
                else
                {
                    messages += "ServoStatus=ON";
                }
                if (status.EmergencySwitch == 0)
                {
                    messages += "\nEmergencySwitch=OFF";
                }
                else
                {
                    messages += "\nEmergencySwitch=ON";
                }
                if (status.MasterMode == 0)
                {
                    messages += "\nMasterMode=Teaching";
                }
                else if (status.MasterMode == 1)
                {
                    messages += "\nMasterMode=Internal";
                }
                else if (status.MasterMode == 2)
                {
                    messages += "\nMasterMode=Ext.Sig";
                }
                else if (status.MasterMode == 3)
                {
                    messages += "\nMasterMode=Ext.Host(Ext.232C/ExtEther)";
                }
                else
                {
                    messages += "\nMasterMode=?";
                }
                if (status.JogCoordnate == 0)
                {
                    messages += "\nJogCoordnate=Joint";
                }
                else if (status.JogCoordnate == 1)
                {
                    messages += "\nJogCoordnate=Tool";
                }
                else if (status.JogCoordnate == 2)
                {
                    messages += "\nJogCoordnate=Work";
                }
                else if (status.JogCoordnate == 3)
                {
                    messages += "\nJogCoordnate=World";
                }
                else
                {
                    messages += "\nJogCoordnate=?";
                }

                //整體速度限制
                TsStatusMonitor status_m = _Robot.GetStatusMonitor();
                messages += "\nOverride=" + status_m.Override;

                return(messages);
            }
            catch (TsRemoteSException ex)
            {
                //Error processing
                Console.WriteLine("getStatusAll: " + ex.Message);
            }
            return("");
        }