|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.roboticsAPI.geometricModel.math.AbstractTransformation
com.kuka.roboticsAPI.geometricModel.math.Transformation
public final class Transformation
An immutable representation of a spatial transformation.
A spatial transformation is used to describe a displacement of rigid bodies or coordinate systems in space. The displacement consists of a pure translation of the object along a line in space, plus a rotation of the object. In mathematics, a transformation is commonly identified by a homogeneous 4x4 transformation matrix, but different representations also exist. Common in robotics is the X-Y-Z-A-B-C representation, which defines one value for each of the six degrees of freedom for rigid objects in space.
A transformation only defines the relative displacement of one object or
coordinate system to another. If you need to specify the location and
orientation of an object with respect to a distinct location, you can use a
Frame, which lets you
construct a graph of objects in space.
This class is a suitable representation of a transformation for general
purpose calculations. Internally it consists of matrix and x, y, z, α,
β, γ representations of the same transformation. You can access
those representations directly without having to convert the transformation
into another representation via the different get...() or
with...() functions.
The Robotics API always assumes the translation part to be given in [mm].
To create an instance of this class, use one of the provided static constructor methods, for example:
Transformation trafo = Transformation.ofDeg(20, 0, -100, 90, 0, -90);
IDENTITY.
You can do the following computations with a transformation:
compose(ITransformation)
AbstractTransformation.applyTo(Point)
AbstractTransformation.applyTo(Vector)
invert()
This type is immutable, which means that once you have created an instance of
a transformation, that instance will never change. This makes it suitable to
be shared between application modules, or between threads without the need
for locking or synchronization. Use the provided with...() methods to
create new instances of Transformation based on an existing instance.
You can convert a transformation from one form to another by using the static
of(...) methods defined on each class.
If you need to make a large number of computations on transformations,
consider using MatrixTransformation, which only performs the matrix
operations without conversion to Euler angles.
MatrixTransformation,
XyzAbcTransformation,
Frame| Field Summary | |
|---|---|
static Transformation |
IDENTITY
Immutable Transformation instance representing identity (i.e. |
| Method Summary | |
|---|---|
Transformation |
compose(ITransformation other)
If the transformations A and B are represented as homogeneous matrices, then the effect of A.compose(B) is that of the matrix multiplication A*B. |
boolean |
equals(Object obj)
|
double |
getAlphaRad()
Returns the α (alpha) angle of the rotation part of the transformation in [rad]. |
double |
getBetaRad()
Returns the β (beta) angle of the rotation part of the transformation in [rad]. |
double |
getGammaRad()
Returns the γ (gamma) angle of the rotation part of the transformation in [rad]. |
Rotation |
getRotation()
Returns the rotation corresponding to this transformation. |
Matrix |
getRotationMatrix()
Returns the rotational part of the transformation as a 3x3 matrix. |
Vector |
getTranslation()
Returns the translation part of the transformation, i.e. the upper-right 3x1 part of the corresponding homogeneous transformation matrix. |
Vector |
getUnitVectorX()
Returns the x unit vector after it has been rotated by this rotation. |
Vector |
getUnitVectorY()
Returns the y unit vector after it has been rotated by this rotation. |
Vector |
getUnitVectorZ()
Returns the z unit vector after it has been rotated by this rotation. |
double |
getX()
Returns the x element of the translation part of the
transformation. |
double |
getY()
Returns the y element of the translation part of the
transformation. |
double |
getZ()
Returns the z element of the translation part of the
transformation. |
int |
hashCode()
|
Transformation |
invert()
Returns an inverted transformation, i.e. a transformation that reverses the effect of this one. |
static Transformation |
of(ITransformation orig)
Returns an immutable Transformation instance with the same value
as the given transformation. |
static Transformation |
of(Vector translation,
IRotation rotation)
Returns an immutable Transformation instance, consisting of a
rotational and a translational part. |
static Transformation |
of(Vector translation,
Matrix rotMatrix)
Returns an immutable Transformation instance, consisting of a
rotational and a translational part. |
static Transformation |
ofDeg(double x,
double y,
double z,
double alpha,
double beta,
double gamma)
Returns an immutable Transformation instance, consisting of a
translational and a rotational part. |
static Transformation |
ofRad(double x,
double y,
double z,
double alpha,
double beta,
double gamma)
Returns an immutable Transformation instance, consisting of a
translational and a rotational part. |
static Transformation |
ofTranslation(double x,
double y,
double z)
Returns an immutable Transformation instance, consisting of a
translational part and no rotation. |
static Transformation |
ofTranslation(Vector translation)
Returns an immutable Transformation instance, consisting of a
translational part and no rotation. |
String |
toString()
Returns a textual description of the transformation. |
Transformation |
transformationTo(ITransformation other)
Calculates the transformation needed to move this transformation into the other transformation. |
Transformation |
withAlphaRad(double value)
Returns a new instance (copy) of the transformation, with the α (alpha) angle replaced by the new value. |
Transformation |
withBetaRad(double value)
Returns a new instance (copy) of the transformation, with the β (beta) angle replaced by the new value. |
Transformation |
withGammaRad(double value)
Returns a new instance (copy) of the transformation, with the γ (gamma) angle replaced by the new value. |
Transformation |
withRotation(IRotation rotation)
Returns a new instance (copy) of the transformation, with the rotational part replaced by the given rotation. |
Transformation |
withRotation(Matrix matrix)
Returns a new instance (copy) of the transformation, with the rotational part replaced by the given rotation in matrix form. |
Transformation |
withRotationDeg(double alpha,
double beta,
double gamma)
Returns a new instance (copy) of the transformation, with the rotational part set to the given Euler Z-Y-X angles α, β, γ in degrees. |
Transformation |
withRotationRad(double alpha,
double beta,
double gamma)
Returns a new instance (copy) of the transformation, with the rotational part set to the given Euler Z-Y-X angles α, β, γ in radians. |
Transformation |
withTranslation(double x,
double y,
double z)
Returns a new instance (copy) of the transformation, with the translational part replaced by the given three cartesian vector elements x, y, z. |
Transformation |
withTranslation(Vector translation)
Returns a new instance (copy) of the transformation, with the translational part replaced by the given translation. |
Transformation |
withX(double value)
Returns a new instance (copy) of this transformation where the x
element of the translation part of the is replaced by the given value. |
Transformation |
withY(double value)
Returns a new instance (copy) of this transformation where the y
element of the translation part of the is replaced by the given value. |
Transformation |
withZ(double value)
Returns a new instance (copy) of this transformation where the z
element of the translation part of the is replaced by the given value. |
| Methods inherited from class com.kuka.roboticsAPI.geometricModel.math.AbstractTransformation |
|---|
applyTo, applyTo, distanceTo, rotationalDistanceTo |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Transformation IDENTITY
Transformation instance representing identity (i.e.
unchanging) transformation.
| Method Detail |
|---|
public static Transformation ofRad(double x,
double y,
double z,
double alpha,
double beta,
double gamma)
Transformation instance, consisting of a
translational and a rotational part. The translation is given by the
three cartesian vector elements x, y, z. The rotation is given by the
three Euler Z-Y-X angles α, β, γ in [rad].
x - x element of translationy - y element of translationz - z element of translationalpha - the α (alpha) angle of the rotation in [rad]. Note: This
is the same as the angle A in KUKA notation.beta - the β (beta) angle of the rotation in [rad]. Note: This
is the same as the angle B in KUKA notation.gamma - the γ (gamma) angle of the rotation in [rad]. Note: This
is the same as the angle C in KUKA notation.
Transformation instance
public static Transformation ofDeg(double x,
double y,
double z,
double alpha,
double beta,
double gamma)
Transformation instance, consisting of a
translational and a rotational part. The translation is given by the
three cartesian vector elements x, y, z. The rotation is given by the
three Euler Z-Y-X angles α, β, γ in degrees.
x - x element of translationy - y element of translationz - z element of translationalpha - the α (alpha) angle of the rotation in degrees. Note:
This is the same as the angle A in KUKA notation.beta - the β (beta) angle of the rotation in degrees. Note: This
is the same as the angle B in KUKA notation.gamma - the γ (gamma) angle of the rotation in degrees. Note:
This is the same as the angle C in KUKA notation.
Transformation instance
public static Transformation ofTranslation(double x,
double y,
double z)
Transformation instance, consisting of a
translational part and no rotation. The translation is given by the three
cartesian vector elements x, y, z.
x - x element of translationy - y element of translationz - z element of translation
Transformation instancepublic static Transformation ofTranslation(Vector translation)
Transformation instance, consisting of a
translational part and no rotation.
translation - the translational part of the transformation (the upper-right
3x1 part of a homogeneous transformation matrix).
Transformation instance
IllegalArgumentException - if translation is null
public static Transformation of(Vector translation,
IRotation rotation)
Transformation instance, consisting of a
rotational and a translational part.
translation - the translational part of the transformation.rotation - the rotational part of the transformation.
Transformation instance
IllegalArgumentException - if rotation or translation is null
public static Transformation of(Vector translation,
Matrix rotMatrix)
Transformation instance, consisting of a
rotational and a translational part.
translation - the translational part of the transformation (the upper-right
3x1 part of a homogeneous transformation matrix).rotMatrix - the rotational part of the transformation (the upper-left 3x3
part of a homogeneous transformation matrix).
Transformation instance
IllegalArgumentException - if rotation or translation is nullpublic static Transformation of(ITransformation orig)
Transformation instance with the same value
as the given transformation. If the given transformation already is of a
known immutable type then it is returned unchanged.
orig - The transformation whose value should be taken over.
Transformation instance
IllegalArgumentException - if orig is nullpublic Transformation compose(ITransformation other)
ITransformation
compose in interface ITransformationcompose in class AbstractTransformationother - the transformation to combine with this one
public Transformation invert()
ITransformation
invert in interface ITransformationinvert in class AbstractTransformationpublic Transformation transformationTo(ITransformation other)
ITransformation
trafo1.compose(trafo1.rotationTo(trafo2)) is equal to
trafo2
transformationTo in interface ITransformationtransformationTo in class AbstractTransformationother - another transformation
public double getX()
x element of the translation part of the
transformation.
x element of the translation part of the
transformationpublic double getY()
y element of the translation part of the
transformation.
y element of the translation part of the
transformationpublic double getZ()
z element of the translation part of the
transformation.
z element of the translation part of the
transformationpublic double getAlphaRad()
Note: This is the same as the angle A in KUKA notation.
public double getBetaRad()
Note: This is the same as the angle B in KUKA notation.
public double getGammaRad()
Note: This is the same as the angle C in KUKA notation.
public Vector getUnitVectorX()
getUnitVectorY(),
getUnitVectorZ()public Vector getUnitVectorY()
getUnitVectorX(),
getUnitVectorZ()public Vector getUnitVectorZ()
getUnitVectorX(),
getUnitVectorY()public Matrix getRotationMatrix()
public Rotation getRotation()
ITransformation
getRotation in interface ITransformationgetRotation in class AbstractTransformationpublic Vector getTranslation()
ITransformation
getTranslation in interface ITransformationgetTranslation in class AbstractTransformationpublic Transformation withX(double value)
x
element of the translation part of the is replaced by the given value.
value - the x element of the translation part of the
transformation
public Transformation withY(double value)
y
element of the translation part of the is replaced by the given value.
value - the y element of the translation part of the
transformation
public Transformation withZ(double value)
z
element of the translation part of the is replaced by the given value.
value - the z element of the translation part of the
transformation
public Transformation withAlphaRad(double value)
value - the α (alpha) angle of the transformation in [rad].
Note: This is the same as the angle A in KUKA notation.
public Transformation withBetaRad(double value)
value - the β (beta) angle of the transformation in [rad]. Note:
This is the same as the angle B in KUKA notation.
public Transformation withGammaRad(double value)
value - the γ (gamma) angle of the transformation in [rad].
Note: This is the same as the angle C in KUKA notation.
public Transformation withRotation(IRotation rotation)
AbstractTransformation
withRotation in class AbstractTransformationrotation - the rotational part of the transformation (the upper-left 3x3
part of a homogeneous transformation matrix).
public Transformation withRotationRad(double alpha,
double beta,
double gamma)
alpha - the α (alpha) angle of the rotation in [rad]. Note: This
is the same as the angle A in KUKA notation.beta - the β (beta) angle of the rotation in [rad]. Note: This
is the same as the angle B in KUKA notation.gamma - the γ (gamma) angle of the rotation in [rad]. Note: This
is the same as the angle C in KUKA notation.
public Transformation withRotationDeg(double alpha,
double beta,
double gamma)
alpha - the α (alpha) angle of the rotation in [degrees]. Note:
This is the same as the angle A in KUKA notation.beta - the β (beta) angle of the rotation in [degrees]. Note:
This is the same as the angle B in KUKA notation.gamma - the γ (gamma) angle of the rotation in [degrees]. Note:
This is the same as the angle C in KUKA notation.
public Transformation withRotation(Matrix matrix)
matrix - the rotational part of the transformation (the upper-left 3x3
part of a homogeneous transformation matrix).
IllegalArgumentException - if the matrix is not a rotation matrixpublic Transformation withTranslation(Vector translation)
AbstractTransformation
withTranslation in class AbstractTransformationtranslation - the translational part of the transformation (the upper-right
3x1 part of a homogeneous transformation matrix).
public Transformation withTranslation(double x,
double y,
double z)
x - x element of translationy - y element of translationz - z element of translation
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic String toString()
AbstractTransformationThis implementation will return a description of origin in cartesian coordinates and rotation in Euler Z-Y-X angles with KUKA notation (A, B, C). The following string can be regarded as typical:
"[X=100.00 Y=-234.23 Z=-3.00 A=1.23 B=3.14 C=-0.13]"
toString in class AbstractTransformation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||