Package edu.tufts.hrilab.util
Class Convert
java.lang.Object
edu.tufts.hrilab.util.Convert
Methods for converting between various Transform related types (points, orientations, etc).
NOTE: this is similar to the edu.tufts.hrilab.diarcros.util.Convert class but contains only non-ROS versions.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]convertToEuler(javax.vecmath.Quat4d q) Convert a quaternion to euler angles.static javax.vecmath.Matrix4dconvertToMatrix4d(javax.vecmath.Point3d p, javax.vecmath.Quat4d q) Converts a point and orientation to matrix format.static javax.vecmath.Matrix4dconvertToMatrix4d(org.apache.commons.lang3.tuple.Pair<javax.vecmath.Point3d, javax.vecmath.Quat4d> pose) converts a point and orientation to matrix formatstatic org.apache.commons.lang3.tuple.Pair<javax.vecmath.Point3d,javax.vecmath.Quat4d> convertToPair(javax.vecmath.Matrix4d m) gets pose from a Matrix4dstatic javax.vecmath.Quat4dconvertToQuat4d(double yaw, double pitch, double roll) Convert euler angles to Quat4d quaternion.
-
Field Details
-
ROLL
public static final int ROLL- See Also:
-
PITCH
public static final int PITCH- See Also:
-
YAW
public static final int YAW- See Also:
-
-
Constructor Details
-
Convert
public Convert()
-
-
Method Details
-
convertToMatrix4d
public static javax.vecmath.Matrix4d convertToMatrix4d(javax.vecmath.Point3d p, javax.vecmath.Quat4d q) Converts a point and orientation to matrix format.- Parameters:
p- point (x,y,z)q- quaternion (x,y,z,w)- Returns:
- a Matrix4d representing the point and orientation
-
convertToMatrix4d
public static javax.vecmath.Matrix4d convertToMatrix4d(org.apache.commons.lang3.tuple.Pair<javax.vecmath.Point3d, javax.vecmath.Quat4d> pose) converts a point and orientation to matrix format- Parameters:
pose-- Returns:
- a Matrix4d representing the point and orientation
-
convertToPair
public static org.apache.commons.lang3.tuple.Pair<javax.vecmath.Point3d,javax.vecmath.Quat4d> convertToPair(javax.vecmath.Matrix4d m) gets pose from a Matrix4d- Parameters:
m- matrix to get pose from- Returns:
- pose represented by m
-
convertToEuler
public static double[] convertToEuler(javax.vecmath.Quat4d q) Convert a quaternion to euler angles. quat4d -> XYZ Euler Angles (NASA Standard Aeroplane) (https://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/indexLocal.htm)- Parameters:
q- Quat4d quaternion- Returns:
-
convertToQuat4d
public static javax.vecmath.Quat4d convertToQuat4d(double yaw, double pitch, double roll) Convert euler angles to Quat4d quaternion.- Parameters:
yaw-pitch-roll-- Returns:
-