UnderAutomation
질문이요?

[email protected]

문의하기
UnderAutomation
⌘Q
Fanuc SDK documentation
Position & kinematics
Documentation home

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:

// 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);

User alarms

Read and configure user alarm definitions:

// 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);

File listing

List files on the controller using CGTP HTTP:

// 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");

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

Members of Cgtp.CgtpCommentType :
public enum CgtpCommentType {
// Analog input.
AI = 12
// Analog output.
AO = 13
// Digital input.
DI = 8
// Digital output.
DO = 9
// Flag (F[]).
Flag = 19
// Group input.
GI = 10
// Group output.
GO = 11
// Numeric register (R[]).
NumericRegister = 1
// Position register (PR[]).
PositionRegister = 3
// Robot input.
RI = 6
// Robot output.
RO = 7
// String register (SR[]).
StringRegister = 14
// User alarm.
UserAlarm = 4
}
Members of Cgtp.CgtpCommentIoType :
public enum CgtpCommentIoType {
// Analog I/O (AI/AO).
AnalogIO = 35
// Digital I/O (DI/DO).
DigitalIO = 33
// Group I/O (GI/GO).
GroupIO = 34
// Robot I/O (RI/RO).
RobotIO = 32
}
Members of Cgtp.CgtpFileItem :
public class CgtpFileItem {
public CgtpFileItem()
// Comment associated with the file, if any.
public string Comment { get; }
// File name on the controller.
public string File { get; }
public override string ToString()
}
Members of Cgtp.CgtpAsciiFileItem :
public class CgtpAsciiFileItem : CgtpFileItem {
public CgtpAsciiFileItem()
// ASCII format file name, or null if not available.
public string AsciiFile { get; }
public override string ToString()
}
Members of Cgtp.Internal.CgtpHttpClient :
public class CgtpHttpClient : FileClientBase {
// Base path used to build the download URL. Default is "MD".
public string BasePath { get; set; }
// Download a file from the controller and return its raw bytes.
public byte[] DownloadAsBytes(string fileName)
// Download a file from the controller and return a readable stream.
// Otherwise the raw binary response is returned.
public Stream DownloadAsStream(string fileName)
// Download a file from the controller and return its content as a string.
public string DownloadAsString(string fileName)
// Get the list of all variable file names available on the controller
public override string[] EnumerateVariableFileNames()
// IP address of the controller
public override string IP { get; }
// List diagnostic and error files available on the controller.
public CgtpFileItem[] ListDiagnosticFiles()
// List other files available on the controller.
public CgtpFileItem[] ListOtherFiles()
// List TP program files available on the controller.
public CgtpAsciiFileItem[] ListTpPrograms()
// List variable files available on the controller.
public CgtpAsciiFileItem[] ListVariableFiles()
}
Members of Common.UserAlarmDefinition :
public class UserAlarmDefinition {
public UserAlarmDefinition()
// Comment associated with this alarm.
public string Comment { get; set; }
// Severity level of the alarm.
public int Severity { get; set; }
public override string ToString()
}

Universal Robots, Fanuc, Yaskawa, ABB 또는 Staubli 로봇을 .NET, Python, LabVIEW 또는 Matlab 애플리케이션에 쉽게 통합

UnderAutomation
문의하기Legal

© All rights reserved.