Positions and torque
Read the joint pulses and the Cartesian position in the base, robot, user or tool frame, the posture, the torque and the encoder temperatures through the Ethernet Server.
This page shows how to read the position of a Yaskawa Motoman robot through the Ethernet Server: joint pulses, Cartesian position in the base, robot, user or tool frame, posture, torque and encoder temperatures. It covers the YRC1000 and YRC1000micro controllers.
Read the position
var robot = new YaskawaRobot();robot.Connect(parameters);// Joints, in encoder pulsesHostControlJointPositionData joints = robot.EServer.GetRobotJointPosition();Console.WriteLine($"S={joints.S} L={joints.L} U={joints.U} R={joints.R} B={joints.B} T={joints.T}");// Cartesian position in the base frame (default), mm and degreesHostControlCartesianPositionData tcp = robot.EServer.GetRobotCartesianPosition();Console.WriteLine($"X={tcp.X} Y={tcp.Y} Z={tcp.Z} Rx={tcp.Rx} Ry={tcp.Ry} Rz={tcp.Rz}");// Posture of the arm and tool of the positionConsole.WriteLine($"Front: {tcp.IsFront}, upper arm: {tcp.IsUpperArm}, flip: {tcp.IsFlip}, tool: {tcp.ToolNumber}");// Same position in the robot frame, or in a user framevar inRobot = robot.EServer.GetRobotCartesianPosition(HostControlCoordinateSystem.Robot);var inUser1 = robot.EServer.GetRobotCartesianPosition(HostControlCoordinateSystem.User1);// With the external axes (Re, Axis8...)var withExternal = robot.EServer.GetRobotCartesianPosition(HostControlCoordinateSystem.Base, true);robot.Disconnect();}
Joint position
GetRobotJointPosition() reads the encoder pulses of each axis: S, L, U, R, B, T, then E and Axis8 to Axis12 for the external axes. Axes gives the same values in one array of 12 values.
The number of pulses per degree depends on the axis and on the robot model. To compute a position from joint angles, see Offline kinematics.
Cartesian position
GetRobotCartesianPosition(coordinateSystem, includeExternalAxes) reads the position of the tool center point, in mm and degrees.
HostControlCoordinateSystem | Frame of the values |
|---|---|
Base (default) | Base frame |
Robot | Robot frame |
User1 to User8 | User frame 1 to 8 |
Tool | Tool frame |
ToolNumber gives the tool of the position. On a 7-axis robot, Re holds the elbow angle.
With includeExternalAxes set to true, Axis8 to Axis12 also hold the positions of the external axes. On a 6-axis robot, Re holds the 7th axis.
On a robot without base axis, the base frame and the robot frame give the same values.
Posture
The same Cartesian position can be reached with several postures of the arm. Type holds the posture, and these properties decode it:
| Property | Meaning |
|---|---|
IsFront | The wrist is in front of the S axis |
IsUpperArm | The elbow is above the line shoulder to wrist |
IsFlip | Flip posture of the wrist |
IsRLessThan180, IsTLessThan180, IsSLessThan180 | The angle of the axis is less than 180 degrees |
Pass the Type to MoveJoint and MoveLinear to send the robot back to a position with the same posture. See Motion.
Torque and encoder temperatures
var robot = new YaskawaRobot();robot.Connect(parameters);// Torque of each axis, in percent of the rated torqueHostControlTorqueData torque = robot.EServer.GetTorque();HostControlTorqueData maxTorque = robot.EServer.GetMaxTorque();// Temperature of the encoder of each axis, in degrees CelsiusHostControlEncoderTemperatureData temperatures = robot.EServer.GetEncoderTemperature();for (int axis = 0; axis < 6; axis++)Console.WriteLine($"Axis {axis + 1}: {torque.Values[axis]} % (max {maxTorque.Values[axis]} %), {temperatures.Values[axis]} C");robot.Disconnect();}
| Method | Values |
|---|---|
GetTorque() | Torque of each axis, in percent of the rated torque |
GetMaxTorque() | Maximum torque of each axis, in percent |
GetEncoderTemperature() | Temperature of the encoder of each axis, in degrees Celsius |
Each array has 12 values: the 6 axes of the robot, then the external axes. With the servo off, the torques are 0. A log of the encoder temperatures over a shift shows which axis heats up in a cycle.
Control group and task
GetControlGroup() reads the robot group, the station group and the task selected for the next commands. SetControlGroup(robotGroup, stationGroup) and SetTask(task) change them, on a controller with several robots, stations or tasks.
Reference
Methods of HostControlClientBase :// Reads the current control group configuration. Returns robot group bits, station group bits, and current task number.HostControlGroupData GetControlGroup();// Reads the encoder temperature values of all robot axes.HostControlEncoderTemperatureData GetEncoderTemperature();// Reads the maximum torque values of all robot axes. Returns values as a percentage of the maximum rated torque.HostControlTorqueData GetMaxTorque();// Reads the current robot Cartesian position (TCP position and orientation). Coordinates are returned in millimeters for X, Y, Z and degrees for Rx, Ry, Rz.HostControlCartesianPositionData GetRobotCartesianPosition(HostControlCoordinateSystem coordinateSystem = HostControlCoordinateSystem.Base, bool includeExternalAxes = false);// Reads the current robot joint position in pulse (encoder) values. Returns raw pulse values for all robot axes (S, L, U, R, B, T, and external axes).HostControlJointPositionData GetRobotJointPosition();// Reads the current torque values of all robot axes. Returns values as a percentage of the maximum rated torque.HostControlTorqueData GetTorque();// Reads user coordinate frame data from the robot controller. Returns the three reference points (ORG, XX, XY) defining the user coordinate system.HostControlUserFrameData GetUserFrame(int userCoordinateNumber);// Changes the control group selection.HostControlResponse SetControlGroup(int robotGroup, int stationGroup);// Changes the current task selection.HostControlResponse SetTask(int task);// Writes user coordinate frame data to the robot controller. Defines a user coordinate system using three reference points (ORG, XX, XY).HostControlResponse SetUserFrame(int userCoordinateNumber, HostControlUserFrameData frame);
Contains joint position data in pulse (encoder) values.
| Member | Type | Description |
|---|---|---|
Axes Property read only | int[] | Gets all axis values as an array of encoder pulse values. Array contains 12 elements: S, L, U, R, B, T, E, Axis8 through Axis12. |
Axis10 Property read only | int | Gets or sets the 10th axis position in pulses. |
Axis11 Property read only | int | Gets or sets the 11th axis position in pulses. |
Axis12 Property read only | int | Gets or sets the 12th axis position in pulses. |
Axis8 Property read only | int | Gets or sets the 8th axis position in pulses. |
Axis9 Property read only | int | Gets or sets the 9th axis position in pulses. |
B Property read only | int | Gets or sets the B axis position in pulses. |
E Property read only | int | Gets or sets the E axis (7th axis) position in pulses. |
L Property read only | int | Gets or sets the L axis position in pulses. |
R Property read only | int | Gets or sets the R axis position in pulses. |
S Property read only | int | Gets or sets the S axis position in pulses. |
T Property read only | int | Gets or sets the T axis position in pulses. |
U Property read only | int | Gets or sets the U axis position in pulses. |
Contains Cartesian position data (TCP position and orientation).
| Member | Type | Description |
|---|---|---|
Axis10 Property read only | double | Gets or sets the 10th external axis value. |
Axis11 Property read only | double | Gets or sets the 11th external axis value. |
Axis12 Property read only | double | Gets or sets the 12th external axis value. |
Axis8 Property read only | double | Gets or sets the 8th external axis value. |
Axis9 Property read only | double | Gets or sets the 9th external axis value. |
CoordinateSystem Property read only | int | Gets or sets the coordinate system index. 0: Base, 1-65: User coordinates. |
IsFlip Property read only | bool | Gets whether the robot is in flip configuration. |
IsFront Property read only | bool | Gets whether the robot is in front configuration. |
IsRLessThan180 Property read only | bool | Gets whether R axis is less than 180 degrees. |
IsSLessThan180 Property read only | bool | Gets whether S axis is less than 180 degrees. |
IsTLessThan180 Property read only | bool | Gets whether T axis is less than 180 degrees. |
IsUpperArm Property read only | bool | Gets whether the robot is in upper arm configuration. |
Re Property read only | double | Gets or sets the Re (7th axis rotation) in degrees or millimeters. |
Rx Property read only | double | Gets or sets the Rx (rotation around X axis) in degrees. |
Ry Property read only | double | Gets or sets the Ry (rotation around Y axis) in degrees. |
Rz Property read only | double | Gets or sets the Rz (rotation around Z axis) in degrees. |
Type Property read only | int | Gets or sets the robot posture/configuration type. Defines arm configuration (flip, upper/lower arm, front/back, etc.). |
X Property read only | double | Gets or sets the X position in millimeters. |
Y Property read only | double | Gets or sets the Y position in millimeters. |
Z Property read only | double | Gets or sets the Z position in millimeters. |
Specifies the coordinate system for position commands.
| Name | Value | Description |
|---|---|---|
Base | 0 | Base coordinate system (robot base frame). |
Robot | 1 | Robot coordinate system. |
Tool | 16 | Tool coordinate system. |
User1 | 2 | User coordinate system 1. |
User2 | 3 | User coordinate system 2. |
User3 | 4 | User coordinate system 3. |
User4 | 5 | User coordinate system 4. |
User5 | 6 | User coordinate system 5. |
User6 | 7 | User coordinate system 6. |
User7 | 8 | User coordinate system 7. |
User8 | 9 | User coordinate system 8. |
Contains torque values for each robot axis. Retrieved using the RTRQ (current torque) or RMAXTRQ (maximum torque) commands.
| Member | Type | Description |
|---|---|---|
Values Property read only | double[] | Gets the torque values for each axis (up to 12 axes). Values are in percentage of maximum rated torque. |
Contains encoder temperature values for each robot axis. Retrieved using the RENCTMP command.
| Member | Type | Description |
|---|---|---|
Values Property read only | double[] | Gets the temperature values for each axis encoder (up to 12 axes). Values are in degrees Celsius. |
Contains control group information. Retrieved using the RGROUP command.
| Member | Type | Description |
|---|---|---|
RobotGroup Property read only | int | Gets or sets the robot group bits. Each bit represents a robot control group (R1, R2, etc.). |
StationGroup Property read only | int | Gets or sets the station group bits. Each bit represents a station control group (S1, S2, etc.). |
Task Property read only | int | Gets or sets the current task number. 0: Master task, 1-15: Sub tasks. |
What to read next
- Get the robot position: which protocol and which method to choose.
- Motion: send the robot to a position.