Read and decode files
On this page :
FTP is a protocol that allows you to read and decode files from a Fanuc robot, such as variables, programs, diagnosis, etc.
FTP (File Transfer Protocol) provides access to internal controller files, as well as fast parsing and decoding, including .va variable files and .dg diagnostic files.
Manipulate files
The SDK lets you send files, download files, rename, delete and more.
Here are some examples :
robot.Ftp.DirectFileHandling.DownloadFileFromController(@"C:\temp\MyPrg.tp", "md:/MyPrg.tp);robot.Ftp.DirectFileHandling.UploadFileToController(@"C:\temp\MyPrg.tp", "md:/MyPrg.tp);robot.Ftp.DirectFileHandling.DeleteFile("md:/MyPrg.tp");robot.Ftp.DirectFileHandling.CreateDirectory("md:/NewDirectory");robot.Ftp.DirectFileHandling.DeleteDirectory("md:/NewDirectory");
Read variables
Variables are read in bulk (note that TELNET also allows variables to be read one by one).
Variables are also written by TELNET, see previous chapter.
robot.Ftp.KnownVariableFiles
allows access to known and commonly used variables on robots.
Members of Ftp.FtpListItem :// Enumerates variables filesFtpListItem[] VariablesFiles = robot.Ftp.EnumerateVariableFiles();// Get all variables declared in the controllervar allVariables = robot.Ftp.GetAllVariables();// Get all variables declared in one specific filevar variables = robot.Ftp.GetVariablesFromFile("myFile.va");// For known variables, you can access it directly.// Example with $RMT_MASTER :int RmtMaster = robot.Ftp.KnownVariableFiles.GetSystemFile().RmtMaster;// Example with CellGrpCartesianPositionVariable cellFrame = robot.Ftp.KnownVariableFiles.GetSysframeFile().CellGrp[0].CellFrame;// cellFrame.X => 0.2// cellFrame.Y => -0.1// cellFrame.Z => 0// cellFrame.Configuration.ArmFront => Back// cellFrame.Configuration.WristFlip => NoFlip
public class FtpListItem {// Gets the file permissions in the CHMOD format.public int Chmod { get; }// Gets the created date of the object.public DateTime Created { get; }// Gets the full path name to the object.public string FullName { get; }// Gets the last write time of the object.public DateTime Modified { get; }// Gets name to the object.public string Name { get; }// Gets the size of the object.public long Size { get; }// Gets the type of file system object.public FtpFileSystemObjectType Type { get; }}
Read safety status
Members of Ftp.Diagnosis.SafetyStatus :SafetyStatus safetyStatus = robot.Ftp.GetSafetyStatus();
public class SafetyStatus : IFanucContent {public SafetyStatus()public bool BeltBroken { get; }// External emergency stop activepublic bool ExternalEStop { get; }public bool FenceOpen { get; }public bool HandBroken { get; }public bool LowAirAlarm { get; }// File name : sftysig.dgpublic string Name { get; }public bool NonTeacherEnb { get; }public bool OverTravel { get; }// Emergency stop active by SOP signalpublic bool SOPEStop { get; }public bool SVOFFDetect { get; }// The deadman switch of the teach pendant is activepublic bool TPDeadman { get; }// Emergency stop active on teach peandantpublic bool TPEStop { get; }// Teach pendant is enabledpublic bool TPEnable { get; }}
Read IO State
The SDK rovides a list of IO states. Telnet KCL allows you to write or simulate their status.
Members of Ftp.Diagnosis.IOState :IOState ioState = robot.Ftp.GetIOState();
public class IOState : IFanucContent {public IOState()// File name : iostate.dgpublic string Name { get; }// Status of all controller inputs and outputspublic IOStatus[] States { get; }}
public class IOStatus {public IOStatus()// Digital port IDpublic int Id { get; }// IO Namepublic string Name { get; }// Digital port typepublic DigitalPorts Port { get; }// String representation like : DIN[1]=Truepublic override string ToString()// Digital port valuepublic bool Value { get; }}
public enum DigitalPorts {// Digital inputDIN = 0// Digital outputsDOUT = 1// FlagsFLG = 8RI = 6RO = 7SI = 4SO = 5// User inputsUI = 2// User outputsUO = 3}
Get current position
The SDK allows you to retrieve the robot arm's current position in both joint and Cartesian form, in the world frame and in user frames, with a single function call.
Members of Ftp.Diagnosis.CurrentPosition :CurrentPosition currentPosition = robot.Ftp.GetCurrentPosition();
public class CurrentPosition : IFanucContent {public CurrentPosition()// Position of each robots handled by this controllerpublic GroupPosition[] GroupsPosition { get; }// File name : curpos.dgpublic string Name { get; }}
public class GroupPosition {public GroupPosition()// Group IDpublic int Id { get; }// Joint positions : the position of each robot anglespublic JointsPosition JointsPosition { get; }// Position of each tools in each user framespublic CartesianPositionWithUserFrame[] UserFramePositions { get; }// Position of each tools in world coordinatespublic CartesianPositionWithTool[] WorldPositions { get; }}
public class JointsPosition {public JointsPosition()// Joint 1 in degreespublic double J1 { get; set; }// Joint 2 in degreespublic double J2 { get; set; }// Joint 3 in degreespublic double J3 { get; set; }// Joint 4 in degreespublic double J4 { get; set; }// Joint 5 in degreespublic double J5 { get; set; }// Joint 6 in degreespublic double J6 { get; set; }// Joint 7 in degreespublic double J7 { get; set; }// Joint 8 in degreespublic double J8 { get; set; }// Joint 9 in degreespublic double J9 { get; set; }public override string ToString()// Numeric values for each jointspublic double[] Values { get; }}
public class CartesianPositionWithUserFrame : CartesianPositionWithTool {public CartesianPositionWithUserFrame()// Frame ID in the controllerpublic int Frame { get; }}
public class CartesianPositionWithTool : CartesianPosition {public CartesianPositionWithTool()// Tool IDpublic int Tool { get; set; }}
public class CartesianPositionWithTool : CartesianPosition {public CartesianPositionWithTool()// Tool IDpublic int Tool { get; set; }}
public class CartesianPosition : XYZPosition {public CartesianPosition()// Position configurationpublic Configuration Configuration { get; }// P rotation in degreespublic double P { get; set; }// R rotation in degreespublic double R { get; set; }// W rotation in degreespublic double W { get; set; }}
public class XYZPosition {public XYZPosition()// X coordinate in meterspublic double X { get; set; }// Y coordinate in meterspublic double Y { get; set; }// Z coordinate in meterspublic double Z { get; set; }}
Try it
You can download the Windows Example to these features. It can be downloaded from the download page.