Alarms & task status
Read active alarms, alarm history, clear alarms, monitor running tasks, and read/write comments via SNPX.
SNPX lets you read active alarms, browse alarm history, clear alarms, monitor running tasks, and read/write register and I/O comments.
Alarms
parameters.Snpx.Enable = true;robot.Connect(parameters);// Active alarmRobotAlarm activeAlarm = robot.Snpx.ActiveAlarm.Read(1);Console.WriteLine($"Alarm: {activeAlarm.Message}");Console.WriteLine($"Severity: {activeAlarm.Severity}");Console.WriteLine($"Time: {activeAlarm.Time}");// Alarm historyRobotAlarm histAlarm = robot.Snpx.AlarmHistory.Read(10);// Clear alarmsrobot.Snpx.ClearAlarms();}}
Task status and comments
Monitor running program tasks by index (1-based). Comments are short descriptions associated with registers or I/O ports.
Available comment types: Register, PositionRegister, StringRegister, DI, DO, RI, RO, UI, UO, SI, SO, WI, WO, WSI, WSO, GI, GO, AI, AO, Flag.
parameters.Snpx.Enable = true;robot.Connect(parameters);// Task statusRobotTaskStatus task = robot.Snpx.CurrentTaskStatus.Read(1);Console.WriteLine($"Program: {task.ProgramName}");Console.WriteLine($"Line: {task.LineNumber}");Console.WriteLine($"State: {task.State}"); // Stopped, Paused, RunningConsole.WriteLine($"Caller: {task.Caller}");// Read and write commentsstring comment = robot.Snpx.Comments.Read(CommentType.Register, 5);string longComment = robot.Snpx.Comments.Read(CommentType.Register, 5, 24);robot.Snpx.Comments.Write(CommentType.PositionRegister, 1, "Home Position", 16);}}
Complete example
using UnderAutomation.Fanuc;using UnderAutomation.Fanuc.Snpx.Internal;using UnderAutomation.Fanuc.Snpx;public class SnpxAlarmsTasks{public static void Main(){FanucRobot robot = new FanucRobot();ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");parameters.Snpx.Enable = true;robot.Connect(parameters);// --- Active alarm ---RobotAlarm activeAlarm = robot.Snpx.ActiveAlarm.Read(1);Console.WriteLine($"Alarm: {activeAlarm.Message}");Console.WriteLine($"Severity: {activeAlarm.Severity}");Console.WriteLine($"Time: {activeAlarm.Time}");// --- Alarm history ---RobotAlarm histAlarm = robot.Snpx.AlarmHistory.Read(10);Console.WriteLine($"History #{10}: {histAlarm.Message}");// --- Clear alarms ---robot.Snpx.ClearAlarms();// --- Task status ---RobotTaskStatus task = robot.Snpx.CurrentTaskStatus.Read(1);Console.WriteLine($"Program: {task.ProgramName}");Console.WriteLine($"Line: {task.LineNumber}");Console.WriteLine($"State: {task.State}");Console.WriteLine($"Caller: {task.Caller}");// --- Read and write comments ---string comment = robot.Snpx.Comments.Read(CommentType.Register, 5);robot.Snpx.Comments.Write(CommentType.PositionRegister, 1, "Home Position", 16);}}
API reference
Represents a robot alarm with its category, severity, time, and message.
| Member | Type | Description |
|---|---|---|
RobotAlarm() Constructor | ||
CauseId Property | AlarmId | Cause Category |
CauseMessage Property | string | Cause message |
CauseNumber Property | short | Cause Number |
Id Property | AlarmId | Alarm Category |
Message Property | string | Error Message |
Number Property | short | Alarm Number |
Severity Property | AlarmSeverity | Alarm Severity |
SeverityMessage Property | string | Severity message |
Time Property | DateTime | Occurrence Time |
Equals(object) Method | bool | |
Equals(RobotAlarm) Method | bool | Determines whether the specified RobotAlarm is equal to this instance.
|
FromBytes(byte[], Languages, int) Method static | RobotAlarm | Creates a RobotAlarm from a byte array.
|
GetHashCode() Method | int | |
ToString() Method | string |
Represents the severity level of a robot alarm.
| Name | Value | Description |
|---|---|---|
ABORT_G | 45 | Global abort level alarm. |
ABORT_L | 11 | Local abort level alarm. |
NONE | 128 | No severity. |
PAUSE_G | 34 | Global pause level alarm. |
PAUSE_L | 2 | Local pause level alarm. |
SERVO | 54 | Servo error alarm. |
SERVO2 | 58 | Servo error level 2 alarm. |
STOP_G | 38 | Global stop level alarm. |
STOP_L | 6 | Local stop level alarm. |
SYSTEM | 122 | System level alarm. |
WARN | 0 | Warning level alarm. |
Represents the status of a running task on the robot controller.
| Member | Type | Description |
|---|---|---|
RobotTaskStatus() Constructor | ||
Caller Property | string | Gets or sets the name of the calling program. |
LineNumber Property | short | Gets or sets the current line number in the program. |
ProgramName Property | string | Gets or sets the name of the program being executed. |
State Property | RobotTaskState | Gets or sets the current execution state of the task. |
Equals(object) Method | bool | |
Equals(RobotTaskStatus) Method | bool | Determines whether the specified RobotTaskStatus is equal to this instance.
|
FromBytes(byte[], Languages, int) Method static | RobotTaskStatus | Creates a RobotTaskStatus from a byte array.
|
GetHashCode() Method | int | |
ToString() Method | string |
Represents the execution state of a robot task.
| Name | Value | Description |
|---|---|---|
Paused | 1 | Task is paused. |
Running | 2 | Task is running. |
Stopped | 0 | Task is stopped. |
Identifies the type of data for which a comment can be read or written.
| Name | Value | Description |
|---|---|---|
AI | 17 | Analog Input. |
AO | 18 | Analog Output. |
DI | 3 | Digital Input. |
DO | 4 | Digital Output. |
Flag | 19 | Flag |
GI | 15 | Group Input. |
GO | 16 | Group Output. |
PositionRegister | 1 | Position register PR[]. |
RI | 5 | Remote Input. |
RO | 6 | Remote Output. |
Register | 0 | Numeric register R[]. |
SI | 9 | System Input. |
SO | 10 | System Output. |
StringRegister | 2 | String register SR[]. |
UI | 7 | User Input. |
UO | 8 | User Output. |
WI | 11 | Weld Input. |
WO | 12 | Weld Output. |
WSI | 13 | Wire Stick Input. |
WSO | 14 | Wire Stick Output. |