UnderAutomation
Eine Frage?

[email protected]

Kontakt
UnderAutomation
⌘Q
Diese Seite ist nur auf Englisch verfügbar.

Connect to your robot

Prepare the controller (remote mode, job selection, file overwrite), then connect the SDK: High Speed Ethernet Server by default, Ethernet Server, HTTP and FTP on demand. Ports, timeouts, errors.

This page explains how to connect the SDK to a Yaskawa Motoman controller: the settings of the controller, the connection parameters, the errors and the disconnection. By default the SDK uses the High Speed Ethernet Server of the controller, over UDP. The Ethernet Server, HTTP and FTP are enabled with one flag each, see Choose a protocol. Nothing is installed on the controller.

Prerequisites

  • The PC reaches the controller on the network. Its address is set in LAN INTERFACE SETTING, see Enable the Ethernet function.
  • The Ethernet function is enabled on the controller. The High Speed Ethernet Server answers on the UDP ports 10040 (data) and 10041 (files). A firewall between the PC and the controller must let these ports through.
  • The controller is one of: YRC1000 (micro), MOTOMAN NEXT, DX100 / DX200, FS100.

The read methods work in any mode. The commands (servo, motion, job start, file write) need the settings below.

Prepare the controller

Each setting is made once, on the programming pendant, with the security mode set to MANAGEMENT. Do the steps in this order: first the Ethernet function, then the parameters, then the remote commands.

Enable the Ethernet function

The Ethernet function is set in the maintenance mode of the controller.

  1. Start the controller in maintenance mode. Two ways:
    • Switch on the controller while you hold the MAIN MENU key of the pendant.
    • On a running controller, select CPU RESET > MAINTENANCE > REBOOT.
  2. Select SYSTEM INFO and press the SECURITY button.
  3. Select the mode and change it to MANAGEMENT. The default password is sixteen 9: 9999999999999999.
  4. In the main menu, select SYSTEM > SETUP > OPTION FUNCTION.

Option function

  1. In LAN INTERFACE SETTING, set the IP address, the subnet mask and the gateway of the controller.
  2. In NETWORK FUNCTION SETTING:
    • Set ETHERNET to USED.
    • Set FTP to EXPANDED. The FTP client needs it.
    • Set ETHERNET SERVER to EXPANDED. The Ethernet Server client needs it.

Network function setting

  1. Restart the controller in normal mode.

If ETHERNET stays at NOT USED and cannot be changed, the Ethernet function is not enabled on your controller. Ask the Yaskawa support to enable it. It is a parameter of the FD type: only the Yaskawa mode can change it, with a checksum signature in the file ALL.PRM.

Set the parameters

Select PARAMETER > RS and set these values:

ParameterValueMeaning
RS0002Transmission protocol of the host control function
RS0051The port is used by the host control function
RS0072Read and write are accepted when the controller is not in remote mode
RS0221The variable number 0 is accepted
RS0291Upload files and write data during the playback
RS034200Response wait timer A, in ms. Factory value
RS035200Monitoring timer B, in ms. Factory value

To write the I/O and the variables in play mode, select PARAMETER > S2C and set:

ControllerParameterValue
DX100, FS100S2C4091
DX200, YRC1000, YRC1000microS2C541, S2C5420

GetSystemParameter reads these values back from your application, see System parameters.

Enable the remote commands

  • Select IN/OUT > PSEUDO INPUT SIGNAL.
  • Move the cursor to #82015 CMD REMOTE SEL and press INTER LOCK + SELECT.

Enable remote command

Put the key in the remote position

The commands need the key of the pendant in the remote position.

Pendant remote key

To use the key for the remote control, copy #80011 (key in the remote position) to #40042 (remote control enabled) with the ladder editor:

  • Select IN/OUT > LADDER EDITOR.
  • Check that no other rung writes #40042, then add this rung:

Ladder remote key

GetStatusInformation().CommandRemote is true when the controller accepts the remote commands.

Allow the job selection

  • Select SETUP > FUNCTION ENABLE.
  • Set JOB SELECT WHEN REMOTE AND PLAY to PERMIT. On the Smart Pendant, set the parameter SC2 224 to 0.

Job select when remote and play

Allow the file overwrite

To send a file that already exists on the controller:

  • Select PARAMETER > RS.
  • Set RS029 to 1 and RS214 to 1.

Quick connection

Pass the address of the controller. The other parameters keep their default values.

static void Main()
{
var robot = new YaskawaRobot();
// IP address of the controller, default ports and timeouts
robot.Connect("192.168.0.1");
// Every function of the SDK is a method of robot.HighSpeedEServer
var status = robot.HighSpeedEServer.GetStatusInformation();
Console.WriteLine($"Servo on: {status.ServoOn}, play mode: {status.Play}");
robot.Disconnect();
}
}
Click to see the full code

YaskawaRobot gives access to every function of the SDK, through its HighSpeedEServer property.

Connection parameters

ConnectParameters holds every option. Use it when the controller has other ports, or when the network needs longer timeouts.

