UnderAutomation
Une question ?

[email protected]

Contactez-nous
UnderAutomation
⌘Q
Fanuc SDK documentation
Current position
Documentation home

Alarms & task status

Read active alarms, alarm history, clear alarms, monitor running tasks, and read/write comments via SNPX.

  • Alarms
  • Task status and comments
  • Complete example
  • API reference

SNPX lets you read active alarms, browse alarm history, clear alarms, monitor running tasks, and read/write register and I/O comments.

Alarms

// 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);
// Clear alarms
robot.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.

// Task status
RobotTaskStatus task = robot.Snpx.CurrentTaskStatus.Read(1);
Console.WriteLine($"Program: {task.ProgramName}");
Console.WriteLine($"Line: {task.LineNumber}");
Console.WriteLine($"State: {task.State}"); // Stopped, Paused, Running
Console.WriteLine($"Caller: {task.Caller}");
// Read and write comments
string 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

Members of Snpx.Internal.RobotAlarm :
public class RobotAlarm : IEquatable<RobotAlarm> {
public RobotAlarm()
// Cause Category
public AlarmId CauseId { get; set; }
// Cause message
public string CauseMessage { get; set; }
// Cause Number
public short CauseNumber { get; set; }
public override bool Equals(object obj)
// Determines whether the specified <xref href="UnderAutomation.Fanuc.Snpx.Internal.RobotAlarm" data-throw-if-not-resolved="false"></xref> is equal to this instance.
public bool Equals(RobotAlarm other)
// Creates a <xref href="UnderAutomation.Fanuc.Snpx.Internal.RobotAlarm" data-throw-if-not-resolved="false"></xref> from a byte array.
public static RobotAlarm FromBytes(byte[] bytes, Languages language, int start = 0)
public override int GetHashCode()
// Alarm Category
public AlarmId Id { get; set; }
// Error Message
public string Message { get; set; }
// Alarm Number
public short Number { get; set; }
// Alarm Severity
public AlarmSeverity Severity { get; set; }
// Severity message
public string SeverityMessage { get; set; }
// Occurrence Time
public DateTime Time { get; set; }
public override string ToString()
}
Members of Snpx.Internal.AlarmSeverity :
public enum AlarmSeverity : short {
// Global abort level alarm.
ABORT_G = 45
// Local abort level alarm.
ABORT_L = 11
// No severity.
NONE = 128
// Global pause level alarm.
PAUSE_G = 34
// Local pause level alarm.
PAUSE_L = 2
// Servo error alarm.
SERVO = 54
// Servo error level 2 alarm.
SERVO2 = 58
// Global stop level alarm.
STOP_G = 38
// Local stop level alarm.
STOP_L = 6
// System level alarm.
SYSTEM = 122
// Warning level alarm.
WARN = 0
}
Members of Snpx.Internal.RobotTaskStatus :
public class RobotTaskStatus : IEquatable<RobotTaskStatus> {
public RobotTaskStatus()
// Gets or sets the name of the calling program.
public string Caller { get; set; }
public override bool Equals(object obj)
// Determines whether the specified <xref href="UnderAutomation.Fanuc.Snpx.Internal.RobotTaskStatus" data-throw-if-not-resolved="false"></xref> is equal to this instance.
public bool Equals(RobotTaskStatus other)
// Creates a <xref href="UnderAutomation.Fanuc.Snpx.Internal.RobotTaskStatus" data-throw-if-not-resolved="false"></xref> from a byte array.
public static RobotTaskStatus FromBytes(byte[] bytes, Languages language, int start = 0)
public override int GetHashCode()
// Gets or sets the current line number in the program.
public short LineNumber { get; set; }
// Gets or sets the name of the program being executed.
public string ProgramName { get; set; }
// Gets or sets the current execution state of the task.
public RobotTaskState State { get; set; }
public override string ToString()
}
Members of Snpx.Internal.RobotTaskState :
public enum RobotTaskState {
// Task is paused.
Paused = 1
// Task is running.
Running = 2
// Task is stopped.
Stopped = 0
}
Members of Snpx.Internal.CommentType :
public enum CommentType {
// Analog Input.
AI = 17
// Analog Output.
AO = 18
// Digital Input.
DI = 3
// Digital Output.
DO = 4
// Flag
Flag = 19
// Group Input.
GI = 15
// Group Output.
GO = 16
// Position register PR[].
PositionRegister = 1
// Remote Input.
RI = 5
// Remote Output.
RO = 6
// Numeric register R[].
Register = 0
// System Input.
SI = 9
// System Output.
SO = 10
// String register SR[].
StringRegister = 2
// User Input.
UI = 7
// User Output.
UO = 8
// Weld Input.
WI = 11
// Weld Output.
WO = 12
// Wire Stick Input.
WSI = 13
// Wire Stick Output.
WSO = 14
}

Intégrez facilement les robots Universal Robots, Fanuc, Yaskawa, ABB ou Staubli dans vos applications .NET, Python, LabVIEW ou Matlab

UnderAutomation
Contactez-nousLegal

© All rights reserved.