/** * Builds a new implementation of {@code FixedJointBasics}. * * @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 fixed joint. */ default FixedJointBasics buildFixedJoint(String name, RigidBodyBasics predecessor, RigidBodyTransform transformToParent) { return new FixedJoint(name, predecessor, transformToParent); } }
/** * Returns the implementation name of this joint and the joint name. */ @Override public String toString() { return getClass().getSimpleName() + " " + getName(); }
/** * Generates a 0-DoF fixed 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 FixedJoint nextFixedJoint(Random random, String name, RigidBodyBasics predecessor) { RigidBodyTransform transformToParent = predecessor.isRootBody() ? null : EuclidCoreRandomTools.nextRigidBodyTransform(random); return new FixedJoint(name, predecessor, transformToParent); }
/** * Creates a new fixed 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 FixedJoint(String name, RigidBodyBasics predecessor, RigidBodyTransform transformToParent) { if (name.contains(NAME_ID_SEPARATOR)) throw new IllegalArgumentException("A joint name can not contain '" + NAME_ID_SEPARATOR + "'. Tried to construct a jonit with name " + name + "."); this.name = name; this.predecessor = predecessor; jointFrame = MecanoFactories.newJointFrame(this, transformToParent, getName() + "Frame"); if (predecessor.isRootBody()) nameId = name; else nameId = predecessor.getParentJoint().getNameId() + NAME_ID_SEPARATOR + name; predecessor.addChildJoint(this); jointTwist = new Twist(jointFrame, jointFrame, jointFrame); jointAcceleration = new SpatialAcceleration(jointFrame, jointFrame, jointFrame); }