UnderAutomation
Any question?

[email protected]

Contact us
UnderAutomation
⌘Q

Alarms, comments & files

Manage user alarms, read/write register and I/O comments, list and download files from the controller via CGTP.

  • Register & I/O comments
  • User alarms
  • File listing
  • Complete example
  • API reference

CGTP provides access to register and I/O comments, user alarms, and file listing/download from the controller.

Register & I/O comments

Read and write descriptive comments for registers:

FanucRobot robot = new FanucRobot();
robot.Connect("192.168.0.1");
// Read register comments
string[] regComments = robot.Cgtp.GetComments(CgtpCommentType.NumericRegister);
string[] posComments = robot.Cgtp.GetComments(CgtpCommentType.PositionRegister);
string[] strComments = robot.Cgtp.GetComments(CgtpCommentType.StringRegister);
// Write a register comment
robot.Cgtp.SetComment(CgtpCommentType.NumericRegister, 1, "Speed setpoint");
robot.Cgtp.SetComment(CgtpCommentType.PositionRegister, 1, "Home position");
// Read I/O comments
IOComments robotIo = robot.Cgtp.GetIoComments(CgtpCommentIoType.RobotIO);
IOComments digitalIo = robot.Cgtp.GetIoComments(CgtpCommentIoType.DigitalIO);
IOComments analogIo = robot.Cgtp.GetIoComments(CgtpCommentIoType.AnalogIO);
}
}
Click to see the full code

User alarms

Read and configure user alarm definitions:

FanucRobot robot = new FanucRobot();
robot.Connect("192.168.0.1");
// Read all user alarms
UserAlarmDefinition[] alarms = robot.Cgtp.ReadUserAlarms();
foreach (var alarm in alarms)
{
Console.WriteLine($"Alarm: {alarm.Comment} (Severity: {alarm.Severity})");
}
// Set user alarm severity
robot.Cgtp.SetUserAlarmSeverity(1, 2);
}
}
Click to see the full code

File listing

List files on the controller using CGTP HTTP:

FanucRobot robot = new FanucRobot();
robot.Connect("192.168.0.1");
// List files in a directory
string[] files = robot.Cgtp.ListFiles("MD:");
// List TP programs
CgtpAsciiFileItem[] tpPrograms = robot.Cgtp.Http.ListTpPrograms();
foreach (var prog in tpPrograms)
{
Console.WriteLine($"{prog.File} - {prog.Comment}");
}
// List variable files
CgtpAsciiFileItem[] varFiles = robot.Cgtp.Http.ListVariableFiles();
// Download as string
string content = robot.Cgtp.Http.DownloadAsString("numreg.va");
// Download as bytes
byte[] data = robot.Cgtp.Http.DownloadAsBytes("posreg.va");
}
}
Click to see the full code

Complete example

using UnderAutomation.Fanuc;
using UnderAutomation.Fanuc.Common;
using UnderAutomation.Fanuc.Cgtp;
public class CgtpAlarmsFiles
{
public static void Main()
{
FanucRobot robot = new FanucRobot();
ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");
parameters.Cgtp.Enable = true;
robot.Connect(parameters);
// --- Register comments ---
string[] regComments = robot.Cgtp.GetComments(CgtpCommentType.NumericRegister);
string[] posComments = robot.Cgtp.GetComments(CgtpCommentType.PositionRegister);
// Write a comment
robot.Cgtp.SetComment(CgtpCommentType.NumericRegister, 1, "Speed setpoint");
// --- I/O comments ---
IOComments digitalIo = robot.Cgtp.GetIoComments(CgtpCommentIoType.DigitalIO);
IOComments robotIo = robot.Cgtp.GetIoComments(CgtpCommentIoType.RobotIO);
// --- User alarms ---
UserAlarmDefinition[] alarms = robot.Cgtp.ReadUserAlarms();
robot.Cgtp.SetUserAlarmSeverity(1, 2);
// --- File listing ---
string[] files = robot.Cgtp.ListFiles("MD:");
CgtpAsciiFileItem[] tpPrograms = robot.Cgtp.Http.ListTpPrograms();
CgtpAsciiFileItem[] varFiles = robot.Cgtp.Http.ListVariableFiles();
CgtpFileItem[] diagFiles = robot.Cgtp.Http.ListDiagnosticFiles();
// --- File download ---
string content = robot.Cgtp.Http.DownloadAsString("numreg.va");
byte[] data = robot.Cgtp.Http.DownloadAsBytes("posreg.va");
}
}

API reference

Enum
CgtpCommentType
C#Python

Type of element whose comment can be read or written via CGTP.

NameValueDescription
AI
12
Analog input.
AO
13
Analog output.
DI
8
Digital input.
DO
9
Digital output.
Flag
19
Flag (F[]).
GI
10
Group input.
GO
11
Group output.
NumericRegister
1
Numeric register (R[]).
PositionRegister
3
Position register (PR[]).
RI
6
Robot input.
RO
7
Robot output.
StringRegister
14
String register (SR[]).
UserAlarm
4
User alarm.
Enum
CgtpCommentIoType
C#Python

Type of I/O pair whose comments can be read via CGTP.

NameValueDescription
AnalogIO
35
Analog I/O (AI/AO).
DigitalIO
33
Digital I/O (DI/DO).
GroupIO
34
Group I/O (GI/GO).
RobotIO
32
Robot I/O (RI/RO).
Class
CgtpFileItem
C#Python

Represents a file entry returned by the controller's index pages.

MemberTypeDescription
CgtpFileItem()
Constructor
Comment
Property
read only
string
Comment associated with the file, if any.
File
Property
read only
string
File name on the controller.
ToString()
Method
string
Class
CgtpAsciiFileIteminherits CgtpFileItem
C#Python

Represents a file entry that has both a binary and an ASCII format.

MemberTypeDescription
CgtpAsciiFileItem()
Constructor
AsciiFile
Property
read only
string
ASCII format file name, or null if not available.
ToString()
Method
string
Class
CgtpHttpClientinherits FileClientBase
C#Python

Provides methods to download and list files from the controller via HTTP.

MemberTypeDescription
BasePath
Property
string
Base path used to build the download URL. Default is "MD".
IP
Property
read only
string
IP address of the controller
DownloadAsBytes(string)
Method
byte[]
Download a file from the controller and return its raw bytes.
DownloadAsStream(string)
Method
Stream
Download a file from the controller and return a readable stream. Otherwise the raw binary response is returned.
DownloadAsString(string)
Method
string
Download a file from the controller and return its content as a string.
EnumerateVariableFileNames()
Method
string[]
Get the list of all variable file names available on the controller
ListDiagnosticFiles()
Method
CgtpFileItem[]
List diagnostic and error files available on the controller.
ListOtherFiles()
Method
CgtpFileItem[]
List other files available on the controller.
ListTpPrograms()
Method
CgtpAsciiFileItem[]
List TP program files available on the controller.
ListVariableFiles()
Method
CgtpAsciiFileItem[]
List variable files available on the controller.
Class
UserAlarmDefinition
C#Python

Represents a user alarm definition with a comment and severity level.

MemberTypeDescription
UserAlarmDefinition()
Constructor
Comment
Property
string
Comment associated with this alarm.
Severity
Property
int
Severity level of the alarm.
ToString()
Method
string

Easily integrate Universal Robots, Fanuc, Yaskawa, ABB or Staubli robots into your .NET, Python, LabVIEW or Matlab applications

UnderAutomation
Contact usLegal

© All rights reserved.