API Documentation

Transform

The PolySync Transformation API.

Usage #include <PolySyncTransform.hpp>

Compile-time constants

Name Value
PSYNC_COORDINATE_FRAME_INVALID 0UL.
PSYNC_COORDINATE_FRAME_UNKNOWN 1UL.
PSYNC_COORDINATE_FRAME_NOT_AVAILABLE 2UL.
PSYNC_COORDINATE_FRAME_LOCAL 3UL.
PSYNC_COORDINATE_FRAME_PLATFORM 4UL.
PSYNC_COORDINATE_FRAME_RELATIVE 5UL.
PSYNC_COORDINATE_FRAME_ABSOLUTE 6UL.

Non-member functions

std::array< double, 4 > RpyToQuaternion ( … )

These are Orientation to Quaternion conversion utility functions.

The function will convert roll/pitch/yaw to quaternion.

Parameters
in/out type name description
in const std::array< double, 3 > & rpy Roll, pitch, yaw (x, y, z axes of rotation). [radians]
Returns
  • const std::array< double, 4 > - Quaternion x, y, z, and w (world) values
Exceptions
  • Throws polysync::DTCException on failure:

std::array< double, 3 > quaternionToRpy ( … )

This function will convert quaternion values to an array of values representing roll/pitch/yaw.

Parameters
in/out type name description
in const std::array< double, 4 > & quat quaternion x, y, z, and w (world) values.
Returns
  • Orientation - roll, pitch, yaw (x, y, z axes of rotation) [radians]
Exceptions
  • Throws polysync::DTCException on failure.

Transform

Transform::Transform( )

This will initialize a transform, allocating dynamic memory resources.

The function sets ps_transform.id to the default PSYNC_COORDINATE_FRAME_LOCAL frame.

Exceptions
  • Throws polysync::DTCException on failure:

Transform::~Transform ( )

The transform destructor.

This will release resources allocated to underlying data.

Transform::setOrigin ( … )

This will set the transform origin vector.

Note that it will not take effect until the transform is pushed with push.

Parameters
in/out type name description
in std::array< double, 3 > origin X, y, and z position of the origin. [meters]
Exceptions
  • Throws polysync::DTCException on failure:

Transform::getOrigin ( … )

This will get the transform origin vector.

The function will get the origin vector from a transform (either the parent or in the stack) by its coordinate frame identifier.

Parameters
in/out type name description
in ps_identifier id Coordinate frame identifier to search for.
Returns
  • std::array< double, 3 > [meters]
Exceptions

Transform::updateOrigin ( … )

This will update the transform origin vector.

updateOrigin will update the origin vector in a transform (either the parent or in the stack) by its coordinate frame identifier.

It updates the timestamp of the parent and the child transformation.

Parameters
in/out type name description
in ps_identifier id Coordinate frame identifier to search for.
in const std::array< double, 3 > & origin New x, y, z position of the origin. [meters]
Exceptions

Transform::setOrientation( … )

This will set the transform orientation roll, pitch, and yaw vector.

Note that this will not take effect until the transform is pushed with push.

Parameters
in/out type name description
in const std::array< double, 3 > & rpy Roll, pitch, and yaw (x, y, z axes of rotation) of the orientation. [radians]
Exceptions
  • Throws polysync::DTCException on failure:

Transform::getOrientation ( … )

This will get the orientation roll, pitch, and yaw vector from a transform (either the parent or in the stack) by its coordinate frame identifier.

Parameters
in/out type name description
in ps_identifier id Coordinate frame identifier to search for.
Returns
  • std::array< double, 3 > [radians]
Exceptions

Transform::updateOrientation ( … )

This will update the orientation roll/pitch/yaw vector in a transform (either the parent or in the stack) by its coordinate frame identifier.

It updates the timestamp of the parent and the child transformation.

Parameters
in/out type name description
in ps_identifier id Coordinate frame identifier to search for.
in const std::array< double, 3 > & rpy X, y, z coordinates. [radians]
Exceptions

Transform::getTimestamp ( … )

This will get the timestamp from the transform, given the coordinate frame identifier.

Parameters
in/out type name description
in ps_identifier id Coordinate frame identifier to search for.
Returns
Exceptions

Transform::push ( … )

This will push the current transform on the transformation stack as a child to the parent coordinate frame identifier.

This sets ps_transform.id to parentID, and updates the timestamp of the parent and the child transformation. Once a push operation is done, the transform becomes part of the overall transformation.

Parameters
in/out type name description
in ps_identifier parentID Coordinate frame identifier of the new parent frame.
Exceptions
  • Throws polysync::DTCException on failure:

Transform::pop ( )

This will pop the top transform off the stack.

The function sets the ps_transform.id to the child’s ID that is being removed.

This will update the orientation roll/pitch/yaw vector in a transform (either the parent or in the stack) by its coordinate frame identifier. It will also update the timestamp of the parent.

Exceptions

frameIsAvailable ( … )

This will check if the coordinate frame is available in the transform.

The function checks the parent and the stack for the given identifier.

Parameters
in/out type name description
in ps_identifier id Coordinate frame identifier of the new parent frame.
Returns
  • bool - True if the frame is available

std::array< double, 3 > apply ( … )

This will apply transform to a vector in (R^3).

The function uses the transform stack to apply a transformation to the given vector. For example, given an input vector in the first child’s coordinate frame, apply the transform stack to get an output vector in the parent’s coordinate frame.

Parameters
in/out type name description
in const std::array< double, 3 > & in Point - x, y, z coordinates.
Returns
  • Point out - Transformed x, y, z coordinates
Exceptions

Transform::applySubframe ( … )

This will apply child transform to a vector in (R^3).

The function uses the transform stack to apply a transformation to the given vector. For example, given an input vector in the first child’s coordinate frame, apply the transform stack to get an output vector in the given child coordinate frame.

Parameters
in/out type name description
in ps_identifier childID The coordinate frame identifier of the child frame to use.
in const std::array< double, 3 > in Point - Input x, y, z coordinates.
Returns
  • std::array< double, 3 >
Exceptions

Transform::copyStack ( … )

This will copy the internal transform data into a ‘TransformStack’.

Parameters
in/out type name description
out ps_transform_stack stack A pointer to ps_transform_stack that receives the configuration.
Exceptions
  • Throws polysync::DTCException on failure: