The class `Pose` holds a Cartesian position of a Universal Robots cobot, and converts its orientation between the formats used by robots and vision systems. This page lists the conversions. They run on the PC, without a robot.

## The Pose class

A `Pose` has 6 values, as in URScript: X, Y, Z in meters, then RX, RY, RZ, a rotation vector in radians. `RxDegrees`, `RyDegrees` and `RzDegrees` give the rotation in degrees: they are computed from RX, RY, RZ, not stored.

The SDK returns a `Pose` for the positions of the robot (RTDE `ActualTcpPose`, Primary Interface `CartesianInfo.AsPose()`), and accepts one as the answer of an XML-RPC call.

## Conversions

| From                    | To                      | Method                                          |
| ----------------------- | ----------------------- | ----------------------------------------------- |
| Rotation vector         | Roll, pitch, yaw        | `FromRotationVectorToRPY()`                     |
| Roll, pitch, yaw        | Rotation vector         | `FromRPYToRotationVector()`                     |
| Rotation vector         | 4x4 transform           | `FromRotationVectorTo4x4Matrix()`               |
| Roll, pitch, yaw        | 4x4 transform           | `FromRPYTo4x4Matrix()`                          |
| 4x4 transform           | Rotation vector         | `Pose.From4x4MatrixToRotationVector(matrix)`    |
| 4x4 transform           | Roll, pitch, yaw        | `Pose.From4x4MatrixToRPY(matrix)`               |
| Rotation vector         | Quaternion              | `FromRotationVectorToQuaternion(out x, out y, out z, out w)` |
| Quaternion              | Rotation vector         | `Pose.FromQuaternionToRotationVector(x, y, z, w)` |
| Text `p[x, y, z, rx, ry, rz]` | Pose              | `Pose.TryParse(text, out pose)`                 |

The roll, pitch and yaw are stored in RX, RY and RZ of the returned `Pose`. The X, Y, Z do not change.

**C# : PoseConvert**
```csharp
using UnderAutomation.UniversalRobots.Common;

class PoseConvert
{
  static void Main(string[] args)
  {
    /**/
    // X, Y, Z in meters, then a rotation vector RX, RY, RZ in radians
    var pose = new Pose(0.4, -0.1, 0.3, 0, 3.14, 0);

    // Rotation in degrees, computed from RX, RY, RZ
    double rxDegrees = pose.RxDegrees;

    // Same position, rotation as roll, pitch, yaw
    Pose rpy = pose.FromRotationVectorToRPY();

    // And back to a rotation vector
    Pose rotationVector = rpy.FromRPYToRotationVector();

    // 4x4 homogeneous transforms
    double[,] matrix = pose.FromRotationVectorTo4x4Matrix();
    Pose fromMatrix = Pose.From4x4MatrixToRotationVector(matrix);

    // Quaternion
    pose.FromRotationVectorToQuaternion(out double qx, out double qy, out double qz, out double qw);
    Pose fromQuaternion = Pose.FromQuaternionToRotationVector(qx, qy, qz, qw);

    // Text of the form "p[0.4, -0.1, 0.3, 0, 3.14, 0]"
    bool ok = Pose.TryParse("p[0.4, -0.1, 0.3, 0, 3.14, 0]", out Pose parsed);
    /**/
  }
}
```

**Python : PoseConvert**
```python
from underautomation.universal_robots.common.pose import Pose

##
# X, Y, Z in meters, then a rotation vector RX, RY, RZ in radians
pose = Pose(0.4, -0.1, 0.3, 0, 3.14, 0)

# Rotation in degrees, computed from RX, RY, RZ
rx_degrees = pose.rx_degrees

# Same position, rotation as roll, pitch, yaw
rpy = pose.from_rotation_vector_to_rpy()

# And back to a rotation vector
rotation_vector = rpy.from_rpy_to_rotation_vector()

# 4x4 homogeneous transforms
matrix = pose.from_rotation_vector_to4x4_matrix()
from_matrix = Pose.from4x4_matrix_to_rotation_vector(matrix)

# Quaternion to rotation vector
from_quaternion = Pose.from_quaternion_to_rotation_vector(0, 1, 0, 0)
##
```

In Python, `FromRotationVectorToQuaternion` and `TryParse` are not usable: they have `out` parameters.

## Try it in the demo application

Everything on this page can be tried without writing code, in the **Convert position types** page of the [demo application](/universal-robots/documentation/demo-app).

![Convert position types page of the Universal Robots SDK demo application](/universal-robots/WinformsScreenshots/Tools.jpg)

Its C# source is [ToolsControl.cs](https://github.com/underautomation/UniversalRobots.NET/blob/main/UnderAutomation.UniversalRobots.Showcase.Forms/Components/ToolsControl.cs).

## Reference

**Members of Common.Pose**
```csharp
public class Pose : CartesianCoordinates {
    // Creates a new pose with all coordinates set to zero.
    public Pose()

    // Creates a new pose with the specified translation and zero rotation.
    public Pose(double x, double y, double z)

    // Creates a new pose with the specified translation and rotation.
    public Pose(double x, double y, double z, double rx, double ry, double rz)

    // Creates a new pose by copying values from another pose.
    public Pose(Pose pose)

    // Convert a transformation 4x4 matrix to RPY pose
    public static Pose From4x4MatrixToRPY(double[,] matrixTransform)

    // Convert a transformation 4x4 matrix to rotation vector
    public static Pose From4x4MatrixToRotationVector(double[,] matrixTransform)

    // Converts a quaternion to UR rotation vector
    public static Pose FromQuaternionToRotationVector(double x, double y, double z, double w)

    // Consider this pose as a RPY (Roll-Pitch-Yaw) representation and return a 4x4 homogeneous transformation matrix.
    public double[,] FromRPYTo4x4Matrix()

    // Consider this pose as RPY And convert it to a new Rotation Vector
    public Pose FromRPYToRotationVector()

    // Consider this pose as a rotation vector and return a 4x4 homogeneous transformation matrix.
    public double[,] FromRotationVectorTo4x4Matrix()

    // Converts a rotation vector to quaternion
    public void FromRotationVectorToQuaternion(out double x, out double y, out double z, out double w)

    // Consider this pose as a Rotation Vector And convert it to a new RPY position
    public Pose FromRotationVectorToRPY()

    // RX rotation in degrees or °/s
    public double RxDegrees { get; set; }

    // RY rotation in degrees or °/s
    public double RyDegrees { get; set; }

    // RZ rotation in degrees or °/s
    public double RzDegrees { get; set; }

    // Returns 6 comma separated coordinated with G1 format
    public override string ToString()

    // Parse a pose from its string representation
    public static bool TryParse(string value, out Pose pose)
}
```

## What to read next

- [Kinematics](/universal-robots/documentation/kinematics): from joint positions to a pose, and back.
- [Get the robot position](/universal-robots/documentation/how-to-get-position).