Control panel & operation mode
Read and change the operation mode, the controller state (motors on/off), the speed ratio, and the collision detection state.
robot.Rws.Panel is the control panel of the controller. It reads and changes what an operator sees on the teach pendant: the operating mode, the state of the motors, the speed the programs run at, and the collision detection.
Operating mode
GetOperationMode returns the mode currently selected on the controller. The mode decides what a remote client is allowed to do. A program is normally started from the network in automatic mode only.
OperationMode | Meaning |
|---|---|
Automatic | Automatic mode, the program runs without an operator in the cell |
ManualReducedSpeed | Manual mode, the operator holds the enabling device |
ManualFullSpeed | Manual mode at full speed |
AutomaticChangeRequest | The change to automatic mode is waiting for an acknowledgement |
ManualFullSpeedChangeRequest | The change to manual full speed is waiting for an acknowledgement |
Init | The controller is starting |
Undefined, Unknown | The controller reports no mode, or one this library does not know |
The mode itself is selected with the key on the cabinet, an application cannot change it. What the SDK can do is confirm a change the operator has already started, with AcknowledgeOperationMode.
OperationMode mode = robot.Rws.Panel.GetOperationMode();switch (mode){case OperationMode.Automatic:Console.WriteLine("Automatic mode, a program can be started remotely");break;case OperationMode.ManualReducedSpeed:case OperationMode.ManualFullSpeed:Console.WriteLine("Manual mode, the operator holds the enabling device");break;case OperationMode.AutomaticChangeRequest:// The key was turned to automatic, the change waits for a confirmationrobot.Rws.Panel.AcknowledgeOperationMode(OperationModeAcknowledgement.Automatic);break;case OperationMode.ManualFullSpeedChangeRequest:robot.Rws.Panel.AcknowledgeOperationMode(OperationModeAcknowledgement.ManualFullSpeed);break;}
The controller refuses the acknowledgement when no change is waiting for one, and when the connected client is not the local client of the controller. Both cases give an RwsException.
OperationModeAcknowledgement.CollisionDetection uses the same method to confirm a collision, see below.
Mode selector lock
The mode selector can be locked with a pin code, so that the mode cannot be changed until the same code is given back.
OperationModeLockState | Meaning |
|---|---|
Unlocked | The operating mode can be changed freely |
Locked | Locked, UnlockOperationMode releases it with the pin code it was locked with |
PermanentlyLocked | Locked for good, the pin code no longer releases it |
PendingPermanentLock | A permanent lock was asked for and is not effective yet |
Error, Unknown | The controller reports an error on the lock, or a state this library does not know |
OperationModeLockState lockState = robot.Rws.Panel.GetOperationModeLockState();Console.WriteLine($"Mode selector : {lockState}");if (lockState == OperationModeLockState.Unlocked){// Four digits, needed again to unlock the selectorrobot.Rws.Panel.LockOperationMode("1234");}else if (lockState == OperationModeLockState.Locked){robot.Rws.Panel.UnlockOperationMode("1234");}// A permanent lock cannot be released with UnlockOperationModerobot.Rws.Panel.LockOperationMode("1234", true);
The pin code is exactly four digits, the SDK throws an ArgumentException for anything else. The permanent lock needs the grant to lock the safety controller configuration on the user account.
A controller built without the key-less mode selector option answers 403 on the three lock methods, including the read. The SDK catches that case and explains it in the message of the RwsException, because the controller error only says that an option is missing.
Motors on and off
GetControllerState reports whether the robot can move. SetControllerState accepts MotorsOn and MotorsOff only, the other values are read only states of the controller and passing one throws an ArgumentException.
ControllerState | Meaning |
|---|---|
MotorsOn | The robot is ready to move, by jogging or by running a program |
MotorsOff | Standby, there is no power on the motors |
Init | The controller is starting, it goes to MotorsOff when it is up |
GuardStop | Stopped because the safety runchain is open, for example a cell door |
EmergencyStop | Stopped by the emergency stop |
EmergencyStopReset | The emergency stop is released, the transition is not confirmed yet |
SystemFailure | The controller needs a restart |
Unknown | The state could not be determined |
ControllerState state = robot.Rws.Panel.GetControllerState();Console.WriteLine($"Controller state : {state}");if (state == ControllerState.MotorsOff){// The robot can move once the motors are onrobot.Rws.Panel.SetControllerState(ControllerState.MotorsOn);}// The state change is not immediate, wait for the controller to report itwhile (robot.Rws.Panel.GetControllerState() != ControllerState.MotorsOn){Thread.Sleep(200);}// Motors off puts the robot back in standby, it cannot move any morerobot.Rws.Panel.SetControllerState(ControllerState.MotorsOff);
The controller answers before the state has really changed. Read the state again until it reports MotorsOn, as in the example above, instead of assuming the robot is ready right after the call.
Speed ratio
The speed ratio is the percentage of their programmed speed the programs run at. GetSpeedRatio returns it, SetSpeedRatio changes it.
int speedRatio = robot.Rws.Panel.GetSpeedRatio();Console.WriteLine($"The programs run at {speedRatio} % of their programmed speed");// Percentage between 0 and 100, accepted in automatic mode onlyrobot.Rws.Panel.SetSpeedRatio(25);// Take the mastership yourself when several writes follow each otherrobot.Rws.Mastership.Request();robot.Rws.Panel.SetSpeedRatio(100, false);robot.Rws.Mastership.Release();
The value is between 0 and 100, the controller answers 400 for anything else. The controller accepts the change in automatic mode.
On an OmniCore, writing the speed ratio needs the mastership. The SDK takes it for the time of the request, this is what the useImplicitMastership argument does. Set it to false when your own code already holds the mastership, otherwise the controller refuses a second request on a domain you already hold. An IRC5 needs no mastership here and ignores the argument.
Collision detection
GetCollisionDetectionState tells whether the robot stopped because it touched something.
CollisionDetectionState | Meaning |
|---|---|
Init | No collision since the controller started |
Triggered | A collision was detected and is waiting to be confirmed |
Confirmed | A detected collision was confirmed |
TriggeredAcknowledged | A detected collision was acknowledged by an operator |
Unknown | The state could not be determined |
CollisionDetectionState state = robot.Rws.Panel.GetCollisionDetectionState();if (state == CollisionDetectionState.Triggered || state == CollisionDetectionState.Confirmed){Console.WriteLine("A collision was detected, the robot is stopped");// Acknowledge the collision from the applicationrobot.Rws.Panel.AcknowledgeOperationMode(OperationModeAcknowledgement.CollisionDetection);}
A collision is acknowledged with AcknowledgeOperationMode, the same method as an operating mode change, with OperationModeAcknowledgement.CollisionDetection.
Language and restart
SetLanguage changes the language the controller writes its messages in, with a two letter code such as en, de or sv. The language must be installed on the controller, otherwise the request fails. The controller service changes the same setting with its own SetLanguage, either one can be used.
Restart restarts the controller. The control panel accepts Restart, IStart, PStart and BStart. Use robot.Rws.Controller.Restart for the other modes, they are described on the controller page.
// Language the controller reports its messages in.// The language must be installed on the controller.robot.Rws.Panel.SetLanguage("en");// Warm restart. The connection is lost as soon as the controller shuts down.robot.Rws.Panel.Restart(ControllerRestartMode.Restart);robot.Disconnect();
The connection is lost as soon as the controller starts shutting down. A call that succeeded is normally followed by failing requests until the controller is up again, so disconnect right after it and connect again later. On an OmniCore the restart needs the mastership on every domain, taken implicitly by default like for the speed ratio.
API reference
Methods of PanelService :// Confirms a pending operating mode change (synchronous) The controller waits for this confirmation whenever the mode selector is turned, unless it is configured to acknowledge the change on its own.void AcknowledgeOperationMode(OperationModeAcknowledgement acknowledgement);// Gets the collision detection state of the controller (synchronous)CollisionDetectionState GetCollisionDetectionState();// Gets the state of the controller (synchronous)ControllerState GetControllerState();// Gets the operating mode the controller runs in (synchronous)OperationMode GetOperationMode();// Gets the lock state of the operating mode selector (synchronous)OperationModeLockState GetOperationModeLockState();// Gets the speed ratio the controller runs the programs at (synchronous)int GetSpeedRatio();// Locks the operating mode selector with a pin code (synchronous)void LockOperationMode(string pin, bool permanent = false);// Restarts the controller (synchronous)void Restart(ControllerRestartMode mode, bool useImplicitMastership = true);// Turns the motors of the robot on or off (synchronous)void SetControllerState(ControllerState state);// Sets the language the controller reports its messages in (synchronous)void SetLanguage(string languageCode);// Sets the speed ratio the controller runs the programs at (synchronous) Only accepted while the controller runs in automatic mode.void SetSpeedRatio(int speedRatio, bool useImplicitMastership = true);// Releases the lock of the operating mode selector (synchronous)void UnlockOperationMode(string pin);
Every method also exists in an asynchronous version, with the same name followed by Async and an optional CancellationToken.
public enum OperationMode {// Automatic modeAutomatic = 6// A change to the automatic mode has been requested and is waiting to be acknowledgedAutomaticChangeRequest = 2// The controller is initializingInit = 1// Manual mode at full speedManualFullSpeed = 5// A change to the manual full speed mode has been requested and is waiting to be acknowledgedManualFullSpeedChangeRequest = 3// Manual mode at reduced speedManualReducedSpeed = 4// The controller reports an undefined operating modeUndefined = 7// The operating mode could not be determinedUnknown = 0}
public enum OperationModeAcknowledgement {// Confirms the switch to the automatic modeAutomatic = 0// Confirms a collision detectionCollisionDetection = 2// Confirms the switch to the manual full speed modeManualFullSpeed = 1}
public enum OperationModeLockState {// The controller reports an error on the mode selector lockError = 1// The operating mode is locked and can be unlocked again with the pin code it was locked withLocked = 3// A permanent lock has been requested and is not effective yetPendingPermanentLock = 5// The operating mode is permanently lockedPermanentlyLocked = 4// The lock state could not be determinedUnknown = 0// The operating mode can be changed freelyUnlocked = 2}
public enum ControllerState {// The robot is stopped because the emergency stop was activatedEmergencyStop = 5// The robot is ready to leave the emergency stop state: the emergency stop is no longer activated,// but the state transition is not confirmed yet.EmergencyStopReset = 6// The robot is stopped because the safety runchain is opened, for instance because a door of its cell is openGuardStop = 4// The robot is starting up. It will shift to <xref href="UnderAutomation.ABB.Rws.Data.ControllerState.MotorsOff" data-throw-if-not-resolved="false"></xref> once it has started.Init = 1// The robot is in a standby state where there is no power to its motors.// The state has to be shifted to <xref href="UnderAutomation.ABB.Rws.Data.ControllerState.MotorsOn" data-throw-if-not-resolved="false"></xref> before the robot can move.MotorsOff = 2// The robot is ready to move, either by jogging or by running programsMotorsOn = 3// The robot is in a system failure state and requires a restartSystemFailure = 7// The state could not be determinedUnknown = 0}
public enum CollisionDetectionState {// A detected collision has been confirmedConfirmed = 3// No collision has been detected since the controller startedInit = 1// A collision has been detected and is waiting to be confirmedTriggered = 2// A detected collision has been acknowledged by an operatorTriggeredAcknowledged = 4// The collision detection state could not be determinedUnknown = 0}
public enum ControllerRestartMode {// The controller will be restarted. The last automatically saved system state will be loaded.// Should be used to recover from a system crash.BStart = 5// The controller will be restarted. The current system parameter settings and RAPID programs will be discarded,// and the original system installation settings will be used.IStart = 3// The controller will be restarted. The current RAPID programs and data will be discarded, but not the system parameter settings.PStart = 4// The controller will be restarted. The state is saved and any changed system parameter settings will be activated after the restart.Restart = 0// The main computer will be shut down. Should be used if the controller UPS is broken.Shutdown = 1// The controller will be restarted and the Boot Application will be started. The current system is saved and deactivated// (the controller is non-functional, for advanced maintenance only).XStart = 2}