UnderAutomation
有问题吗?

[email protected]

联系我们
UnderAutomation
⌘Q
本页面仅提供英文版本。

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.

  • Prerequisites
  • Brand support
  • Example
  • Read the active alarms and the history
  • Reset the alarms
  • Reference
  • Methods of IAlarmService
  • ControllerAlarm
  • Errors
  • What to read next

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 then ControllerRefusedException is 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.

Alarms
MethodFanucYaskawaUniversal RobotsABBStäubli
Alarm.ReadActiveSNPX, FTPHigh Speed Ethernet Server, Ethernet ServerPrimary Interface (Primary), Dashboard ServerRobot Web ServicesNot available
Alarm.ReadHistorySNPX, FTPNot availableNot availableRobot Web ServicesNot available
Alarm.ResetSNPX, CGTP (CgtpKcl), TelnetHigh Speed Ethernet Server, Ethernet ServerDashboard ServerNot availableNot available
Alarm3 of 32 of 32 of 32 of 30 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 alarms
foreach (ControllerAlarm alarm in robot.Alarm.ReadHistory(10))
Console.WriteLine(alarm.HasDate ? $"{alarm.Date}: {alarm.Message}" : alarm.Message);
robot.Disconnect();
}
Click to see the full code

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();
}
Click to see the full code

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

Interface
IAlarmService
C#Python

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.

MemberTypeDescription
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.
  • feature : Method of the service
ReadActive()
Method
ControllerAlarm[]
Reads the active alarms
ReadHistory(int)
Method
ControllerAlarm[]
Reads the last alarms of the history, the most recent first
  • count : Maximum number of alarms
Reset()
Method
void
Resets (acknowledges) the alarms that can be reset

ControllerAlarm

Class
ControllerAlarm
C#Python

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.

MemberTypeDescription
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
Enum
ControllerAlarmSeverity
C#Python

Severity of an alarm

NameValueDescription
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: AlarmPresent tells 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.