UnderAutomation
Any question?

[email protected]

Contact us
UnderAutomation
⌘Q
Fanuc SDK documentation
Read & write I/O comments
Documentation home

Access Karel program variables

Read and write Karel program variables using SNPX ($[Program]Variable syntax), CGTP, or FTP variable files.

  • SNPX
  • CGTP Web Server
  • Telnet
  • Protocol comparison

Read and write variables inside Karel programs running on your Fanuc robot.

SNPX

SNPX accesses Karel variables using the $[ProgramName]VariableName naming convention:

// Read a Karel integer variable
int myVar = robot.Snpx.IntegerSystemVariables.Read("$[MyKarelProg]my_variable");
// Write a Karel integer variable
robot.Snpx.IntegerSystemVariables.Write("$[MyKarelProg]my_variable", 42);
// Read a Karel real variable
float realVar = robot.Snpx.RealSystemVariables.Read("$[MyKarelProg]speed_ratio");
// Read a Karel position variable
Position posVar = robot.Snpx.PositionSystemVariables.Read("$[MyKarelProg]target_pos");
// Read a Karel string variable
string strVar = robot.Snpx.StringSystemVariables.Read("$[MyKarelProg]status_msg");

See also: SNPX System variables

CGTP Web Server

CGTP reads and writes Karel program variables using the progName parameter:

// Read a Karel variable
CgtpVariableValue var = robot.Cgtp.ReadVariable("my_variable", progName: "MyKarelProg");
int intVal = var.IntegerValue;
// Write a Karel variable
robot.Cgtp.WriteVariable("my_variable", 42, progName: "MyKarelProg");
// Read as string
string raw = robot.Cgtp.ReadVariableAsString("speed_ratio", progName: "MyKarelProg");

See also: CGTP Registers & variables

Telnet

Telnet allows you to read and write a karel program variable

GetVariableResult result = robot.Telnet.GetVariable("VAR_NAME", "KarelProgramName");

Protocol comparison

FeatureSNPXCGTPTelnet
Speed~2 ms~50 ms~100 ms
Typed readYes (4 types)Yes (auto-detect)Yes (file parse)
WriteYesYesNo
Batch readYesYesYes (all at once)
All variable typesInteger, Real, Position, StringAllAll

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

UnderAutomation
Contact usLegal

© All rights reserved.