/** * Generates a reference frame with a random transform to world frame. * * @param random the random generator to use. * @return the new random reference frame. */ public static ReferenceFrame nextReferenceFrame(Random random) { return nextReferenceFrame(random, false); }
public void assertEpsilonEquals(PoseTrajectoryState other, double epsilon) { EuclidFrameTestTools.assertFramePoint3DGeometricallyEquals(position, other.position, epsilon); EuclidFrameTestTools.assertFrameQuaternionGeometricallyEquals(orientation, other.orientation, epsilon); EuclidFrameTestTools.assertFrameVector3DGeometricallyEquals(linearVelocity, other.linearVelocity, epsilon); EuclidFrameTestTools.assertFrameVector3DGeometricallyEquals(angularVelocity, other.angularVelocity, epsilon); EuclidFrameTestTools.assertFrameVector3DGeometricallyEquals(linearAcceleration, other.linearAcceleration, epsilon); EuclidFrameTestTools.assertFrameVector3DGeometricallyEquals(angularAcceleration, other.angularAcceleration, epsilon); } }
private static Object instantiateParameterType(ReferenceFrame frame, Class<?> parameterType) { Object object = createFrameObject(parameterType, frame); if (object != null) return object; object = createFramelessObject(parameterType); if (object != null) return object; return newInstanceOf(parameterType); }
public PoseTrajectoryState(Random random, double time, ReferenceFrame bodyFrame, ReferenceFrame baseFrame, ReferenceFrame expressedInFrame) { this.time = time; this.position = EuclidFrameRandomTools.nextFramePoint3D(random, expressedInFrame, 1.0, 1.0, 1.0); this.orientation = EuclidFrameRandomTools.nextFrameQuaternion(random, expressedInFrame); this.linearVelocity = EuclidFrameRandomTools.nextFrameVector3D(random, expressedInFrame, -10.0, 10.0, -10.0, 10.0, -10.0, 10.0); this.angularVelocity = EuclidFrameRandomTools.nextFrameVector3D(random, expressedInFrame, -10.0, 10.0, -10.0, 10.0, -10.0, 10.0); this.linearAcceleration = EuclidFrameRandomTools.nextFrameVector3D(random, expressedInFrame, -100.0, 100.0, -100.0, 100.0, -100.0, 100.0); this.angularAcceleration = EuclidFrameRandomTools.nextFrameVector3D(random, expressedInFrame, -100.0, 100.0, -100.0, 100.0, -100.0, 100.0); this.bodyFrame = bodyFrame; this.baseFrame = baseFrame; this.expressedInFrame = expressedInFrame; }
/** * Asserts on a per component basis that the two frame tuples are equal to an {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param expected the expected frame tuple. Not modified. * @param actual the actual frame tuple. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two frame tuples are not equal or not expressed in the reference * frame. If only one of the arguments is equal to {@code null}. */ public static void assertFrameTuple3DEquals(FrameTuple3DReadOnly expected, FrameTuple3DReadOnly actual, double epsilon) { assertFrameTuple3DEquals(null, expected, actual, epsilon); }
/** * Creates a tree structure of 20 random reference frames starting off * {@code ReferenceFrame.getWorldFrame()}. * * @param random the random generator to use. * @return the array containing the random reference frames and * {@code ReferenceFrame.getWorldFrame()} at the first index. */ public static ReferenceFrame[] nextReferenceFrameTree(Random random) { return nextReferenceFrameTree(random, false); }
/** * Asserts on a per component basis that the two frame tuples are equal to an {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param expected the expected frame tuple. Not modified. * @param actual the actual frame tuple. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two tuples are not equal or not expressed in the reference frame. * If only one of the arguments is equal to {@code null}. */ public static void assertFrameTuple4DEquals(FrameTuple4DReadOnly expected, FrameTuple4DReadOnly actual, double epsilon) { assertFrameTuple4DEquals(null, expected, actual, epsilon); }
/** * @return the root frame of the world reference frame tree. * @see ReferenceFrameTools#getWorldFrame() */ public static ReferenceFrame getWorldFrame() { return ReferenceFrameTools.getWorldFrame(); }
/** * Asserts on a per component basis that the two frame tuples are equal to an {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param expected the expected frame tuple. Not modified. * @param actual the actual frame tuple. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two frame tuples are not equal or not expressed in the reference * frame. If only one of the arguments is equal to {@code null}. */ public static void assertFrameTuple2DEquals(FrameTuple2DReadOnly expected, FrameTuple2DReadOnly actual, double epsilon) { assertFrameTuple2DEquals(null, expected, actual, epsilon); }
@Override public FrameYawPitchRoll createRandomYawPitchRoll(Random random) { return EuclidFrameRandomTools.nextFrameYawPitchRoll(random, worldFrame); }
private static void throwNotEqualAssertionError(String messagePrefix, String expectedAsString, String actualAsString) { throwNotEqualAssertionError(messagePrefix, expectedAsString, actualAsString, null); }
private static String toStringAsFramelessObjects(Object[] frameObjects) { String ret = "["; for (int i = 0; i < frameObjects.length; i++) { ret += toStringAsFramelessObject(frameObjects[i]); if (i < frameObjects.length - 1) ret += ", "; else ret += "]"; } return ret; }
/** * Asserts that the two frame convex polygon 2D represent the same geometry to an {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param expected the expected frame convex polygon 2D. Not modified. * @param actual the actual frame convex polygon 2D. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two convex polygon 2D do not represent the same geometry. If only * one of the arguments is equal to {@code null}. */ public static void assertFrameConvexPolygon2DGeometricallyEquals(FrameConvexPolygon2DReadOnly expected, FrameConvexPolygon2DReadOnly actual, double epsilon) { assertFrameConvexPolygon2DGeometricallyEquals(null, expected, actual, epsilon); }
/** * Asserts on a per component basis that the two frame vectors represent the same geometry to an * {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param expected the expected frame tuple. Not modified. * @param actual the actual frame tuple. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two vectors do not represent the same geometry or not expressed in * the reference frame. If only one of the arguments is equal to {@code null}. */ public static void assertFrameVector4DGeometricallyEquals(FrameVector4DReadOnly expected, FrameVector4DReadOnly actual, double epsilon) { assertFrameVector4DGeometricallyEquals(null, expected, actual, epsilon); }
/** * Generates a reference frame with a random transform to its parent frame. * * @param random the random generator to use. * @param parentFrame the parent frame of the new reference frame. * @return the new random reference frame. */ public static ReferenceFrame nextReferenceFrame(Random random, ReferenceFrame parentFrame) { return nextReferenceFrame(random, parentFrame, false); }
/** * Creates a tree structure of random reference frames starting off * {@code ReferenceFrame.getWorldFrame()}. * * @param random the random generator to use. * @param numberOfReferenceFrames the number of reference frames to be created. * @return the array containing the random reference frames and * {@code ReferenceFrame.getWorldFrame()} at the first index. */ public static ReferenceFrame[] nextReferenceFrameTree(Random random, int numberOfReferenceFrames) { return nextReferenceFrameTree(random, numberOfReferenceFrames, false); }
/** * Asserts on a per component basis that the two frame tuples are equal to an {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param messagePrefix prefix to add to the error message. * @param expected the expected frame tuple. Not modified. * @param actual the actual frame tuple. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two tuples are not equal or not expressed in the reference frame. * If only one of the arguments is equal to {@code null}. */ public static void assertFrameTuple4DEquals(String messagePrefix, FrameTuple4DReadOnly expected, FrameTuple4DReadOnly actual, double epsilon) { assertFrameTuple4DEquals(messagePrefix, expected, actual, epsilon, DEFAULT_FORMAT); }
/** * Generates a reference frame with a random transform to its parent frame. * * @param frameName the name of the new frame. * @param random the random generator to use. * @param parentFrame the parent frame of the new reference frame. * @return the new random reference frame. */ public static ReferenceFrame nextReferenceFrame(String frameName, Random random, ReferenceFrame parentFrame) { return nextReferenceFrame(frameName, random, parentFrame, false); }
/** * Creates a tree structure of random reference frames starting off the given {@code rootFrame}. * * @param frameNamePrefix prefix to use when creating each random reference frame. * @param random the random generator to use. * @param rootFrame the base frame from which the tree is to be expanded. * @param numberOfReferenceFrames the number of reference frames to be created. * @return the array containing the random reference frames and {@code rootFrame} at the first * index. */ public static ReferenceFrame[] nextReferenceFrameTree(String frameNamePrefix, Random random, ReferenceFrame rootFrame, int numberOfReferenceFrames) { return nextReferenceFrameTree(frameNamePrefix, random, rootFrame, numberOfReferenceFrames, false); }
/** * Creates a tree structure of 20 random reference frames start off * {@link ReferenceFrame#getWorldFrame()}. * * @param random the random generator to use. * @param use2DTransforms whether to use a 2D or 3D rotation for the transform used to create the * random frames. * @return the array containing the random reference frames and * {@code ReferenceFrame.getWorldFrame()} at the first index. */ public static ReferenceFrame[] nextReferenceFrameTree(Random random, boolean use2DTransforms) { return nextReferenceFrameTree(random, 20, use2DTransforms); }