Diagnostics & variables
Read safety status, current position, I/O state, installed features, error history, registers, and system variables via FTP.
Read safety status, current position, I/O state, error history, installed features, registers, and system variables from the Fanuc controller via FTP.
Safety, position, I/O, and errors
parameters.Ftp.FtpPassword = "";robot.Connect(parameters);// Safety statusSafetyStatus safetyStatus = robot.Ftp.GetSafetyStatus();Console.WriteLine($"Emergency Stop: {safetyStatus.ExternalEStop}");Console.WriteLine($"Teach Pendant Enabled: {safetyStatus.TPEnable}");// Current positionCurrentPosition currentPosition = robot.Ftp.GetCurrentPosition();// I/O stateIOState ioState = robot.Ftp.GetIOState();// Error historyvar errors = robot.Ftp.GetAllErrorsList();}}
Safety status informations
| Member | Type | Description |
|---|---|---|
SafetyStatus() Constructor | ||
BeltBroken Property read only | bool | Belt broken signal is active |
ExternalEStop Property read only | bool | External emergency stop active |
FenceOpen Property read only | bool | Safety fence is open |
HandBroken Property read only | bool | Hand broken signal is active |
LowAirAlarm Property read only | bool | Low air pressure alarm is active |
Name Property read only | string | File name : sftysig.dg |
NonTeacherEnb Property read only | bool | Non-teacher enable signal is active |
OverTravel Property read only | bool | Over travel limit is active |
SOPEStop Property read only | bool | Emergency stop active by SOP signal |
SVOFFDetect Property read only | bool | Servo off detection is active |
TPDeadman Property read only | bool | The deadman switch of the teach pendant is active |
TPEStop Property read only | bool | Emergency stop active on teach peandant |
TPEnable Property read only | bool | Teach pendant is enabled |
Equals(object) Method | bool | |
GetHashCode() Method | int | |
ToString() Method | string |
Contains the position for each robots
| Member | Type | Description |
|---|---|---|
CurrentPosition() Constructor | ||
GroupsPosition Property read only | GroupPosition[] | Position of each robots handled by this controller |
Name Property read only | string | File name : curpos.dg |
ToString() Method | string |
Complete position information of a group
| Member | Type | Description |
|---|---|---|
GroupPosition() Constructor | ||
Id Property read only | int | Group ID |
JointsPosition Property read only | JointsPosition | Joint positions : the position of each robot angles |
UserFramePositions Property read only | CartesianPositionWithUserFrame[] | Position of each tools in each user frames |
WorldPositions Property read only | CartesianPositionWithTool[] | Position of each tools in world coordinates |
Equals(object) Method | bool | |
GetHashCode() Method | int | |
ToString() Method | string |
Status of all controller inputs and outputs
| Member | Type | Description |
|---|---|---|
IOState() Constructor | ||
Name Property read only | string | File name : iostate.dg |
States Property read only | IOStatus[] | Status of all controller inputs and outputs |
ToString() Method | string |
A digital port status
| Member | Type | Description |
|---|---|---|
IOStatus() Constructor | ||
Id Property read only | int | Digital port ID |
Name Property read only | string | IO Name |
Port Property read only | DigitalPorts | Digital port type |
Value Property read only | bool | Digital port value |
Equals(object) Method | bool | |
GetHashCode() Method | int | |
ToString() Method | string | String representation like : DIN[1]=True |
Fanuc digital port types
| Name | Value | Description |
|---|---|---|
DIN | 0 | Digital input |
DOUT | 1 | Digital outputs |
FLG | 8 | Flags |
RI | 6 | Robot inputs |
RO | 7 | Robot outputs |
SI | 4 | SI |
SO | 5 | SO |
UI | 2 | User inputs |
UO | 3 | User outputs |
Read variables
Variables are read in bulk from .va files stored on the controller.
parameters.Ftp.FtpPassword = "";robot.Connect(parameters);// Get all variables from all filesvar allVariables = robot.Ftp.GetAllVariables();foreach (var file in allVariables)foreach (var variable in file.Variables)Console.WriteLine($"{variable.Name} = {variable.Value}");// Get variables from a specific filevar variables = robot.Ftp.GetVariablesFromFile("SYSVARS.va");// Access commonly used system variables directlyint rmtMaster = robot.Ftp.KnownVariableFiles.GetSystemFile().RmtMaster;}}
Read registers
Registers are read in bulk via FTP variable files.
using UnderAutomation.Fanuc;using UnderAutomation.Fanuc.Common.Files.Variables;public class FtpDiagnosticsRegisters{public static void Main(){// Create a FanucRobot instanceFanucRobot robot = new FanucRobot();// Set connection parameters (example values)ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");parameters.Ftp.Enable = true;parameters.Ftp.FtpUser = "user";parameters.Ftp.FtpPassword = "ftp password";// Connect to the robot with FTP enabledrobot.Connect(parameters);// 1) Reading Numeric RegistersReadNumericRegisters(robot);// 2) Reading Position RegistersReadPositionRegisters(robot);// 3) Reading String RegistersReadStringRegisters(robot);}private static void ReadNumericRegisters(FanucRobot robot){NumregFile numregFile = robot.Ftp.KnownVariableFiles.GetNumregFile();for (int i = 0; i < numregFile.Numreg.Length; i++){double value = numregFile.Numreg[i];Console.WriteLine($"📊 Numeric R[{i}] = {value}");}}private static void ReadPositionRegisters(FanucRobot robot){PosregFile posregFile = robot.Ftp.KnownVariableFiles.GetPosregFile();// posregFile.Posreg is a 3D array: dimension [1] = group, [2] = register indexfor (int group = 0; group < posregFile.Posreg.GetLength(1); group++){Console.WriteLine($"\n🤖 Reading position registers for Group {group}:");for (int i = 0; i < posregFile.Posreg.GetLength(2); i++){PositionRegister value = posregFile.Posreg[group, i];Console.WriteLine($" - PR[{i}] :");Console.WriteLine($" X = {value.CartesianPosition.X}");Console.WriteLine($" Y = {value.CartesianPosition.Y}");Console.WriteLine($" Z = {value.CartesianPosition.Z}");Console.WriteLine($" W = {value.CartesianPosition.W}");Console.WriteLine($" P = {value.CartesianPosition.P}");Console.WriteLine($" R = {value.CartesianPosition.R}");Console.WriteLine(" Configuration :");Console.WriteLine($" ArmFrontBack = {value.CartesianPosition.Configuration.ArmFrontBack}");Console.WriteLine($" ArmLeftRight = {value.CartesianPosition.Configuration.ArmLeftRight}");Console.WriteLine($" ArmUpDown = {value.CartesianPosition.Configuration.ArmUpDown}");Console.WriteLine($" WristFlip = {value.CartesianPosition.Configuration.WristFlip}");}}}private static void ReadStringRegisters(FanucRobot robot){StrregFile strregFile = robot.Ftp.KnownVariableFiles.GetStrregFile();for (int i = 0; i < strregFile.Strreg.Length; i++){string value = strregFile.Strreg[i];Console.WriteLine($"💬 String SR[{i}] = '{value}'");}}}
Installed features (options)
Detect available options on the controller to check protocol availability.
parameters.Ftp.FtpPassword = "";robot.Connect(parameters);Features features = robot.Ftp.GetSummaryDiagnostic().Features;// Check specific capabilitiesbool hasSnpx = features.HasSnpx;bool hasTelnet = features.HasTelnet;// List all installed featuresforeach (var feature in features.FeaturesList)Console.WriteLine($"{feature.Name} ({feature.OrderNo})");}}
Complete example
using UnderAutomation.Fanuc;using UnderAutomation.Fanuc.Common.Files.Diagnosis;public class FtpDiagnostics{static void Main(){FanucRobot robot = new FanucRobot();ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");parameters.Ftp.Enable = true;parameters.Ftp.FtpUser = "";parameters.Ftp.FtpPassword = "";robot.Connect(parameters);// Read safety statusSafetyStatus safetyStatus = robot.Ftp.GetSafetyStatus();Console.WriteLine($"Emergency Stop: {safetyStatus.ExternalEStop}");Console.WriteLine($"Teach Pendant Enabled: {safetyStatus.TPEnable}");// Read current position (joints, world, user frames)CurrentPosition currentPosition = robot.Ftp.GetCurrentPosition();// Read I/O stateIOState ioState = robot.Ftp.GetIOState();// Read all errorsvar errors = robot.Ftp.GetAllErrorsList();// Read all variables from all filesvar allVariables = robot.Ftp.GetAllVariables();foreach (var file in allVariables)foreach (var variable in file.Variables)Console.WriteLine($"{variable.Name} = {variable.Value}");// Access well-known system variablesint rmtMaster = robot.Ftp.KnownVariableFiles.GetSystemFile().RmtMaster;// Get installed featuresFeatures features = robot.Ftp.GetSummaryDiagnostic().Features;bool hasSnpx = features.HasSnpx;}}
API reference
All diagnosis information
| Member | Type | Description |
|---|---|---|
SummaryDiagnosis() Constructor | ||
CurrentPosition Property read only | CurrentPosition | Current position of each robots and groups handled by this controller |
Features Property read only | Features | Controller features status |
IOs Property read only | IOState | Controller IO status |
Name Property read only | string | File name : summary.dg |
ProgramStates Property read only | ProgramStates | Controller program states |
Safety Property read only | SafetyStatus | Controller safety information |
ToString() Method | string |
Represents the collection of features available on the controller.
| Member | Type | Description |
|---|---|---|
Features() Constructor | ||
FeaturesList Property read only | Feature[] | List of features |
HasAsciiUpload Property read only | bool | Indicates if the robot has the ASCII upload feature enabled : R507 ("ASCII Upload" on older controllers) or R796 ("ASCII Program Loader" on most recent controllers). |
HasSnpx Property read only | bool | Indicates if the robot has the SNPX feature enabled (R553 or R651). |
HasTelnet Property read only | bool | Indicates if the robot has the TELNET feature enabled (TELN). |
Equals(object) Method | bool | |
GetHashCode() Method | int | |
ToString() Method | string |