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 over the High Speed Ethernet Server: ports, timeouts, errors and disconnection.

  • Prerequisites
  • Prepare the controller
  • Enable the remote commands
  • Put the key in the remote position
  • Allow the job selection
  • Allow the file overwrite
  • Quick connection
  • Connection parameters
  • UDP: what "connected" means
  • Standalone client
  • Errors
  • Disconnect
  • Try it in the demo application
  • Reference

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. The SDK uses the High Speed Ethernet Server of the controller, over UDP. Nothing is installed on the controller.

Prerequisites

  • The PC reaches the controller on the network. Its address is shown in the network settings of the controller, on the pendant.
  • The High Speed Ethernet Server function is enabled on the controller. It 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, ERC / XRC / MRC.

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 management mode set to Security mode.

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 ServoCommand(Servo, true)
HighSpeedEServer.FileTimeoutMilliseconds4000Time to wait for the answer of a file transfer

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

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#

Contains a set of connection parameters for robot communication.

MemberTypeDescription
ConnectParameters()
Constructor
Creates a new set of connect parameters
ConnectParameters(string)
Constructor
Creates a new set of connect parameters and defines IP property
HighSpeedEServer
Property
HighSpeedEServerConnectParametersInternal
High Speed Ethernet Server connect parameters
IP
Property
string
IP Adress or robot host name
PingBeforeConnect
Property
bool
Send a ping command before connecting
Class
HighSpeedEServerConnectParametersInternalinherits HighSpeedEServerConnectParameters
C#

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#

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#

Exception thrown when connection to a Yaskawa robot fails

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

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.

Integrieren Sie Roboter von Universal Robots, Fanuc, Yaskawa, ABB oder Staubli ganz einfach in Ihre .NET-, Python-, LabVIEW- oder Matlab-Anwendungen

UnderAutomation
KontaktLegal

© All rights reserved.