Alarm: read and reset alarms
Read the active alarms and the alarm history of a robot controller and reset the alarms with robot.Alarm. Brand support table, C# and Python examples.
robot.Alarm reads the active alarms and the alarm history of a robot controller, and resets the alarms that can be reset. The result types are the same for Fanuc, Yaskawa, Universal Robots, ABB and Stäubli controllers. The methods that you can call depend on the brand: see the table below.
Prerequisites
- A connected
RobotController. See Connect to your robot. - The license of the brand of the controller, or the 30 day trial. See Licensing.
- For
Reset: the controller can refuse the reset, and thenControllerRefusedExceptionis thrown (see Errors).
Brand support
Each cell gives the protocol that the method uses on this brand, in the default order. The page Routing explains how the library chooses it. The table is generated from the route data of the library. (manual) marks a route that you enable yourself. "n of m" is the number of methods of the service that have a route on this brand.
| Method | Fanuc | Yaskawa | Universal Robots | ABB | Stäubli |
|---|---|---|---|---|---|
| Alarm.ReadActive | SNPX, FTP | High Speed Ethernet Server, Ethernet Server | Primary Interface (Primary), Dashboard Server | Robot Web Services | Not available |
| Alarm.ReadHistory | SNPX, FTP | Not available | Not available | Robot Web Services | Not available |
| Alarm.Reset | SNPX, CGTP (CgtpKcl), Telnet | High Speed Ethernet Server, Ethernet Server | Dashboard Server | Not available | Not available |
| Alarm | 3 of 3 | 2 of 3 | 2 of 3 | 2 of 3 | 0 of 3 |
A brand that has no route for a method throws FeatureNotSupportedException (see Errors). Ask robot.Alarm.IsAvailable(AlarmFeature.ReadHistory) before the call.
Example
Read the active alarms and the history
ReadActive returns the alarms that are active now. ReadHistory returns the last alarms of the history, the most recent first. Check HasDate before you use Date: some controllers do not give it.
RobotController robot = new RobotController();robot.Connect(RobotConnectionParameters.Create("fanuc", "192.168.0.1"));foreach (ControllerAlarm alarm in robot.Alarm.ReadActive())Console.WriteLine($"{alarm.Code} {alarm.Severity}: {alarm.Message}");// The last 10 alarmsforeach (ControllerAlarm alarm in robot.Alarm.ReadHistory(10))Console.WriteLine(alarm.HasDate ? $"{alarm.Date}: {alarm.Message}" : alarm.Message);robot.Disconnect();}
Reset the alarms
Reset acknowledges the alarms that can be reset. Read the active alarms again to see what is left.
RobotController robot = new RobotController();robot.Connect(RobotConnectionParameters.Create("fanuc", "192.168.0.1"));robot.Alarm.Reset();Console.WriteLine(robot.Alarm.ReadActive().Length == 0 ? "No alarm" : "Alarm still active");robot.Disconnect();}
Reference
In Python, the names are in snake_case: robot.alarm.read_active(), robot.alarm.read_history(10), robot.alarm.reset(), robot.alarm.is_available(...). The enum members keep their names, and alarm.severity.name gives the name of the severity.
Methods of IAlarmService
Alarm service of a robot controller: active alarms, history and reset. The library implements this interface. A minor version of the library can add members to it: a class of the application that implements it, for example a test double, then needs the new methods. Errors of the methods other than IsAvailable: FeatureNotSupportedException when the brand has no route for the method, RouteUnavailableException when the method has routes but none of them can be used, ControllerRefusedException when the controller received the command and refused it, RobotControllerException when the route failed (the inner exception is the exception of the brand SDK), and ArgumentException or a derived exception for an invalid argument. IsAvailable only throws ArgumentOutOfRangeException, for a value that is not in the enum. Results: a text and an array are empty when there is no value, never null. The only null values are the Native properties when there is no object of the brand SDK, and Position when the variable is not a position.
| Member | Type | Description |
|---|---|---|
IsAvailable(AlarmFeature) Method | bool | Returns true when the method can be called on the connected controller. The answer depends on the brand, on the routing settings and on the protocols that answered at the connection, not on the state of the controller.
|
ReadActive() Method | ControllerAlarm[] | Reads the active alarms |
ReadHistory(int) Method | ControllerAlarm[] | Reads the last alarms of the history, the most recent first
|
Reset() Method | void | Resets (acknowledges) the alarms that can be reset |
ControllerAlarm
Alarm of a controller, active or in the history. The library creates a new object at each call and does not read it back. The setters are public so that tests and serializers can build the object.
| Member | Type | Description |
|---|---|---|
ControllerAlarm() Constructor | Creates an alarm with the default value of each property | |
Cause Property | string | Cause of the alarm. Empty when the controller does not give it. |
Code Property | string | Code of the alarm, as the controller writes it |
Date Property | DateTime | Date of the alarm, in the time of the controller. Valid only when HasDate is true. |
Group Property | int | Motion group that raised the alarm, from 1. 0 when the alarm is not related to a group. |
HasDate Property | bool | True when the controller gives the date of the alarm |
Message Property | string | Message of the alarm |
Native Property | object | Object of the brand SDK this alarm comes from. Null when there is none. |
Remedy Property | string | Remedy of the alarm. Empty when the controller does not give it. |
Severity Property | ControllerAlarmSeverity | Severity of the alarm |
Task Property | string | Task or program that raised the alarm. Empty when the alarm is not related to a task. |
ToString() Method | string |
Severity of an alarm
| Name | Value | Description |
|---|---|---|
Error | 3 | Error: the program or the motion is stopped |
Information | 1 | Information, no effect on the robot |
Unknown | 0 | The controller does not give the severity |
Warning | 2 | Warning: the robot continues |
Errors
The page Errors explains each exception and how to avoid it.
FeatureNotSupportedException: the brand has no route for the method.RouteUnavailableException: the method has routes, but none of them can be used, for example because the protocol did not answer at the connection.ControllerRefusedException: the controller received the command and refused it.RobotControllerException: the route failed. Its inner exception is the exception of the brand SDK.
IsAvailable only throws ArgumentOutOfRangeException, for a value that is not in the enum.
What to read next
- Read and reset robot alarms: the same code on the brands that have an alarm route, and what each brand reads and resets.
- State:
AlarmPresenttells you that an alarm is active, without reading the list. - Program: start the program again after the reset.
- Pendant: show a message to the operator.