|
Fang-Robotics-MCB
Fang Robotics Team Codebase
|
#include <transform.hpp>
Public Member Functions | |
| Transform (const Position &translation, const Orientation &rotation) | |
| Transform (Position &&translation, Orientation &&rotation) | |
| Transform (const CMSISMat< 3, 1 > &translation, const CMSISMat< 3, 3 > &rotation) | |
| Transform (CMSISMat< 3, 1 > &&translation, CMSISMat< 3, 3 > &&rotation) | |
| Transform (float x, float y, float z, float rx, float ry, float rz) | |
| Transform (const Position &translation, const Orientation &rotation, const Vector &velocity, const Vector &acceleration, const Vector &angularVelocity) | |
| Transform (Position &&translation, Orientation &&rotation, Vector &&velocity, Vector &&acceleration, Vector &&angularVelocity) | |
| Transform (const DynamicPosition &dynamicPosition, const DynamicOrientation &dynamicOrientation) | |
| Transform (DynamicPosition &&dynamicPosition, DynamicOrientation &&dynamicOrientation) | |
| Transform (const CMSISMat< 3, 1 > &translation, const CMSISMat< 3, 3 > &rotation, const CMSISMat< 3, 1 > &velocity, const CMSISMat< 3, 1 > &acceleration, const CMSISMat< 3, 3 > &angularVelocity) | |
| Transform (CMSISMat< 3, 1 > &&translation, CMSISMat< 3, 3 > &&rotation, CMSISMat< 3, 1 > &&velocity, CMSISMat< 3, 1 > &&acceleration, CMSISMat< 3, 3 > &&angularVelocity) | |
| Transform (float x, float y, float z, float vx, float vy, float vz, float ax, float ay, float az, float rx, float ry, float rz, float wx, float wy, float wz) | |
| Position | apply (const Position &position) const |
| Apply this transform to a position. | |
| Vector | apply (const Vector &vector) const |
| Rotates a vector in the base frame to a vector in the follower frame. | |
| DynamicPosition | apply (const DynamicPosition &dynamicPosition) const |
| Brings a dynamic position in the base frame to one in the follower frame. | |
| Orientation | apply (const Orientation &orientation) const |
| Brings an orientation in the base frame to one in the follower frame. | |
| DynamicOrientation | apply (const DynamicOrientation &dynamicOrientation) const |
| Brings a dynamic orientation in the base frame to one in the follower frame. | |
| void | updateTranslation (const Position &newTranslation) |
| Updates the translation of the current transformation matrix. | |
| void | updateTranslation (Position &&newTranslation) |
| Updates the translation of the current transformation matrix. | |
| void | updateTranslation (float x, float y, float z) |
| Updates the translation of the current transformation matrix. | |
| void | updateTranslation (const DynamicPosition &newTranslation) |
| Updates the translation of the current transformation matrix. | |
| void | updateTranslation (DynamicPosition &&newTranslation) |
| Updates the translation of the current transformation matrix. | |
| void | updateRotation (const Orientation &newRotation) |
| Updates the rotation of the current transformation matrix. | |
| void | updateRotation (Orientation &&newRotation) |
| Updates the rotation of the current transformation matrix. | |
| void | updateRotation (float roll, float pitch, float yaw) |
| Updates the rotation of the current transformation matrix. Takes rotation angles in the order of roll->pitch->yaw. | |
| void | updateRotation (const DynamicOrientation &newRotation) |
| Updates the rotation of the current transformation matrix. | |
| void | updateRotation (DynamicOrientation &&newRotation) |
| Updates the rotation of the current transformation matrix. | |
| void | updateVelocity (const Vector &newVelocity) |
| Updates the velocity of the current transform. | |
| void | updateVelocity (Vector &&newVelocity) |
| Updates the velocity of the current transform. | |
| void | updateVelocity (float vx, float vy, float vz) |
| Updates the velocity of the current transform. | |
| void | updateAcceleration (const Vector &newAcceleration) |
| Updates the acceleration of the current transform. | |
| void | updateAcceleration (Vector &&newAcceleration) |
| Updates the acceleration of the current transform. | |
| void | updateAcceleration (float ax, float ay, float az) |
| Updates the acceleration of the current transform. | |
| void | updateAngularVelocity (const Vector &newAngularVelocity) |
| Updates the angular velocity of the current transform. | |
| void | updateAngularVelocity (Position &&newAngularVelocity) |
| Updates the angular velocity of the current transform. | |
| void | updateAngularVelocity (float vr, float vp, float vy) |
| Updates the angular velocity of the current transform. | |
| Transform | getInverse () const |
| Transform | compose (const Transform &second) const |
| Returns the composed transformation of the given transformations. | |
| Transform | composeStatic (const Transform &second) const |
| Returns the composed transformation of the given transformations, ignoring any time derivatives. | |
| Transform | projectForward (float dt) const |
| Projects this transform forward in time according to its translational velocity/acceleration and angular velocity. | |
| Position | getTranslation () const |
| Vector | getVelocity () const |
| Vector | getAcceleration () const |
| DynamicPosition | getDynamicTranslation () const |
| Orientation | getRotation () const |
| Vector | getAngularVel () const |
| DynamicOrientation | getDynamicOrientation () const |
| float | getRoll () const |
| Get the roll of this transformation. | |
| float | getPitch () const |
| Get the pitch of this transformation. | |
| float | getYaw () const |
| Get the yaw of this transformation. | |
| float | getRollVelocity () const |
| Get the roll velocity of this transformation. | |
| float | getPitchVelocity () const |
| Get the pitch velocity of this transformation. | |
| float | getYawVelocity () const |
| Get the yaw velocity of this transformation. | |
| float | getX () const |
| Get the x-component of this transform's translation. | |
| float | getY () const |
| Get the y-component of this transform's translation. | |
| float | getZ () const |
| Get the z-component of this transform's translation. | |
| float | getXVel () const |
| Get the x-component of this transform's linear velocity. | |
| float | getYVel () const |
| Get the y-component of this transform's linear velocity. | |
| float | getZVel () const |
| Get the z-component of this transform's linear velocity. | |
| float | getXAcc () const |
| Get the x-component of this transform's linear acceleration. | |
| float | getYAcc () const |
| Get the y-component of this transform's linear acceleration. | |
| float | getZAcc () const |
| Get the z-component of this transform's linear acceleration. | |
| bool | isDynamic () const |
| Whether there are any non-zero derivatives. | |
Static Public Member Functions | |
| static Transform | identity () |
| Constructs an identity transform. | |
Represents a transformation from one coordinate frame to another. A Static Transform from frame A to frame B defines a relationship between the two frames, such that a spatial measurement in frame A can be represented equivalently in frame B by applying a translational and rotational offset. This process is known as applying a transform.
Static Transforms are specified as a translation and rotation of some "follower" frame relative to some "base" frame. The "translation" is the follower frame's origin in base frame, and the "rotation" is the follower frame's orientation relative to the base frame's orientation.
Conceptually, translations are applied "before" rotations. This means that the origin of the follower frame is entirely defined by the translation in the base frame, and the rotation serves only to change the orientation of the follower frame's axes relative to the base frame.
A Dynamic Transform is an extension of a Static Transform that can store linear velocity, linear acceleration, and angular velocity. This class handles both, automatically determining whether it is static or dynamic.
Utilizes ARM's CMSIS matrix operations.
| tap::algorithms::transforms::Transform::Transform | ( | const Position & | translation, |
| const Orientation & | rotation | ||
| ) |
| rotation | Initial rotation of this transformation. |
| position | Initial translation of this transformation. |
| tap::algorithms::transforms::Transform::Transform | ( | Position && | translation, |
| Orientation && | rotation | ||
| ) |
| tap::algorithms::transforms::Transform::Transform | ( | const CMSISMat< 3, 1 > & | translation, |
| const CMSISMat< 3, 3 > & | rotation | ||
| ) |
| rotation | Initial rotation of this transformation. |
| position | Initial translation of this transformation. |
| tap::algorithms::transforms::Transform::Transform | ( | CMSISMat< 3, 1 > && | translation, |
| CMSISMat< 3, 3 > && | rotation | ||
| ) |
| tap::algorithms::transforms::Transform::Transform | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | rx, | ||
| float | ry, | ||
| float | rz | ||
| ) |
Constructs rotations using XYZ Euler angles, so rotations are applied in order of rx, ry, then rz. As an example, for an x-forward, z-up coordinate system, this is in the order of roll, pitch, then yaw.
| x | Initial x-component of the translation. |
| y | Initial y-component of the translation. |
| z | Initial z-component of the translation. |
| rx | Initial rotation angle about the x-axis. |
| ry | Initial rotation angle about the y-axis. |
| rz | Initial rotation angle about the z-axis. |
| tap::algorithms::transforms::Transform::Transform | ( | const Position & | translation, |
| const Orientation & | rotation, | ||
| const Vector & | velocity, | ||
| const Vector & | acceleration, | ||
| const Vector & | angularVelocity | ||
| ) |
| translation | Initial translation of this transformation. |
| rotation | Initial rotation of this transformation. |
| velocity | Translational velocity of this transformation. |
| acceleration | Translational acceleration of this transformation. |
| angularVelocity | Angular velocity pseudovector of this transformation. |
| tap::algorithms::transforms::Transform::Transform | ( | Position && | translation, |
| Orientation && | rotation, | ||
| Vector && | velocity, | ||
| Vector && | acceleration, | ||
| Vector && | angularVelocity | ||
| ) |
| translation | Initial translation of this transformation. |
| rotation | Initial rotation of this transformation. |
| velocity | Translational velocity of this transformation. |
| acceleration | Translational acceleration of this transformation. |
| angularVelocity | Angular velocity pseudovector of this transformation. |
| tap::algorithms::transforms::Transform::Transform | ( | const DynamicPosition & | dynamicPosition, |
| const DynamicOrientation & | dynamicOrientation | ||
| ) |
| rotation | Initial rotation of this transformation. |
| position | Initial translation of this transformation. |
| tap::algorithms::transforms::Transform::Transform | ( | DynamicPosition && | dynamicPosition, |
| DynamicOrientation && | dynamicOrientation | ||
| ) |
| tap::algorithms::transforms::Transform::Transform | ( | const CMSISMat< 3, 1 > & | translation, |
| const CMSISMat< 3, 3 > & | rotation, | ||
| const CMSISMat< 3, 1 > & | velocity, | ||
| const CMSISMat< 3, 1 > & | acceleration, | ||
| const CMSISMat< 3, 3 > & | angularVelocity | ||
| ) |
| translation | Initial translation of this transformation. |
| rotation | Initial rotation of this transformation. |
| velocity | Translational velocity of this transformation. |
| acceleration | Translational acceleration of this transformation. |
| angularVelocity | Angular velocity skew symmetric matrix of this transformation. |
| tap::algorithms::transforms::Transform::Transform | ( | CMSISMat< 3, 1 > && | translation, |
| CMSISMat< 3, 3 > && | rotation, | ||
| CMSISMat< 3, 1 > && | velocity, | ||
| CMSISMat< 3, 1 > && | acceleration, | ||
| CMSISMat< 3, 3 > && | angularVelocity | ||
| ) |
| translation | Initial translation of this transformation. |
| rotation | Initial rotation of this transformation. |
| velocity | Translational velocity of this transformation. |
| acceleration | Translational acceleration of this transformation. |
| angularVelocity | Angular velocity skew symmetric matrix of this transformation. |
| tap::algorithms::transforms::Transform::Transform | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | vx, | ||
| float | vy, | ||
| float | vz, | ||
| float | ax, | ||
| float | ay, | ||
| float | az, | ||
| float | rx, | ||
| float | ry, | ||
| float | rz, | ||
| float | wx, | ||
| float | wy, | ||
| float | wz | ||
| ) |
Constructs rotations using XYZ Euler angles, so rotations are applied in order of rx, ry, then rx.
| x | Initial x-component of the translation. |
| y | Initial y-component of the translation. |
| z | Initial z-component of the translation. |
| vx | Initial x-component of the translational velocity. |
| vy | Initial y-component of the translational velocity. |
| vz | Initial z-component of the translational velocity. |
| ax | Initial x-component of the translational acceleration. |
| ay | Initial y-component of the translational acceleration. |
| az | Initial z-component of the translational acceleration. |
| rx | Initial rotation angle about the x-axis. |
| ry | Initial rotation angle about the y-axis. |
| rz | Initial rotation angle about the z-axis. |
| wx | Initial angular velocity about the x-axis. |
| wy | Initial angular velocity about the y-axis. |
| wz | Initial angular velocity about the z-axis. |
| DynamicOrientation tap::algorithms::transforms::Transform::apply | ( | const DynamicOrientation & | dynamicOrientation | ) | const |
Brings a dynamic orientation in the base frame to one in the follower frame.
| DynamicPosition tap::algorithms::transforms::Transform::apply | ( | const DynamicPosition & | dynamicPosition | ) | const |
Brings a dynamic position in the base frame to one in the follower frame.
| Orientation tap::algorithms::transforms::Transform::apply | ( | const Orientation & | orientation | ) | const |
Brings an orientation in the base frame to one in the follower frame.
Rotates a vector in the base frame to a vector in the follower frame.
Intended to be used for things like velocities and accelerations which represent the difference between two positions in space, since both positions get translated the same way, causing the translation to cancel out.
| vector | Vector as read by base frame. |
Returns the composed transformation of the given transformations.
second's follower frame. Returns the composed transformation of the given transformations, ignoring any time derivatives.
second's follower frame.
|
inline |
|
inline |
|
inline |
|
inline |
| Transform tap::algorithms::transforms::Transform::getInverse | ( | ) | const |
| float tap::algorithms::transforms::Transform::getPitch | ( | ) | const |
Get the pitch of this transformation.
| float tap::algorithms::transforms::Transform::getPitchVelocity | ( | ) | const |
Get the pitch velocity of this transformation.
| float tap::algorithms::transforms::Transform::getRoll | ( | ) | const |
Get the roll of this transformation.
| float tap::algorithms::transforms::Transform::getRollVelocity | ( | ) | const |
Get the roll velocity of this transformation.
|
inline |
|
inline |
|
inline |
|
inline |
Get the x-component of this transform's translation.
|
inline |
Get the x-component of this transform's linear acceleration.
|
inline |
Get the x-component of this transform's linear velocity.
|
inline |
Get the y-component of this transform's translation.
|
inline |
Get the y-component of this transform's linear acceleration.
| float tap::algorithms::transforms::Transform::getYaw | ( | ) | const |
Get the yaw of this transformation.
| float tap::algorithms::transforms::Transform::getYawVelocity | ( | ) | const |
Get the yaw velocity of this transformation.
|
inline |
Get the y-component of this transform's linear velocity.
|
inline |
Get the z-component of this transform's translation.
|
inline |
Get the z-component of this transform's linear acceleration.
|
inline |
Get the z-component of this transform's linear velocity.
|
inlinestatic |
Constructs an identity transform.
|
inline |
Whether there are any non-zero derivatives.
| Transform tap::algorithms::transforms::Transform::projectForward | ( | float | dt | ) | const |
Projects this transform forward in time according to its translational velocity/acceleration and angular velocity.
| dt | Seconds to project forward (can be negative) |
|
inline |
Updates the acceleration of the current transform.
| updateAcceleration | updated acceleration of follower in base frame. |
|
inline |
Updates the acceleration of the current transform.
| ax | new acceleration x-component. |
| ay | new acceleration y-component. |
| az | new acceleration z-component. |
|
inline |
Updates the acceleration of the current transform.
| updateAcceleration | updated acceleration of follower in base frame. |
|
inline |
Updates the angular velocity of the current transform.
| updateAngularVelocity | updated angular velocity of follower in base frame. |
|
inline |
Updates the angular velocity of the current transform.
| ax | new angular velocity x-component. |
| ay | new angular velocity y-component. |
| az | new angular velocity z-component. |
|
inline |
Updates the angular velocity of the current transform.
| updateAngularVelocity | updated angular velocity of follower in base frame. |
|
inline |
Updates the rotation of the current transformation matrix.
| newRotation | updated orientation of follower frame in base frame. |
|
inline |
Updates the rotation of the current transformation matrix.
| newRotation | updated orientation of follower frame in base frame. |
|
inline |
Updates the rotation of the current transformation matrix.
| newRotation | updated orientation of follower frame in base frame. |
|
inline |
Updates the rotation of the current transformation matrix. Takes rotation angles in the order of roll->pitch->yaw.
| roll | updated rotation angle about the x-axis. |
| pitch | updated rotation angle about the y-axis. |
| yaw | updated rotation angle about the z-axis. |
|
inline |
Updates the rotation of the current transformation matrix.
| newRotation | updated orientation of follower frame in base frame. |
|
inline |
Updates the translation of the current transformation matrix.
| newTranslation | updated position of follower in base frame. |
|
inline |
Updates the translation of the current transformation matrix.
| newTranslation | updated position of follower in base frame. |
|
inline |
Updates the translation of the current transformation matrix.
| newTranslation | updated position of follower in base frame. |
|
inline |
Updates the translation of the current transformation matrix.
| x | new translation x-component. |
| y | new translation y-component. |
| z | new translation z-component. |
|
inline |
Updates the translation of the current transformation matrix.
| newTranslation | updated position of follower in base frame. |
|
inline |
Updates the velocity of the current transform.
| newVelocity | updated velocity of follower in base frame. |
|
inline |
Updates the velocity of the current transform.
| vx | new velocity x-component. |
| vy | new velocity y-component. |
| vz | new velocity z-component. |
|
inline |
Updates the velocity of the current transform.
| newVelocity | updated velocity of follower in base frame. |