static void Main()
{
var parameters = new ConnectParameters("192.168.0.1");
// Ping the controller first (default: true)
parameters.PingBeforeConnect = true;
// UDP ports of the High Speed Ethernet Server (defaults: 10040 and 10041)
parameters.HighSpeedEServer.DataPort = 10040;
parameters.HighSpeedEServer.FilePort = 10041;
// Time to wait for an answer, in milliseconds
parameters.HighSpeedEServer.DataTimeoutMilliseconds = 1500;
parameters.HighSpeedEServer.PowerOnTimeoutMilliseconds = 8000;
parameters.HighSpeedEServer.FileTimeoutMilliseconds = 4000;
var robot = new YaskawaRobot();
robot.Connect(parameters);
robot.Disconnect();
}
Click to see the full code
ParameterDefaultMeaning
IPnoneIP address or host name of the controller
PingBeforeConnecttrueSend a ping first. The connection fails if there is no answer in 200 ms
HighSpeedEServer.EnabletrueOpen the High Speed Ethernet Server client
HighSpeedEServer.DataPort10040UDP port of the data commands
HighSpeedEServer.FilePort10041UDP port of the file transfers
HighSpeedEServer.DataTimeoutMilliseconds1500Time to wait for the answer of a data command
HighSpeedEServer.PowerOnTimeoutMilliseconds8000Time to wait for the answer of SetServo(true)
HighSpeedEServer.FileTimeoutMilliseconds4000Time to wait for the answer of a file transfer
EServer.EnablefalseOpen the Ethernet Server client (TCP 80)
Http.EnablefalseOpen the HTTP client (TCP 80)
Ftp.EnablefalseOpen the FTP client (TCP 21)

The other parameters of EServer, Http and Ftp (ports, timeouts, FTP account) are described on the page of each protocol.

static void Main()
{
var parameters = new ConnectParameters("192.168.0.1");
// High Speed Ethernet Server (UDP 10040 and 10041): enabled by default
parameters.HighSpeedEServer.Enable = true;
// Ethernet Server (TCP 80): status, jobs, variables, I/O and moves
parameters.EServer.Enable = true;
// Web server of the controller (TCP 80): file lists and text files
parameters.Http.Enable = true;
// FTP server of the controller (TCP 21): file transfers
parameters.Ftp.Enable = true;
parameters.Ftp.FtpUser = "ftp"; // "anonymous" can only download
var robot = new YaskawaRobot();
robot.Connect(parameters);
// One property per protocol
var status = robot.HighSpeedEServer.GetStatusInformation();
var jobs = robot.EServer.GetJobDirectory();
var files = robot.Http.GetFileList(FileExtension.JOB);
var listing = robot.Ftp.GetListing("/JOB");
// Closes every protocol
robot.Disconnect();
}
}
Click to see the full code

The ping also protects the controller: a request sent while the controller starts can raise an error on it. Set PingBeforeConnect to false only when a firewall blocks ICMP between the PC and the controller.

UDP: what "connected" means

UDP has no connection. Connect checks the license, sends the ping and opens the socket: it does not exchange a message with the controller. The first method call is the first exchange. If the controller does not answer, this call fails after DataTimeoutMilliseconds.

To check the link at startup, call a read method, for example GetStatusInformation(), right after Connect.

Connected is true while the socket is open.

Standalone client

HighSpeedEServerClient opens a High Speed Ethernet Server client without YaskawaRobot. The methods are then directly on the client: client.GetStatusInformation() instead of robot.HighSpeedEServer.GetStatusInformation().

static void Main()
{
// A High Speed Ethernet Server client without YaskawaRobot
var client = new HighSpeedEServerClient();
client.Connect("192.168.0.1", new HighSpeedEServerConnectParameters());
// The methods are directly on the client
RobotStatusData status = client.GetStatusInformation();
Console.WriteLine($"Running: {status.Running}");
client.Close();
}
}
Click to see the full code

Errors

{
var robot = new YaskawaRobot();
try
{
robot.Connect("192.168.0.1");
robot.HighSpeedEServer.StartJob();
}
catch (InvalidLicenseException ex)
{
// No valid license: the trial is over, or the key is wrong
Console.WriteLine(ex.LicenseInfo);
}
catch (ConnectException ex)
{
// The UDP socket could not be opened
Console.WriteLine($"{ex.Address}: {ex.Message}");
}
catch (InvalidDataAnswerException ex)
{
// The controller refused the command, for example "Servo OFF" or "Command remote not set"
Console.WriteLine($"{ex.Message} ({ex.Status}, {ex.AddedStatus})");
}
catch (SocketException ex)
{
// No answer before the timeout
Console.WriteLine(ex.Message);
}
catch (Exception ex)
{
// For example, no answer to the ping
Console.WriteLine(ex.Message);
}
}
}
Click to see the full code
ExceptionWhen
InvalidLicenseExceptionConnect is called without a valid license. See Licensing
ExceptionNo answer to the ping, or a method is called before Connect
ConnectExceptionThe UDP socket could not be opened. Address gives the address and the port
SocketExceptionNo answer before the timeout, or the port is closed
InvalidDataAnswerExceptionThe controller refused the command. Message gives the reason, Status and AddedStatus the codes
HostControlExceptionThe controller refused a command of the Ethernet Server
FtpExceptionAn FTP operation failed. Reason gives the cause, see FTP

