UnderAutomation
Any question?

[email protected]

Contact us
UnderAutomation
⌘Q

Connect to your robot

The protocols of the SDK, their options and setup on the controller, the connection parameters, and the connection to a real Fanuc robot or to ROBOGUIDE.

  • Prerequisites
  • Network
  • Protocols and controller options
  • Connect
  • Quick connection
  • Several protocols
  • ROBOGUIDE
  • Connection options
  • Ping
  • Language of the controller
  • Standalone protocol clients
  • Disconnect
  • Try it in the demo application
  • Reference
  • What to read next

This page explains how to connect the Fanuc SDK to a real controller or to a ROBOGUIDE virtual robot: the protocols to enable, their setup on the controller and the connection parameters. The ConnectionParameters class lists the protocols, and each protocol is enabled on its own.

Prerequisites

Network

The PC and the controller are on the same network, and the PC can ping the controller. Each protocol uses its own TCP port: allow it in the firewalls between the PC and the controller.

Protocols and controller options

ProtocolWhat it givesController optionSetup
CGTPPrograms, variables, registers, I/O, position, kinematics, filesNone, firmware V8.30 or laterCGTP overview
SNPXFast access to registers, variables, I/O, position, alarmsR553 with the FANUC America parameters (R650 FRA), none with R651 FRLSNPX overview
Telnet KCLProgram control, variables, ports, breakpointsNoneEnable Telnet
FTPFiles, variable files, diagnosticsNoneFTP overview
RMIMotion instructions sent from the PCR912RMI overview
Stream MotionA position at every communication cycleJ519Stream Motion overview

Connect

Quick connection

The simplest way to connect is to pass an IP address. This enables only the CGTP protocol, which is enabled by default.

static void Main()
{
var robot = new FanucRobot();
robot.Connect("192.168.0.1");
}
}
Click to see the full code

Several protocols

To use several protocols, create a ConnectionParameters object and enable each protocol you need.

using UnderAutomation.Fanuc;
using UnderAutomation.Fanuc.Common;
public class Connect
{
static void Main()
{
// Create a robot instance
FanucRobot robot = new FanucRobot();
// Configure connection parameters
ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");
// Enable Telnet KCL for remote commands
parameters.Telnet.Enable = true;
parameters.Telnet.TelnetKclPassword = "your_password";
// Enable FTP for file and variable access
parameters.Ftp.Enable = true;
parameters.Ftp.FtpUser = "";
parameters.Ftp.FtpPassword = "";
// Enable SNPX for high-speed register and I/O access
parameters.Snpx.Enable = true;
// Enable CGTP Web Server (enabled by default)
parameters.Cgtp.Enable = true;
// Enable RMI for remote motion commands
parameters.Rmi.Enable = true;
// Connect to the robot
robot.Connect(parameters);
// Check connection status
bool isConnected = robot.Enabled;
// Disconnect when done
robot.Disconnect();
}
}

ROBOGUIDE

Instead of an IP address, pass the folder of a robot of a ROBOGUIDE workcell. The SDK reads the file services.txt of that folder to find the TCP ports of the virtual robot. See Test with ROBOGUIDE.

{
FanucRobot robot = new FanucRobot();
var parameters = new ConnectionParameters(@"C:\Users\you\Documents\My Workcells\CRX 10iA L\Robot_1");
parameters.Telnet.Enable = true;
parameters.Telnet.TelnetKclPassword = "";
parameters.Ftp.Enable = true;
parameters.Ftp.FtpUser = "";
parameters.Ftp.FtpPassword = "";
robot.Connect(parameters);
}
}
Click to see the full code

Connection options

Ping

When PingBeforeConnect is true (default), the SDK pings the controller before it opens any connection. If the controller does not answer within 100 ms, Connect throws an exception at once. Set it to false when ICMP is blocked on your network.

Language of the controller

Set the Language property to the language of the controller, so that the strings read with SNPX, FTP and Telnet are decoded correctly: English (ASCII, default), Japanese (Shift-JIS) or Chinese (GB2312).

FanucRobot robot = new FanucRobot();
ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");
// Ping before connecting (default: true)
parameters.PingBeforeConnect = true;
// Set to false for ROBOGUIDE or when ICMP is blocked
// Controller language for correct string decoding
parameters.Language = Languages.English; // default (ASCII)
// parameters.Language = Languages.Japanese; // Shift-JIS
// parameters.Language = Languages.Chinese; // GB2312
robot.Connect(parameters);
}
Click to see the full code

Standalone protocol clients

