コード例 #1
0
 public bool setServoOn()
 {
     if ((ConnectStatus & CONNECTTYPE.CONNECTED) == 0)
     {
         return(false);
     }
     //已經開啟,直接回傳
     if ((ConnectStatus & CONNECTTYPE.SERVOON) > 0)
     {
         return(true);
     }
     try
     {
         //P.78 Sets the servo to ON.
         _Robot.ServoOn();
         TsStatusAllS status = _Robot.GetStatusAll();
         //仍為關閉
         if (status.ServoStatus == 0)
         {
             return(false);
         }
         ConnectStatus |= CONNECTTYPE.SERVOON;
         return(true);
     }
     catch (TsRemoteSException ex)
     {
         //Error processing
         Console.WriteLine("setServoOn: " + ex.Message);
     }
     return(false);
 }
コード例 #2
0
 public bool setServoOff()
 {
     if ((ConnectStatus & CONNECTTYPE.CONNECTED) == 0)
     {
         return(false);
     }
     //已經關閉,直接回傳
     if ((ConnectStatus & CONNECTTYPE.SERVOON) == 0)
     {
         return(true);
     }
     try
     {
         _Robot.ServoOff();
         TsStatusAllS status = _Robot.GetStatusAll();
         //仍為開啟
         if (status.ServoStatus == 1)
         {
             return(false);
         }
         ConnectStatus &= ~CONNECTTYPE.SERVOON;
         return(true);
     }
     catch (TsRemoteSException ex)
     {
         //Error processing
         Console.WriteLine("setServoOff: " + ex.Message);
     }
     return(false);
 }
コード例 #3
0
        public bool checkServo()
        {
            if ((ConnectStatus & CONNECTTYPE.CONNECTED) == 0)
            {
                return(false);
            }

            try
            {
                TsStatusAllS status = _Robot.GetStatusAll();
                if (status.ServoStatus == 1)
                {
                    ConnectStatus |= CONNECTTYPE.SERVOON;
                }
                else
                {
                    ConnectStatus &= ~CONNECTTYPE.SERVOON;
                }
                return(true);
            }
            catch (TsRemoteSException ex)
            {
                //Error processing
                Console.WriteLine("checkServo: " + ex.Message);
            }
            return(false);
        }
コード例 #4
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("");
        }