UnderAutomation
質問ですか?

[email protected]

お問い合わせ
UnderAutomation
⌘Q
このページは英語でのみ提供されています。

Convert position types

Convert the orientation of a UR pose between rotation vector, roll pitch yaw, 4x4 transform and quaternion with the Pose class.

  • The Pose class
  • Conversions
  • Try it in the demo application
  • Reference
  • What to read next

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

FromToMethod
Rotation vectorRoll, pitch, yawFromRotationVectorToRPY()
Roll, pitch, yawRotation vectorFromRPYToRotationVector()
Rotation vector4x4 transformFromRotationVectorTo4x4Matrix()
Roll, pitch, yaw4x4 transformFromRPYTo4x4Matrix()
4x4 transformRotation vectorPose.From4x4MatrixToRotationVector(matrix)
4x4 transformRoll, pitch, yawPose.From4x4MatrixToRPY(matrix)
Rotation vectorQuaternionFromRotationVectorToQuaternion(out x, out y, out z, out w)
QuaternionRotation vectorPose.FromQuaternionToRotationVector(x, y, z, w)
Text p[x, y, z, rx, ry, rz]PosePose.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.

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);
}
}
Click to see the full code

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.

Convert position types page of the Universal Robots SDK demo application

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

Reference

Class
Poseinherits CartesianCoordinates
C#Python

Represents a UR pose

MemberTypeDescription
Pose()
Constructor
Creates a new pose with all coordinates set to zero.
Pose(double, double, double)
Constructor
Creates a new pose with the specified translation and zero rotation.
  • x : X translation in meters.
  • y : Y translation in meters.
  • z : Z translation in meters.
Pose(double, double, double, double, double, double)
Constructor
Creates a new pose with the specified translation and rotation.
  • x : X translation in meters.
  • y : Y translation in meters.
  • z : Z translation in meters.
  • rx : Rotation vector X component in radians.
  • ry : Rotation vector Y component in radians.
  • rz : Rotation vector Z component in radians.
Pose(Pose)
Constructor
Creates a new pose by copying values from another pose.
  • pose : The pose to copy.
RxDegrees
Property
double
RX rotation in degrees or °/s
RyDegrees
Property
double
RY rotation in degrees or °/s
RzDegrees
Property
double
RZ rotation in degrees or °/s
From4x4MatrixToRPY(double[,])
Method
static
Pose
Convert a transformation 4x4 matrix to RPY pose
From4x4MatrixToRotationVector(double[,])
Method
static
Pose
Convert a transformation 4x4 matrix to rotation vector
FromQuaternionToRotationVector(double, double, double, double)
Method
static
Pose
Converts a quaternion to UR rotation vector
FromRPYTo4x4Matrix()
Method
double[,]
Consider this pose as a RPY (Roll-Pitch-Yaw) representation and return a 4x4 homogeneous transformation matrix.
FromRPYToRotationVector()
Method
Pose
Consider this pose as RPY And convert it to a new Rotation Vector
FromRotationVectorTo4x4Matrix()
Method
double[,]
Consider this pose as a rotation vector and return a 4x4 homogeneous transformation matrix.
FromRotationVectorToQuaternion(out double, out double, out double, out double)
Method
void
Converts a rotation vector to quaternion
FromRotationVectorToRPY()
Method
Pose
Consider this pose as a Rotation Vector And convert it to a new RPY position
ToString()
Method
string
Returns 6 comma separated coordinated with G1 format
TryParse(string, out Pose)
Method
static
bool
Parse a pose from its string representation
  • value : String representation of the pose like : p[0.1,0,0.2,0.01,0,0]
  • pose : The output parsed pose

What to read next

  • Kinematics: from joint positions to a pose, and back.
  • Get the robot position.

Universal Robots、Fanuc、Yaskawa、ABB、Staubli ロボットを .NET、Python、LabVIEW、または Matlab アプリケーションに簡単に統合

UnderAutomation
お問い合わせLegal

© All rights reserved.