Each protocol can also be used without FanucRobot, when you only need one protocol:

static void Main()
{
// Standalone SNPX client
var snpx = new SnpxClient();
snpx.Connect("192.168.0.1");
// Standalone Telnet client
var telnet = new TelnetClient();
telnet.Connect("192.168.0.1", "telnet_password");
// Standalone CGTP client
var cgtp = new CgtpClient();
cgtp.Connect("192.168.0.1");
}
}
Click to see the full code

Disconnect

Always disconnect when you are done, to close the connections of every protocol.

FanucRobot robot = new FanucRobot();
robot.Connect("192.168.0.1");
robot.Disconnect();
}
}
Click to see the full code

Try it in the demo application

Everything on this page can be tried without writing code, in the Connection page of the demo application.

Connection page of the Fanuc SDK demo application

The demo application is open source. The C# source of this page is ConnectControl.cs.

Reference

Class
ConnectionParameters
C#Python

Connection parameters

MemberTypeDescription
ConnectionParameters()
Constructor
Instanciate a new connection parameters
ConnectionParameters(string)
Constructor
Instanciate a new connection parameters with a specified address
Address
Property
string
Address of the robot (IP, host name, or path to ROBOGUIDE project folder)
Cgtp
Property
CgtpConnectParameters
Parameters of the CGTP client, which uses the web server of the controller (HTTP)
Ftp
Property
FtpConnectParameters
Access controller internal memory to read variables, IO, positions, diagnosis, ...
Language
Property
Languages
Controller language (default: English)
PingBeforeConnect
Property
bool
Send a ping command before initializing any connections
Rmi
Property
RmiConnectParameters
Parameters for RMI (Remote Motion Interface)
Snpx
Property
SnpxConnectParameters
Read and write IOs, read and clear alarms, read current program tasks
StreamMotion
Property
StreamMotionConnectParameters
Parameters for Stream Motion (J519 option) - real-time streaming motion control over UDP
Telnet
Property
TelnetConnectParameters
Parameters of the Telnet KCL client, which sends commands to the robot for remote control. Telnet KCL is a legacy protocol: it is not secured (password and commands are sent in clear text), and its behavior changes with the firmware version and on ROBOGUIDE. The same KCL commands are available on the web server of the controller with robot.Cgtp.Kcl (firmware V8.30 and later): prefer it for new developments.
Class
TelnetConnectParametersinherits TelnetConnectParametersBase
C#Python

Connection parameters of the Telnet KCL client (remote commands). Telnet KCL is a legacy protocol: it is not secured (password and commands are sent in clear text), and its behavior changes with the firmware version and on ROBOGUIDE. The same KCL commands are available on the web server of the controller with robot.Cgtp.Kcl (firmware V8.30 and later): prefer it for new developments.

MemberTypeDescription
TelnetConnectParameters()
Constructor
Enable
Property
bool
Should use this service (default: false). Prefer robot.Cgtp.Kcl, enabled by default, for new developments.
Class
FtpConnectParametersinherits FtpConnectParametersBase
C#Python

Memory access parameters

MemberTypeDescription
FtpConnectParameters()
Constructor
Enable
Property
bool
Should enable memory access for this connection (default: true)
Class
SnpxConnectParametersinherits SnpxConnectParametersBase
C#Python

SNPX parameters

MemberTypeDescription
SnpxConnectParameters()
Constructor
Enable
Property
bool
Should enable SNPX for this connection (default: false)
Class
CgtpConnectParametersinherits CgtpConnectParametersBase
C#Python

CGTP Web Server connection parameters

MemberTypeDescription
CgtpConnectParameters()
Constructor
Enable
Property
bool
Should enable CGTP Web Server for this connection (default: true)
Class
RmiConnectParametersinherits RmiConnectParametersBase
C#Python

RMI parameters

MemberTypeDescription
RmiConnectParameters()
Constructor
Enable
Property
bool
Should enable RMI for this connection (default: false)
Class
StreamMotionConnectParametersinherits StreamMotionConnectParametersBase
C#Python

Stream Motion connection parameters (J519 option)

MemberTypeDescription
StreamMotionConnectParameters()
Constructor
Enable
Property
bool
Should enable Stream Motion for this connection (default: false)
Ip
Property
string
IP address of the robot for standalone Stream Motion connections

What to read next

  • Test with ROBOGUIDE: work without a real robot.
  • Demo application: try the connection without writing code.
  • The protocol pages: CGTP, SNPX, Telnet, FTP, RMI, Stream Motion.

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

UnderAutomation
Contact usLegal

© All rights reserved.