/** * Creates the abstract layer for a new 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 Joint(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; beforeJointFrame = MecanoFactories.newFrameBeforeJoint(this, transformToParent); afterJointFrame = MecanoFactories.newFrameAfterJoint(this); if (predecessor.isRootBody()) nameId = name; else nameId = predecessor.getParentJoint().getNameId() + NAME_ID_SEPARATOR + name; predecessor.addChildJoint(this); }
/** * 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); }