RobotStudio event

the success rate of request mastership reached 100%

baijun
baijun
edited October 2016 in Developer Tools
hello, I use the PC SDK to control the robot by changing some values through the .NET SDK. However, requesting Mastership will fail while the RAPID program is running. Referring now to the UAS(the User Authorization System) portion of the PCSDK documentation, the success rate of request reached 100%. C # program consists of two parts of the click event , the function is very simple, respectively change RAPID variable (connected) to true, false.The code is as follows:
Tagged:

Comments

  • C#: private void setTrue_Click(object sender, EventArgs e) { if (controller.OperatingMode == ControllerOperatingMode.Auto) { UserAuthorizationSystem uas = controller.AuthenticationSystem; if (uas.CheckDemandGrant(Grant.ModifyRapidDataValue)) { ABB.Robotics.Controllers.RapidDomain.RapidData rd = controller.Rapid.GetRapidData("T_ROB1", "Server", "connected"); using (Mastership m = Mastership.Request(controller.Rapid)) { rapidBool.Value = true; rd.Value = rapidBool; } } } } private void setFalse_Click(object sender, EventArgs e) { ... rapidBool.Value = false;//As above except true becomes false ... } RAPID: MODULE Server(SYSMODULE) !//////////////// !GLOBAL VARIABLES !//////////////// CONST num WAIT_MAX := 3600;!one hour VAR bool connected;!//pcsdk connected,pcsdk??????TRUE????? !//////////////// !//////////////////////// !//SERVER: Main procedure !//////////////////////// PROC main() connected := FALSE; WHILE TRUE DO WaitUntil connected = TRUE \MaxTime:=WAIT_MAX \PollRate :=0.01; WaitUntil connected = FALSE \MaxTime:=WAIT_MAX \PollRate :=0.01; WaitUntil connected = TRUE \MaxTime:=WAIT_MAX \PollRate :=0.01; WaitUntil connected = FALSE \MaxTime:=WAIT_MAX \PollRate :=0.01; ENDWHILE ENDPROC ENDMODULE
  • C#:
    private void setTrue_Click(object sender, EventArgs e)
    {
    	if (controller.OperatingMode == ControllerOperatingMode.Auto)
    	{
    		UserAuthorizationSystem uas = controller.AuthenticationSystem;
    		if (uas.CheckDemandGrant(Grant.ModifyRapidDataValue))
    		{
    			ABB.Robotics.Controllers.RapidDomain.RapidData rd = controller.Rapid.GetRapidData("T_ROB1", "Server", "connected");
    			using (Mastership m = Mastership.Request(controller.Rapid))
    			{
    				rapidBool.Value = true;
    				rd.Value = rapidBool;
    			}
    
    		}
    
    	}
    }
    
    private void setFalse_Click(object sender, EventArgs e)
    {
    	...
    	rapidBool.Value = false;//As above except true becomes false
    	...
    }
    
    RAPID:
    MODULE Server(SYSMODULE)
    !////////////////
    !GLOBAL VARIABLES
    !////////////////
    
    CONST num WAIT_MAX := 3600;!one hour
    
    VAR bool connected;!//pcsdk connected,pcsdk??????TRUE?????
    
    !////////////////
    !////////////////////////
    !//SERVER: Main procedure
    !////////////////////////
    PROC main()
        connected := FALSE;
        
        WHILE TRUE DO
        WaitUntil connected = TRUE \MaxTime:=WAIT_MAX \PollRate :=0.01;
        WaitUntil connected = FALSE \MaxTime:=WAIT_MAX \PollRate :=0.01;
        WaitUntil connected = TRUE \MaxTime:=WAIT_MAX \PollRate :=0.01;
        WaitUntil connected = FALSE \MaxTime:=WAIT_MAX \PollRate :=0.01;
        ENDWHILE
    ENDPROC
    
    ENDMODULE