UnderAutomation
Any question?

[email protected]

Contact us
UnderAutomation
⌘Q

Position

Read the current joints and the Cartesian position of a Staubli robot, for the flange or a tool, in the world frame or in another frame.

  • Joints and Cartesian position
  • Joints only
  • With a tool and a frame
  • Position of a joint configuration
  • Try it in the demo application
  • Reference

This page shows how to read the current position of a Staubli robot on a CS8 or CS9 controller: the joint values, and the Cartesian position of the flange or of a tool, in the world or in another frame.

Joints and Cartesian position

GetCurrentCartesianJointPosition(robot) returns the joints and the Cartesian position of the flange in the world frame, in one request.

var controller = new StaubliController();
controller.Connect("192.168.0.254");
// Joints and flange position of the first robot, in one request
CartesianJointPosition position = controller.Soap.GetCurrentCartesianJointPosition(robot: 0);
// Joint values, in radians
double[] joints = position.JointsPosition;
// Flange position in the world frame: X, Y, Z in meters, Rx, Ry, Rz in radians
CartesianPosition flange = position.CartesianPosition;
Console.WriteLine($"X={flange.X} Y={flange.Y} Z={flange.Z}");
Console.WriteLine($"Rx={flange.Rx} Ry={flange.Ry} Rz={flange.Rz}");
controller.Disconnect();
}
Click to see the full code
ValueUnit
JointsPosition, one value per axisradians
X, Y, Zmeters
Rx, Ry, Rzradians

Joints only

GetCurrentJointPosition(robot) returns only the joint values. Use it when you do not need the Cartesian position.

var controller = new StaubliController();
controller.Connect("192.168.0.254");
// Only the joints, in radians
double[] joints = controller.Soap.GetCurrentJointPosition(robot: 0);
for (int i = 0; i < joints.Length; i++)
Console.WriteLine($"J{i + 1} = {joints[i] * 180 / Math.PI:F2} deg");
controller.Disconnect();
}
Click to see the full code

With a tool and a frame

By default, the Cartesian position is the one of the flange, in the world frame. Pass a tool and a frame to get the position of the tool center point in the frame of your part or table.

  • tool: position of the tool center point, given in the flange frame.
  • frame: position of the reference frame, given in the world frame.
var controller = new StaubliController();
controller.Connect("192.168.0.254");
// Tool center point, given in the flange frame: 120 mm along Z
var tool = new CartesianPosition { Z = 0.120 };
// Reference frame, given in the world frame: a table 500 mm in front of the robot
var frame = new CartesianPosition { X = 0.500 };
CartesianJointPosition position = controller.Soap.GetCurrentCartesianJointPosition(robot: 0, tool, frame);
// Position of the tool center point in the table frame
CartesianPosition tcp = position.CartesianPosition;
controller.Disconnect();
}
Click to see the full code

Pass null (None in Python) for the flange or for the world frame.

Position of a joint configuration

To get the Cartesian position of joint values that are not the current ones, use the forward kinematics: see Kinematics.

Try it in the demo application

Everything on this page can be tried without writing code, in the Get current position page of the demo application.

Get current position page of the Staubli SDK demo application

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

Reference

Methods of SoapClientBase :
C#
// Get the Cartesian position and joint positions of a robot
CartesianJointPosition GetCurrentCartesianJointPosition(int robot = 0, CartesianPosition tool = null, CartesianPosition frame = null);
// Get the current joint position of a robot
double[] GetCurrentJointPosition(int robot = 0);
Class
CartesianJointPosition
C#Python

Represents the joint positions and the Cartesian position of a robot end effector.

MemberTypeDescription
CartesianJointPosition()
Constructor
CartesianPosition
Property
CartesianPosition
The Cartesian position of the robot end effector.
JointsPosition
Property
double[]
The joint positions in radians.
Equals(object)
Method
bool
GetHashCode()
Method
int
ToString()
Method
string
Class
CartesianPosition
C#Python

Represents a Cartesian position with X, Y, Z translation and Rx, Ry, Rz rotation components.

MemberTypeDescription
CartesianPosition()
Constructor
Initializes a new instance of the CartesianPosition class.
Rx
Property
double
Rotation around the X axis (radians).
Ry
Property
double
Rotation around the Y axis (radians).
Rz
Property
double
Rotation around the Z axis (radians).
X
Property
double
X translation component (m).
Y
Property
double
Y translation component (m).
Z
Property
double
Z translation component (m).
Equals(object)
Method
bool
GetHashCode()
Method
int
ToString()
Method
string

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

UnderAutomation
Contact usLegal

© All rights reserved.