/** * Builds a new implementation of {@code PlanarJointBasics}. * * @param name the joint name. * @param predecessor the predecessor of the joint. * @param transformToParent the transform to the frame after the parent joint. * @return the new planar joint. */ default PlanarJointBasics buildPlanarJoint(String name, RigidBodyBasics predecessor, RigidBodyTransform transformToParent) { return new PlanarJoint(name, predecessor, transformToParent); }
public static ChecksumUpdater newJointChecksumUpdater(GenericCRC32 checksum, PlanarJoint joint) { return () -> { checksum.update(joint.getJointPose().getOrientation().getPitch()); checksum.update(joint.getJointPose().getPosition().getX()); checksum.update(joint.getJointPose().getPosition().getY()); checksum.update(joint.getJointTwist().getAngularPartY()); checksum.update(joint.getJointTwist().getLinearPartX()); checksum.update(joint.getJointTwist().getLinearPartZ()); checksum.update(joint.getJointAcceleration().getAngularPartY()); checksum.update(joint.getJointAcceleration().getLinearPartX()); checksum.update(joint.getJointAcceleration().getLinearPartZ()); }; }
private static PlanarJoint clonePlanarJoint(PlanarJointReadOnly original, String cloneSuffix, RigidBodyBasics clonePredecessor, JointBuilder jointBuilder) { String jointNameOriginal = original.getName(); RigidBodyTransform jointTransform = getCloneJointTransformToParent(original); return new PlanarJoint(jointNameOriginal + cloneSuffix, clonePredecessor, jointTransform); }
/** * Generates a 3-DoF floating joint with random physical parameters and attaches it to the given * {@code predecessor}. * * @param random the random generator to use. * @param name the joint name. * @param predecessor the rigid-body to which the joint is added as a child. * @return the random joint. */ public static PlanarJoint nextPlanarJoint(Random random, String name, RigidBodyBasics predecessor) { RigidBodyTransform transformToParent = predecessor.isRootBody() ? null : EuclidCoreRandomTools.nextRigidBodyTransform(random); return new PlanarJoint(name, predecessor, transformToParent); }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void testAddRigidBody_String_InverseDynamicsJoint_Matrix3d_double_Vector3d() { String name = "body"; RigidBodyBasics predecessor = new RigidBody("Predecessor", theFrame); PlanarJoint parentJoint = new PlanarJoint(name, predecessor); Matrix3D momentOfInertia = new Matrix3D(); double mass = random.nextDouble(); RigidBodyBasics body = new RigidBody(name, parentJoint, momentOfInertia, mass, X); assertEquals("Should be equal", name, body.getName()); assertTrue(parentJoint.equals(body.getParentJoint())); }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void testAddRigidBody_String_InverseDynamicsJoint_Matrix3d_double_Transform3D() { String name = "body"; RigidBodyBasics predecessor = new RigidBody("Predecessor", theFrame); PlanarJoint parentJoint = new PlanarJoint(name, predecessor); Matrix3D momentOfInertia = new Matrix3D(); double mass = random.nextDouble(); RigidBodyTransform inertiaPose = new RigidBodyTransform(); RigidBodyBasics body = new RigidBody(name, parentJoint, momentOfInertia, mass, inertiaPose); assertEquals("Should be equal", name, body.getName()); assertTrue(parentJoint.equals(body.getParentJoint())); }