Read and reset robot alarms from a PC
Read the active alarms of Fanuc, Yaskawa, Universal Robots and ABB controllers with one code, and the history and the reset where the brand has them: what each brand reads and resets, C# and Python examples.
This article shows how to read the active alarms of Fanuc, Yaskawa, Universal Robots and ABB controllers from a PC and reset them, with one code in C# or Python. What an alarm and a reset are depends on the controller: the table at the end gives the details of each brand.
The alarms of a Stäubli controller are not in the common API, and some brands have no reset or no history: the support table below shows it.
Prerequisites
- UnderAutomation.Robotics in your project. See Get started with .NET or Get started with Python.
- The connection settings of each controller. See Connect to your robot.
- The license of each brand you connect, or the 30 day trial. See Licensing.
- A reset from a PC acknowledges alarms that an operator would acknowledge at the pendant. Find the cause of the alarm before you reset it. On some controllers, the reset also brings back the servo power.
Brand support
Each cell gives the protocol that the method uses on this brand, in the default order. The table is generated from the route data of the library. "Not available" means that the brand has no route for the method: the call throws FeatureNotSupportedException, and IsAvailable returns false before the call.
| 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 |
Example
Read and reset the alarms of each controller of a cell
The example connects to the controllers of a cell one after the other. It prints the active alarms, then resets them on the brands that have a reset and reads what is left. ReadActive returns a ControllerAlarm per alarm, with its code, its severity and its message.
IsAvailable(AlarmFeature.Reset) is false on a brand without a reset route: the example then only reads the alarms.
static void Main(){// One line per controller: only the brand and the address changevar cell = new[]{(Brand: "fanuc", Address: "192.168.0.1"),(Brand: "yaskawa", Address: "192.168.0.2"),(Brand: "universalrobots", Address: "192.168.0.3"),(Brand: "abb", Address: "192.168.125.1"),};foreach (var controller in cell){// The same code for each controller of this cellRobotController robot = new RobotController();robot.Connect(RobotConnectionParameters.Create(controller.Brand, controller.Address));foreach (ControllerAlarm alarm in robot.Alarm.ReadActive())Console.WriteLine($"{robot.Brand} {alarm.Code} {alarm.Severity}: {alarm.Message}");// False on a brand that has no reset routeif (robot.Alarm.IsAvailable(AlarmFeature.Reset)){robot.Alarm.Reset();Console.WriteLine($"{robot.Brand}: {robot.Alarm.ReadActive().Length} alarm(s) left");}robot.Disconnect();}}}
In Python, the names are in snake_case: robot.alarm.read_active(), robot.alarm.reset(), robot.alarm.is_available(...).
Read the history
ReadHistory(count) returns the last alarms of the history, the most recent first, on the brands that have a history. 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();}
What changes from one brand to another
The code does not change. The content of an alarm and the effect of a reset depend on the controller.
| Brand | Active alarms | History | Reset | Brand article |
|---|---|---|---|---|
| Fanuc | The active alarms of the alarm log. | The alarm log. | Resets the controller: it clears the alarms that can be cleared and brings back the servo power when the safety chain is closed. | Reset an alarm remotely |
| Yaskawa | The active alarms. | Not available | Resets the alarms. | Read and reset alarms |
| Universal Robots | The protective stop, the emergency stop and the safety status. | Not available | Closes the popups, then unlocks the protective stop when the robot is in protective stop. | Read and reset alarms |
| ABB | The guard stop, the emergency stop and the system failure of the controller state. | The event log of the controller. | Not available | Event log |
| Stäubli | Not available | Not available | Not available |
AlarmPresent of the state tells that an alarm is active without reading the list. See Monitor the state of a robot controller.
Errors
FeatureNotSupportedException: the brand has no route for the method, for exampleReseton ABB.RouteUnavailableException: the method has routes, but none can be used, for example because the protocol did not answer at the connection.ControllerRefusedException: the controller received the reset and refused it.RobotControllerException: the route failed. Its inner exception is the exception of the brand SDK.
The page Errors explains each exception.
What to read next
- Alarm: every method of the Alarm service and the
ControllerAlarmtype. - Start, stop and select a robot program: start the program again after the reset.
- Monitor the state of a robot controller: follow the controllers of a cell.