UnderAutomation
Any question?

[email protected]

Contact us
UnderAutomation
⌘Q

Variables & I/O via Telnet

Read and write system variables, set output ports, simulate and unsimulate input ports using Telnet KCL.

  • Read and write variables
  • Set and simulate I/O ports
  • Available port types
  • Complete example
  • API reference

Read and write system variables, set output ports, simulate and unsimulate input ports using Telnet KCL.

Read and write variables

parameters.Telnet.TelnetKclPassword = "TELNET_PASS";
robot.Connect(parameters);
// Read a variable
GetVariableResult result = robot.Telnet.GetVariable("$RMT_MASTER");
string value = result.RawValue;
// Write a variable
robot.Telnet.SetVariable("$RMT_MASTER", 1);
robot.Telnet.SetVariable("$MCR.$GENOVERRIDE", 50);
robot.Telnet.SetVariable("$[MY_PROG]my_var", "hello");
// Get current pose
GetCurrentPoseResult pose = robot.Telnet.GetCurrentPose();
}
}
Click to see the full code

You can read any system variable, program variable, or user-defined variable by name. The value must match the declared data type. Use brackets ([]) after the variable name to specify an array element.

Set and simulate I/O ports

parameters.Telnet.TelnetKclPassword = "TELNET_PASS";
robot.Connect(parameters);
// Set an output port (DOUT port 2 = OFF)
robot.Telnet.SetPort(KCLPorts.DOUT, 2, 0);
// Set an output port (DOUT port 5 = ON)
robot.Telnet.SetPort(KCLPorts.DOUT, 5, 1);
// Simulate an input port (DIN port 3 = ON)
robot.Telnet.Simulate(KCLPorts.DIN, 3, 1);
// Stop simulating DIN port 3
robot.Telnet.Unsimulate(KCLPorts.DIN, 3);
// Stop simulating all ports
robot.Telnet.UnsimulateAll();
}
}
Click to see the full code

Available port types

The KCLPorts enum defines the available port types:

PortDescription
DIN / DOUTDigital Input / Output
GIN / GOUTGroup Input / Output
AIN / AOUTAnalog Input / Output
OPIN / OPOUTOperator Panel Input / Output
RDI / RDORobot Digital Input / Output
WDI / WDOWeld Digital Input / Output
PLCIN / PLCOUTPLC Input / Output
FLAGFlag register

Complete example

using UnderAutomation.Fanuc;
using UnderAutomation.Fanuc.Telnet;
public class TelnetVariablesIo
{
static void Main()
{
FanucRobot robot = new FanucRobot();
ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");
parameters.Telnet.Enable = true;
parameters.Telnet.TelnetKclPassword = "TELNET_PASS";
robot.Connect(parameters);
// Read a system variable
GetVariableResult result = robot.Telnet.GetVariable("$RMT_MASTER");
string value = result.RawValue;
// Write system variables
robot.Telnet.SetVariable("$RMT_MASTER", 1);
robot.Telnet.SetVariable("$MCR.$GENOVERRIDE", 50);
// Get current TCP pose
GetCurrentPoseResult pose = robot.Telnet.GetCurrentPose();
// Set an output port
robot.Telnet.SetPort(KCLPorts.DOUT, 2, 0);
robot.Telnet.SetPort(KCLPorts.DOUT, 5, 1);
// Simulate an input port
robot.Telnet.Simulate(KCLPorts.DIN, 3, 1);
// Stop simulating a port
robot.Telnet.Unsimulate(KCLPorts.DIN, 3);
// Stop simulating all ports
robot.Telnet.UnsimulateAll();
}
}

API reference

Class
GetVariableResultinherits Result
C#Python

Result of a get variable command containing the raw value.

MemberTypeDescription
GetVariableResult()
Constructor
RawValue
Property
read only
string
Gets the raw value of the variable as a string.
EndReceive()
Method
void
Indicates that responses have been completed and received
FromResult(string)
Method
bool
During implementation, return true if it is assumed that the frame has finished being received.
ParseResult()
Method
GenericVariable
Returns a structured object which represents the variable (not supported with Telnet)
ShouldCompleteOnEmptyAnswer()
Method
bool
Controls whether the result should be finalized when an empty answer is received (i.e. a frame consisting only of VT100 escape sequences and whitespace). Override and return false until meaningful data has been accumulated, to prevent premature finalization caused by intermediate display-update frames. Default is true (backward compatible: finalize immediately on empty answer).
ToString()
Method
string
Class
SetVariableResultinherits SetValueResult
C#Python

Result of a set variable command.

MemberTypeDescription
SetVariableResult()
Constructor
FromResult(string)
Method
bool
During implementation, return true if it is assumed that the frame has finished being received.
ShouldCompleteOnEmptyAnswer()
Method
bool
Controls whether the result should be finalized when an empty answer is received (i.e. a frame consisting only of VT100 escape sequences and whitespace). Override and return false until meaningful data has been accumulated, to prevent premature finalization caused by intermediate display-update frames. Default is true (backward compatible: finalize immediately on empty answer).
Class
SetPortResultinherits SetValueResult
C#Python

Result of a set port command.

MemberTypeDescription
SetPortResult()
Constructor
FromResult(string)
Method
bool
During implementation, return true if it is assumed that the frame has finished being received.
Class
SimulateResultinherits BaseResult
C#Python

Result of a simulate port command.

MemberTypeDescription
SimulateResult()
Constructor
Enum
KCLPorts
C#Python

Enum representing the different KCL ports.

NameValueDescription
AIN
7
Analog Input port.
AOUT
8
Analog Output port.
DIN
0
Digital Input port.
DOUT
1
Digital Output port.
GIN
9
General Input port.
GOUT
10
General Output port.
OPOUT
3
Operator Panel Output port.
RDO
2
Robot Digital Output port.
TPOUT
4
Teach Pendant Output port.
WDI
5
Weld Digital Input port.
WDO
6
Weld Digital Output port.

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

UnderAutomation
Contact usLegal

© All rights reserved.