UnderAutomation
¿Una pregunta?

[email protected]

Contactos
UnderAutomation
⌘Q
This page is only available in English.

System variables

Read and write integer, real, position, and string system variables on the Fanuc controller via SNPX.

  • Complete example
  • API reference

SNPX lets you read and write system variables by name, including integer, real (float), position, and string types. You can also access Karel program variables using the $[ProgramName]VariableName syntax.

parameters.Snpx.Enable = true;
robot.Connect(parameters);
// Integer variables
int rmtMaster = robot.Snpx.IntegerSystemVariables.Read("$RMT_MASTER");
robot.Snpx.IntegerSystemVariables.Write("$RMT_MASTER", 1);
// Real (float) variables
float overr = robot.Snpx.RealSystemVariables.Read("$MCR.$GENOVERRIDE");
robot.Snpx.RealSystemVariables.Write("$MCR.$GENOVERRIDE", 50.0f);
// Position variables
Position cellFloor = robot.Snpx.PositionSystemVariables.Read("$CELL_FLOOR");
robot.Snpx.PositionSystemVariables.Write("$CELL_FLOOR", cellFloor);
// String variables
string lastAlm = robot.Snpx.StringSystemVariables.Read("$ALM_IF.$LAST_ALM");
// Karel program variables
int karelVar = robot.Snpx.IntegerSystemVariables.Read("$[MyKarelProg]my_variable");
robot.Snpx.IntegerSystemVariables.Write("$[MyKarelProg]my_variable", 42);
// Set variable by name (auto-typed)
robot.Snpx.SetVariable("$RMT_MASTER", 1);
}
}
Click to see the full code

Complete example

using UnderAutomation.Fanuc;
using UnderAutomation.Fanuc.Common;
public class SnpxVariables
{
public static void Main()
{
FanucRobot robot = new FanucRobot();
ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");
parameters.Snpx.Enable = true;
robot.Connect(parameters);
// --- Integer system variables ---
int rmtMaster = robot.Snpx.IntegerSystemVariables.Read("$RMT_MASTER");
robot.Snpx.IntegerSystemVariables.Write("$RMT_MASTER", 1);
// --- Real (float) system variables ---
float genOverride = robot.Snpx.RealSystemVariables.Read("$MCR.$GENOVERRIDE");
robot.Snpx.RealSystemVariables.Write("$MCR.$GENOVERRIDE", 50.0f);
// --- Position system variables ---
Position cellFloor = robot.Snpx.PositionSystemVariables.Read("$CELL_FLOOR");
robot.Snpx.PositionSystemVariables.Write("$CELL_FLOOR", cellFloor);
// --- String system variables ---
string lastAlm = robot.Snpx.StringSystemVariables.Read("$ALM_IF.$LAST_ALM");
robot.Snpx.StringSystemVariables.Write("$ALM_IF.$LAST_ALM", "No alarms");
// --- Karel program variables ---
int karelVar = robot.Snpx.IntegerSystemVariables.Read("$[MyKarelProg]my_variable");
robot.Snpx.IntegerSystemVariables.Write("$[MyKarelProg]my_variable", 42);
// --- Set variable (auto-detects type) ---
robot.Snpx.SetVariable("$RMT_MASTER", 1);
}
}

API reference

Class
PositionSystemVariablesinherits SnpxWritableAssignableElements<Position,string,PositionSystemVariablesBatchAssignment>
C#Python

Provides access to position system variables on the robot via SNPX.

MemberTypeDescription
GetAssignmentName(string)
Method
string
GetAssignmentSize(string)
Method
int
GetAssignmentTarget(string)
Method
string
Read(string)
Method
Position
Reads the position at the specified system variable.
  • index : The system variable name.
ReadFromClient(int, string)
Method
Position
Reads a value from the client at the specified memory offset.
Write(string, CartesianPosition)
Method
void
Writes a Cartesian position to the specified system variable.
  • variable : The system variable name.
  • cartesianPosition : The Cartesian position to write.
Write(string, ExtendedCartesianPosition)
Method
void
Writes an extended Cartesian position to the specified system variable.
  • variable : The system variable name.
  • extendedCartesianPosition : The extended Cartesian position to write.
Write(string, JointsPosition)
Method
void
Writes a joints position to the specified system variable.
  • variable : The system variable name.
  • jointsPosition : The joints position to write.
WriteInClient(int, string, Position)
Method
void
Writes a value to the robot at the specified offset.
Class
StringSystemVariablesinherits SnpxWritableAssignableElements<string,string,StringSystemVariablesBatchAssignment>
C#Python

Provides access to string system variables on the robot via SNPX.

MemberTypeDescription
GetAssignmentName(string)
Method
string
GetAssignmentSize(string)
Method
int
GetAssignmentTarget(string)
Method
string
ReadFromClient(int, string)
Method
string
Reads a value from the client at the specified memory offset.
WriteInClient(int, string, string)
Method
void
Writes a value to the robot at the specified offset.

Integre fácilmente robots Universal Robots, Fanuc, Yaskawa, ABB o Staubli en sus aplicaciones .NET, Python, LabVIEW o Matlab

UnderAutomation
ContactosLegal

© All rights reserved.