Main Content

xyzquat

Convert transformation or rotation to compact 3-D pose representation

Since R2023a

    Description

    example

    pose = xyzquat(transformation) converts a transformation transformation to a compact 3-D pose representation pose.

    example

    pose = xyzquat(rotation) converts a rotation rotation to a compact 3-D pose representation pose with no translation.

    Examples

    collapse all

    Create SE(3) transformation with an xyz-position of [2 3 1] and a rotation defined by a numeric quaternion. Use the eul2quat function to create the numeric quaternion.

    trvec = [2 3 1];
    quat1 = eul2quat([0 0 deg2rad(30)]);
    pose1 = [trvec quat1]
    pose1 = 1×7
    
        2.0000    3.0000    1.0000    0.9659    0.2588         0         0
    
    
    T = se3(pose1,"xyzquat")
    T = se3
        1.0000         0         0    2.0000
             0    0.8660   -0.5000    3.0000
             0    0.5000    0.8660    1.0000
             0         0         0    1.0000
    
    

    Convert the transformation back into a compact pose.

    pose2 = xyzquat(T)
    pose2 = 1×7
    
        2.0000    3.0000    1.0000    0.9659    0.2588         0         0
    
    

    Create SO(3) rotation defined by a numeric quaternion. Use the eul2quat function to create the numeric quaternion.

    quat1 = eul2quat([0 0 deg2rad(30)])
    quat1 = 1×4
    
        0.9659    0.2588         0         0
    
    
    R = so3(quat1,"quat")
    R = so3
        1.0000         0         0
             0    0.8660   -0.5000
             0    0.5000    0.8660
    
    

    Convert the rotation into a 3-D compact pose.

    pose1 = xyzquat(R)
    pose1 = 1×7
    
             0         0         0    0.9659    0.2588         0         0
    
    

    Input Arguments

    collapse all

    Transformation, specified as an se3 object or as an N-element array of se3 objects. N is the total number of transformations.

    Rotation, specified as an so3 object or as an N-element array of so3 objects. N is the total number of rotations.

    Output Arguments

    collapse all

    3-D compact pose, returned as an M-by-3 matrix, where each row is of the form [x y z qw qx qy qz]. M is the total number of transformations specified. x, y, z comprise the xyz-position and qw, qx, qy, and qz comprise the quaternion rotation.

    Version History

    Introduced in R2023a

    See Also

    |