/** * Creates a new pose 3D that is restricted to the XZ-plane. * * @return the new pose 3D. */ public static Pose3DBasics newPlanarPose3DBasics() { return new Pose3DBasics() { private final QuaternionBasics jointRotation = newPitchOnlyQuaternionBasics(); private final Point3DBasics jointTranslation = newXZOnlyPoint3DBasics(); @Override public Point3DBasics getPosition() { return jointTranslation; } @Override public QuaternionBasics getOrientation() { return jointRotation; } }; }
/** * 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); }
/** {@inheritDoc} */ @Override public void setSuccessor(RigidBodyBasics successor) { this.successor = successor; ReferenceFrame successorFrame = successor.getBodyFixedFrame(); jointWrench = MecanoFactories.newPlanarFixedFrameWrenchBasics(successorFrame, afterJointFrame); }
/** * Creates the abstract layer for a new 1-DoF joint. * * @param name the name for the new joint. * @param predecessor the rigid-body connected to and preceding this joint. * @param jointAxisAngularPart the unit-vector if this joint is a revolute joint. A zero vector * otherwise. Not modified. * @param jointAxisLinearPart the unit-vector if this joint is a prismatic joint. A zero vector * otherwise. Not modified. * @param transformToParent the transform from this joint to the {@code frameAfterJoint} of its * parent joint. Not modified. */ public OneDoFJoint(String name, RigidBodyBasics predecessor, Vector3DReadOnly jointAxisAngularPart, Vector3DReadOnly jointAxisLinearPart, RigidBodyTransform transformToParent) { super(name, predecessor, transformToParent); unitJointTwist = new Twist(afterJointFrame, beforeJointFrame, afterJointFrame, jointAxisAngularPart, jointAxisLinearPart); unitTwists = Collections.singletonList(unitJointTwist); jointTwist = MecanoFactories.newTwistReadOnly(this::getQd, unitJointTwist); unitJointAcceleration = new SpatialAcceleration(unitJointTwist); jointAcceleration = MecanoFactories.newSpatialAccelerationVectorReadOnly(this::getQdd, unitJointAcceleration); }
/** * 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); }
private final FrameVector3DReadOnly angularPart = newFrameVector3DReadOnly(scaleSupplier, referenceTwist.getAngularPart()); private final FrameVector3DReadOnly linearPart = newFrameVector3DReadOnly(scaleSupplier, referenceTwist.getLinearPart());
/** * Creates the reference frame that is at the joint and rigidly attached to the joint's predecessor. * * @param joint the joint to which the new frame is for. Not modified. * @param transformToParent the transform from the new frame to the frame after the parent joint. * Not modified. * @return the new frame before joint. */ public static MovingReferenceFrame newFrameBeforeJoint(JointReadOnly joint, RigidBodyTransform transformToParent) { String beforeJointName = "before" + MecanoTools.capitalize(joint.getName()); return newJointFrame(joint, transformToParent, beforeJointName); }
/** * Creates a new revolute 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. * @param jointAxis the axis around which this joint can rotate. Not modified. */ public RevoluteJoint(String name, RigidBodyBasics predecessor, RigidBodyTransform transformToParent, Vector3DReadOnly jointAxis) { super(name, predecessor, jointAxis, new Vector3D(), transformToParent); this.jointAxis = new FrameVector3D(beforeJointFrame, jointAxis); jointTransformUpdater = MecanoFactories.newRevoluteJointTransformUpdater(this); }
/** * Creates a new spherical 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 SphericalJoint(String name, RigidBodyBasics predecessor, RigidBodyTransform transformToParent) { super(name, predecessor, transformToParent); jointAngularVelocity = new FrameVector3D(afterJointFrame); jointAngularAcceleration = new FrameVector3D(afterJointFrame); jointTwist = MecanoFactories.newTwistReadOnly(afterJointFrame, beforeJointFrame, jointAngularVelocity, new FrameVector3D(afterJointFrame)); jointAcceleration = MecanoFactories.newSpatialAccelerationVectorReadOnly(afterJointFrame, beforeJointFrame, jointAngularAcceleration, new FrameVector3D(afterJointFrame)); unitTwists = MecanoTools.computeSphericalJointMotionSubspace(beforeJointFrame, afterJointFrame); jointTorque = new FrameVector3D(afterJointFrame); }
private final FrameVector3DReadOnly angularPart = newFrameVector3DReadOnly(scaleSupplier, referenceWrench.getAngularPart()); private final FrameVector3DReadOnly linearPart = newFrameVector3DReadOnly(scaleSupplier, referenceWrench.getLinearPart());
/** * 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); }
private final FrameVector3DReadOnly angularPart = newFrameVector3DReadOnly(scaleSupplier, referenceAcceleration.getAngularPart()); private final FrameVector3DReadOnly linearPart = newFrameVector3DReadOnly(scaleSupplier, referenceAcceleration.getLinearPart());