/** * Generates a random kinematic chain composed of rigid-bodies and 1-DoF joints. * <p> * The joints and rigid-bodies have random physical parameters. * </p> * <p> * The generated multi-body system is a kinematic chain, i.e. every rigid-body has only one child * joint. * </p> * * @param random the random generator to use. * @param numberOfJoints how many joints the kinematic chain should be composed of. * @return the list of all the joints composing the kinematic chain. */ public static List<OneDoFJoint> nextOneDoFJointChain(Random random, int numberOfJoints) { return nextOneDoFJointChain(random, "", numberOfJoints); }
/** * Generates a random kinematic chain composed of rigid-bodies and 1-DoF joints. * <p> * The joints and rigid-bodies have random physical parameters. * </p> * <p> * The generated multi-body system is a kinematic chain, i.e. every rigid-body has only one child * joint. * </p> * * @param random the random generator to use. * @param rootBody the root to which the kinematic chain is to be attached. * @param numberOfJoints how many joints the kinematic chain should be composed of. * @return the list of all the joints composing the kinematic chain. */ public static List<OneDoFJoint> nextOneDoFJointChain(Random random, RigidBodyBasics rootBody, int numberOfJoints) { return nextOneDoFJointChain(random, "", rootBody, numberOfJoints); }
/** * Generates a random kinematic chain composed of rigid-bodies and 1-DoF joints. * <p> * The joints and rigid-bodies have random physical parameters. * </p> * <p> * The generated multi-body system is a kinematic chain, i.e. every rigid-body has only one child * joint. * </p> * * @param random the random generator to use. * @param prefix provides a common prefix used for all the joint and rigid-body names. * @param numberOfJoints how many joints the kinematic chain should be composed of. * @return the list of all the joints composing the kinematic chain. */ public static List<OneDoFJoint> nextOneDoFJointChain(Random random, String prefix, int numberOfJoints) { return nextOneDoFJointChain(random, prefix, MecanoRandomTools.nextVector3DArray(random, numberOfJoints, 1.0)); }
/** * Generates a random kinematic chain composed of rigid-bodies and 1-DoF joints. * <p> * The joints and rigid-bodies have random physical parameters. * </p> * <p> * The generated multi-body system is a kinematic chain, i.e. every rigid-body has only one child * joint. * </p> * * @param random the random generator to use. * @param prefix provides a common prefix used for all the joint and rigid-body names. * @param rootBody the root to which the kinematic chain is to be attached. * @param numberOfJoints how many joints the kinematic chain should be composed of. * @return the list of all the joints composing the kinematic chain. */ public static List<OneDoFJoint> nextOneDoFJointChain(Random random, String prefix, RigidBodyBasics rootBody, int numberOfJoints) { return nextOneDoFJointChain(random, prefix, rootBody, MecanoRandomTools.nextVector3DArray(random, numberOfJoints, 1.0)); }
/** * Generates a random kinematic chain composed of rigid-bodies and 1-DoF joints. * <p> * The joints and rigid-bodies have random physical parameters. * </p> * <p> * The generated multi-body system is a kinematic chain, i.e. every rigid-body has only one child * joint. * </p> * * @param random the random generator to use. * @param prefix provides a common prefix used for all the joint and rigid-body names. * @param jointAxes array containing in order the axis for each joint. The length of the array also * defines the number of joints for the generated kinematic chain. * @return the list of all the joints composing the kinematic chain. */ public static List<OneDoFJoint> nextOneDoFJointChain(Random random, String prefix, Vector3DReadOnly[] jointAxes) { ReferenceFrame worldFrame = ReferenceFrame.getWorldFrame(); RigidBody rootBody = new RigidBody(prefix + "RootBody", worldFrame); return nextOneDoFJointChain(random, prefix, rootBody, jointAxes); }
MultiBodySystemStateIntegrator integrator = new MultiBodySystemStateIntegrator(updateDT); List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints);
int numberOfJoints = 20; List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints);
MultiBodySystemStateIntegrator integrator = new MultiBodySystemStateIntegrator(updateDT); List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints);
MultiBodySystemStateIntegrator integrator = new MultiBodySystemStateIntegrator(updateDT); List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints);
MultiBodySystemStateIntegrator integrator = new MultiBodySystemStateIntegrator(updateDT); List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints);
int numberOfJoints = 20; List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints);
int numberOfJoints = 20; List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints);
MultiBodySystemStateIntegrator integrator = new MultiBodySystemStateIntegrator(updateDT); List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints);
List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints); List<OneDoFJointBasics> jointsInFuture = Arrays.asList(MultiBodySystemFactories.cloneOneDoFJointKinematicChain(joints.toArray(new OneDoFJointBasics[numberOfJoints])));
@ContinuousIntegrationTest(estimatedDuration = 0.1) @Test(timeout = 30000) public void testAgainstTwistCalculatorWithChainRobot() throws Exception { Random random = new Random(435423L); int numberOfJoints = 100; List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints); TwistCalculator twistCalculator = new TwistCalculator(worldFrame, joints.get(0).getPredecessor()); Twist actualTwist = new Twist(); Twist expectedTwist = new Twist(); for (int i = 0; i < 100; i++) { MultiBodySystemRandomTools.nextState(random, JointStateType.CONFIGURATION, -1.0, 1.0, joints); MultiBodySystemRandomTools.nextState(random, JointStateType.VELOCITY, -1.0, 1.0, joints); joints.get(0).getPredecessor().updateFramesRecursively(); twistCalculator.compute(); for (int jointIndex = 0; jointIndex < numberOfJoints; jointIndex++) { OneDoFJointBasics joint = joints.get(jointIndex); RigidBodyBasics body = joint.getSuccessor(); MovingReferenceFrame bodyFrame = body.getBodyFixedFrame(); twistCalculator.getTwistOfBody(body, expectedTwist); bodyFrame.getTwistOfFrame(actualTwist); MecanoTestTools.assertTwistEquals(expectedTwist, actualTwist, 1.0e-5); } } }
List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints); RigidBodyBasics rootBody = MultiBodySystemTools.getRootBody(joints.get(0).getSuccessor());