UnderAutomation
有问题吗?

[email protected]

联系我们
UnderAutomation
⌘Q
This page is only available in English.

Diagnostics & variables

Read safety status, current position, I/O state, installed features, error history, registers, and system variables via FTP.

  • Safety, position, I/O, and errors
  • Read variables
  • Read registers
  • Installed features (options)
  • Complete example
  • API reference

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 status
SafetyStatus safetyStatus = robot.Ftp.GetSafetyStatus();
Console.WriteLine($"Emergency Stop: {safetyStatus.ExternalEStop}");
Console.WriteLine($"Teach Pendant Enabled: {safetyStatus.TPEnable}");
// Current position
CurrentPosition currentPosition = robot.Ftp.GetCurrentPosition();
// I/O state
IOState ioState = robot.Ftp.GetIOState();
// Error history
var errors = robot.Ftp.GetAllErrorsList();
}
}
Click to see the full code
Class
SafetyStatus
C#Python

Safety status informations

MemberTypeDescription
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
Class
CurrentPosition
C#Python

Contains the position for each robots

MemberTypeDescription
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
Class
GroupPosition
C#Python

Complete position information of a group

MemberTypeDescription
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
Class
IOState
C#Python

Status of all controller inputs and outputs

MemberTypeDescription
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
Class
IOStatus
C#Python

A digital port status

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

Fanuc digital port types

NameValueDescription
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 files
var 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 file
var variables = robot.Ftp.GetVariablesFromFile("SYSVARS.va");
// Access commonly used system variables directly
int rmtMaster = robot.Ftp.KnownVariableFiles.GetSystemFile().RmtMaster;
}
}
Click to see the full code

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 instance
FanucRobot 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 enabled
robot.Connect(parameters);
// 1) Reading Numeric Registers
ReadNumericRegisters(robot);
// 2) Reading Position Registers
ReadPositionRegisters(robot);
// 3) Reading String Registers
ReadStringRegisters(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 index
for (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 capabilities
bool hasSnpx = features.HasSnpx;
bool hasTelnet = features.HasTelnet;
// List all installed features
foreach (var feature in features.FeaturesList)
Console.WriteLine($"{feature.Name} ({feature.OrderNo})");
}
}
Click to see the full code

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 status
SafetyStatus 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 state
IOState ioState = robot.Ftp.GetIOState();
// Read all errors
var errors = robot.Ftp.GetAllErrorsList();
// Read all variables from all files
var 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 variables
int rmtMaster = robot.Ftp.KnownVariableFiles.GetSystemFile().RmtMaster;
// Get installed features
Features features = robot.Ftp.GetSummaryDiagnostic().Features;
bool hasSnpx = features.HasSnpx;
}
}

API reference

Class
SummaryDiagnosis
C#Python

All diagnosis information

MemberTypeDescription
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
Class
Features
C#Python

Represents the collection of features available on the controller.

MemberTypeDescription
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

轻松将 Universal Robots、Fanuc、Yaskawa、ABB 或 Staubli 机器人集成到您的 .NET、Python、LabVIEW 或 Matlab 应用程序中

UnderAutomation
联系我们Legal

© All rights reserved.