Frequent messages of InvalidDataAnswerException, and what to check:

MessageCheck
Command remote not setThe remote mode, see Prepare the controller
Incorrect modeThe mode of the controller: play mode to start a job
Servo OFFSwitch the servo on first
Error/alarm occurringReset the alarm, see Alarms
Hold by programming pendant, External holdRelease the hold on the pendant or on the external signal
Cannot over write the target fileRS029 and RS214, see Allow the file overwrite

Disconnect

Disconnect closes the sockets. Call it when your application ends, or when it no longer needs the controller.

var robot = new YaskawaRobot();
robot.Connect("192.168.0.1");
// True while the UDP socket is open
Console.WriteLine(robot.Connected);
// Close the sockets when the application no longer needs the controller
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 Yaskawa SDK demo application

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

Reference

Class
ConnectParameters
C#Python

Contains a set of connection parameters for robot communication. Supports High Speed Ethernet Server and Host Control protocols.

MemberTypeDescription
ConnectParameters()
Constructor
Creates a new set of connect parameters
ConnectParameters(string)
Constructor
Creates a new set of connect parameters and defines IP property
EServer
Property
EServerConnectParametersInternal
Ethernet Server connect parameters. Used for TCP-based Host Control communication via Ethernet Server.
Ftp
Property
FtpConnectParametersInternal
FTP connect parameters. Used for file upload, download, listing and management via the robot's built-in FTP server.
HighSpeedEServer
Property
HighSpeedEServerConnectParametersInternal
High Speed Ethernet Server connect parameters
Http
Property
HttpConnectParametersInternal
HTTP connect parameters. Used for file listing and file content retrieval via the robot's built-in web server.
IP
Property
string
IP Adress or robot host name
PingBeforeConnect
Property
bool
Send a ping command before connecting
Class
HighSpeedEServerConnectParametersInternalinherits HighSpeedEServerConnectParameters
C#Python

Represents a set of High Speed Ethernet Server connection parameters

MemberTypeDescription
HighSpeedEServerConnectParametersInternal()
Constructor
Enable
Property
bool
Gets or sets a value indicating whether to enable the High Speed Ethernet Server connection (default: true).
Class
HighSpeedEServerConnectParameters
C#Python

Base class defining connection parameters for the High Speed Ethernet Server communication. This class cannot be instantiated directly; use a derived class or use Connect with optional parameters. Allows customization of timeouts and ports for different network environments.

MemberTypeDescription
HighSpeedEServerConnectParameters()
Constructor
Initializes a new instance of the connection parameters class.
DataPort
Property
int
Gets or sets the UDP port number for data communication. Must match the robot controller's High Speed Ethernet Server data port configuration. Default: 10040.
DataTimeoutMilliseconds
Property
int
Gets or sets the maximum time in milliseconds to wait for a response to data commands. Applies to most read/write operations like position reading, variable access, etc. Default: 1500ms.
FilePort
Property
int
Gets or sets the UDP port number for file transfer operations. Must match the robot controller's High Speed Ethernet Server file port configuration. Default: 10041.
FileTimeoutMilliseconds
Property
int
Gets or sets the maximum time in milliseconds to wait for file operation responses. File operations may be slower due to larger data transfers and disk I/O on the controller. Default: 4000ms.
PowerOnTimeoutMilliseconds
Property
int
Gets or sets the maximum time in milliseconds to wait for servo power on to complete. Servo power on may take longer due to brake release and motor initialization. Default: 8000ms.
DEFAULT_DATA_PORT
Field
int
Default UDP port for data communication (10040).
DEFAULT_DATA_TIMEOUT_MILLISECONDS
Field
int
Default timeout in milliseconds for data commands (1500ms).
DEFAULT_FILE_PORT
Field
int
Default UDP port for file transfer operations (10041).
DEFAULT_FILE_TIMEOUT_MILLISECONDS
Field
int
Default timeout in milliseconds for file operations (4000ms).
DEFAULT_POWER_ON_TIMEOUT_MILLISECONDS
Field
int
Default timeout in milliseconds for servo power on operations (8000ms).
Class
ConnectExceptioninherits Exception
C#Python

Exception thrown when connection to a Yaskawa robot fails

MemberTypeDescription
Address
Property
read only
string
Address of the robot (IP:port)
Service
Property
read only
string
Name of the protocol that failed to connect
Class
InvalidDataAnswerExceptioninherits Exception
C#Python

Exception thrown when the robot controller returns an error response to a High Speed Ethernet Server command. This exception contains detailed status codes that help identify the specific error condition.

MemberTypeDescription
AddedStatus
Property
read only
int
Gets the additional status code providing more detailed error information. The interpretation of this value depends on the primary Status code.
Status
Property
read only
int
Gets the primary status code returned by the robot controller. A value of 0 indicates success; any other value indicates an error condition.

What to read next

  • Choose a protocol: High Speed Ethernet Server, Ethernet Server, HTTP and FTP side by side.
  • High Speed Ethernet Server: the topics of the default protocol.