private static void throwNotEqualAssertionError(String messagePrefix, SpatialInertiaReadOnly expected, SpatialInertiaReadOnly actual, String format) { String expectedAsString = getSpatialInertiaString(format, expected); String actualAsString = getSpatialInertiaString(format, actual); throwNotEqualAssertionError(messagePrefix, expectedAsString, actualAsString); }
/** * Generates a random state and update the given {@code joints} with it. * * @param random the random generator to use. * @param stateToRandomize the joint state that is to be randomized. * @param joints the joints to set the state of. Modified. */ public static void nextState(Random random, JointStateType stateToRandomize, JointBasics[] joints) { for (JointBasics joint : joints) nextState(random, stateToRandomize, joint); }
/** {@inheritDoc} */ @Override default void setJointConfiguration(JointReadOnly other) { MecanoTools.checkTypeAndCast(other, FixedJointReadOnly.class); }
/** * Creates a new planar joint. * * @param name the name for the new joint. * @param predecessor the rigid-body connected to and preceding this joint. * @param transformToParent the transform to the frame after the parent joint. Not modified. */ public PlanarJoint(String name, RigidBodyBasics predecessor, RigidBodyTransform transformToParent) { super(name, predecessor, transformToParent); jointTwist = MecanoFactories.newPlanarFixedFrameTwistBasics(afterJointFrame, beforeJointFrame, afterJointFrame); jointAcceleration = MecanoFactories.newPlanarFixedFrameSpatialAccelerationVectorBasics(afterJointFrame, beforeJointFrame, afterJointFrame); unitTwists = MecanoTools.computePlanarJointMotionSubspace(beforeJointFrame, afterJointFrame); }
private static void throwNotEqualAssertionError(String messagePrefix, SpatialAccelerationReadOnly expected, SpatialAccelerationReadOnly actual, String format) { String expectedAsString = getSpatialAccelerationString(format, expected); String actualAsString = getSpatialAccelerationString(format, actual); throwNotEqualAssertionError(messagePrefix, expectedAsString, actualAsString, Double.toString(computeNormError(expected, actual))); }
/** * Generates a moving reference frame with random transform and twist to world frame. * * @param random the random generator to use. * @return the new random moving reference frame. */ public static MovingReferenceFrame nextMovingReferenceFrame(Random random) { return nextMovingReferenceFrame(random, false); }
/** * Creates a tree structure of random reference frames starting off * {@code ReferenceFrame.getWorldFrame()}. * * @param random the random generator to use. * @param numberOfMovingReferenceFrames the number of reference frames to be created. * @return the array containing the random reference frames. */ public static MovingReferenceFrame[] nextMovingReferenceFrameTree(Random random, int numberOfMovingReferenceFrames) { return nextMovingReferenceFrameTree(random, numberOfMovingReferenceFrames, false); }
@Override public String toString() { return MecanoIOTools.getWrenchString(this); } };
/** * Assuming {@code matrix} represents a proper 6-by-6 inertia matrix, it is added to this * inertia. * * @param matrix the inertia matrix to add. Not modified. */ public void add(DenseMatrix64F matrix) { MecanoTools.addEquals(0, 0, matrix, angularInertia); MecanoTools.addEquals(3, 3, matrix, linearInertia); MecanoTools.addEquals(0, 3, matrix, crossInertia); }
/** * Provides a {@code String} representation of this spatial vector as follows:<br> * Spatial Vector: [angular = (x, y, z), linear = (x, y, z)] - expressedInFrame * * @return the {@code String} representing this spatial vector. */ @Override public String toString() { return MecanoIOTools.getSpatialVectorString(this); } }
@Override public String toString() { return MecanoIOTools.getSpatialAccelerationString(this); } };
/** * Assuming {@code matrix} represents a proper 6-by-6 inertia matrix, it is subtracted to this * inertia. * * @param matrix the inertia matrix to subtract. Not modified. */ public void sub(DenseMatrix64F matrix) { MecanoTools.subEquals(0, 0, matrix, angularInertia); MecanoTools.subEquals(3, 3, matrix, linearInertia); MecanoTools.subEquals(0, 3, matrix, crossInertia); }
/** * Provides a {@code String} representation of this twist as follows:<br> * Twist of bodyFrame, with respect to baseFrame: [angular = (x, y, z), linear = (x, y, z)] - * expressedInFrame * * @return the {@code String} representing this twist. */ @Override public String toString() { return MecanoIOTools.getTwistString(this); } }
private static void throwNotEqualAssertionError(String messagePrefix, String expectedAsString, String actualAsString) { throwNotEqualAssertionError(messagePrefix, expectedAsString, actualAsString, null); }
/** * Provides a {@code String} representation of this momentum vector as follows:<br> * Momentum: [angular = (x, y, z), linear = (x, y, z)] - expressedInFrame * * @return the {@code String} representing this momentum. */ @Override public String toString() { return MecanoIOTools.getMomentumString(this); } }
/** * Provides a {@code String} representation of this spatial force vector as follows:<br> * Spatial Force: [angular = (x, y, z), linear = (x, y, z)] - expressedInFrame * * @return the {@code String} representing this spatial force vector. */ @Override public String toString() { return MecanoIOTools.getSpatialForceVectorString(this); } }
/** {@inheritDoc} */ @Override default void setJointWrench(JointReadOnly other) { MecanoTools.checkTypeAndCast(other, FixedJointReadOnly.class); }
/** * Generates a moving reference frame with random transform and twist 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 moving reference frame. * @return the new random moving reference frame. */ public static MovingReferenceFrame nextMovingReferenceFrame(String frameName, Random random, ReferenceFrame parentFrame) { return nextMovingReferenceFrame(frameName, random, parentFrame, false); }
/** {@inheritDoc} */ @Override default void setJointTwist(JointReadOnly other) { MecanoTools.checkTypeAndCast(other, FixedJointReadOnly.class); }
/** {@inheritDoc} */ @Override default void setJointAcceleration(JointReadOnly other) { MecanoTools.checkTypeAndCast(other, FixedJointReadOnly.class); }