@BeforeEach public void setUp() { offset = new Vector3D(1.0, 2.0, 3.0); robot = new Robot("testRobot"); kinematicPoint = new KinematicPoint("testPoint", offset, robot.getRobotsYoVariableRegistry()); }
Map<String, OneDegreeOfFreedomJoint> scsJointMap = new HashMap<>(); ArrayList<OneDegreeOfFreedomJoint> scsOnDoFJointList = new ArrayList<>(); robot.getAllOneDegreeOfFreedomJoints(scsOnDoFJointList); scsOnDoFJointList.forEach(joint -> scsJointMap.put(joint.getName(), joint)); if (robot.getRootJoints().get(0) instanceof FloatingJoint) scsRootJoint = (FloatingJoint) robot.getRootJoints().get(0); else scsRootJoint = null;
private SimulationConstructionSet constructRewindableSimulationConstructionSet() { Robot robot = new Robot("Test"); RobotController controller = new RewindableController(robot); robot.setController(controller); return constructSimulationConstructionSet(robot, controller); }
public TorqueSpeedDataExporterGraphCreator(Robot robot, DataBuffer dataBuffer) { super(robot.getYoTime(), dataBuffer); for (Joint rootJoint : robot.getRootJoints()) { recursivelyAddPinJoints(rootJoint, pinJoints); } }
ConservedQuantitiesChecker(Robot robot) { this.robot = robot; this.rootJoint = (FloatingJoint) robot.getRootJoints().get(0); this.registry = new YoVariableRegistry(robot.getName() + getClass().getSimpleName()); }
SinusoidalTorqueController(Robot robot) { this.t = robot.getYoTime(); this.registry = new YoVariableRegistry(robot.getName() + getClass().getSimpleName()); Joint rootJoint = robot.getRootJoints().get(0); for(Joint childJoint : rootJoint.getChildrenJoints()) { recursivelyAddJointTorqueProfile(childJoint); } }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000, expected=RuntimeException.class) public void testSetMaxLessThanMin() { Robot robot = new Robot("Derivative"); YoVariableRegistry registry = new YoVariableRegistry("variables"); YoDouble position = new YoDouble("position", registry); robot.addYoVariableRegistry(registry); SimulationConstructionSet scs = new SimulationConstructionSet(robot, simulationTestingParameters); ValueDataCheckerParameters valueDataCheckerParameters = new ValueDataCheckerParameters(); YoVariableValueDataChecker yoVariableValueDataChecker = new YoVariableValueDataChecker(scs, position, robot.getYoTime(), valueDataCheckerParameters); double value = 10.0; yoVariableValueDataChecker.setMinimumValue(value); yoVariableValueDataChecker.setMaximumValue(value - 10.0); }
@Test// timeout=300000 public void testFloatingJointAndPinJointWithMassiveBody() throws UnreasonableAccelerationException { Random random = new Random(1659L); Robot robot = new Robot("r1"); robot.setGravity(0.0); FloatingJoint root1 = new FloatingJoint("root1", new Vector3D(), robot); robot.addRootJoint(root1); Link floatingBody = new Link("floatingBody"); floatingBody.setMass(random.nextDouble()); floatingBody.setComOffset(random.nextDouble(), random.nextDouble(), random.nextDouble()); floatingBody.setMomentOfInertia(getRotationalInertiaMatrixOfSolidEllipsoid(floatingBody.getMass(), random.nextDouble(), random.nextDouble(), random.nextDouble())); root1.setLink(floatingBody); Vector3D offset = EuclidCoreRandomTools.nextVector3D(random); PinJoint pin1 = new PinJoint("pin1", offset, robot, EuclidCoreRandomTools.nextVector3D(random)); pin1.setLink(massiveLink()); root1.addJoint(pin1); pin1.setTau(random.nextDouble()); robot.doDynamicsButDoNotIntegrate(); double scalarInertiaAboutJointAxis = computeScalarInertiaAroundJointAxis(floatingBody, pin1); double torqueFromDynamics = scalarInertiaAboutJointAxis * pin1.getQDDYoVariable().getDoubleValue(); assertEquals(pin1.getTauYoVariable().getDoubleValue(), torqueFromDynamics, pin1.getTauYoVariable().getDoubleValue() * 1e-3); }
public void testSimpleSmoothDerviativeNoExeededWithSecondDerivateProvidedAndError() Robot robot = new Robot("Derivative"); robot.addYoVariableRegistry(registry); robot.setTime(time); valueDataCheckerParameters.setErrorThresholdOnDerivativeComparison(1e-2); YoVariableValueDataChecker yoVariableValueDataChecker = new YoVariableValueDataChecker(scs, position, robot.getYoTime(), valueDataCheckerParameters, velocity); yoVariableValueDataChecker.cropFirstPoint();
private SimulationConstructionSet createNewSCSWithEmptyRobot(String robotName) { return new SimulationConstructionSet(new Robot(robotName), parameters); }
@Override public void actionPerformed(ActionEvent e) Robot robot = new Robot("Mocap_Robot"); robot.addYoVariableRegistry(registry);
public FootstepVisualizer(GroundProfile3D groundProfile, Graphics3DObject linkGraphics, int maxNumberOfFootstepsPerSide, int maxContactPointsPerFoot, String description) { nullRobot = new Robot("FootstepVisualizerRobot"); if (groundProfile != null) { GroundContactModel gcModel = new LinearGroundContactModel(nullRobot, nullRobot.getRobotsYoVariableRegistry()); gcModel.setGroundProfile3D(groundProfile); nullRobot.setGroundContactModel(gcModel); } scs = new SimulationConstructionSet(nullRobot); if (linkGraphics != null) { scs.setGroundVisible(false); scs.addStaticLinkGraphics(linkGraphics); } printifdebug("Attaching exit listener"); scs.setDT(1, 1); yoGraphicsListRegistry = new YoGraphicsListRegistry(); bagOfSingleFootstepVisualizers = new BagOfSingleFootstepVisualizers(maxNumberOfFootstepsPerSide, maxContactPointsPerFoot, registry, yoGraphicsListRegistry); addText(scs, yoGraphicsListRegistry, description); }
robot.setGravity(gravity); robot.getRobotsYoVariableRegistry()); robot.setGroundContactModel(groundContactModel); robot.setDynamicIntegrationMethod(DynamicIntegrationMethod.EULER_DOUBLE_STEPS); JMEGraphics3DAdapter graphicsAdapter = new JMEGraphics3DAdapter();
private Robot createRobot() { Robot robot = new Robot("RandomRobot"); PinJoint pinJoint = new PinJoint("TestPinJoint", new Vector3D(), robot, new Vector3D(0, 0, 1)); robot.addRootJoint(pinJoint); return robot; } }
robot = new Robot("viz"); rootJoint = new FloatingJoint("floating", new Vector3d(), robot); robot.getRobotsYoVariableRegistry(); robot.setController(this); scs.setRobot(robot); swingLeg.set(RobotQuadrant.FRONT_RIGHT);
public void initializeRobot(Robot robot, DRCRobotModel robotModel, YoGraphicsListRegistry yoGraphicsListRegistry) { robot.setGravity(gravity); LinearGroundContactModel groundContactModel = new LinearGroundContactModel(robot, robot.getRobotsYoVariableRegistry()); robotModel.getContactPointParameters().setupGroundContactModelParameters(groundContactModel); // if ((commonTerrain.getSteppingStones() != null) && (yoGraphicsListRegistry != null)) // commonTerrain.registerSteppingStonesArtifact(yoGraphicsListRegistry); // groundContactModel.setGroundProfile(commonTerrain.getGroundProfile()); if (groundProfile3D != null) groundContactModel.setGroundProfile3D(groundProfile3D); // TODO: change this to scs.setGroundContactModel(groundContactModel); robot.setGroundContactModel(groundContactModel); }
private void createFloatingRobot() { Robot floatingRobot = new Robot("floatingRobot"); Vector3D position = new Vector3D(0.0, 0.02, 1.1); double length = 0.01; floatingRobot.setGravity(0.0, 0.0, 0.0); horizontalJoint = new SliderJoint("y", position, floatingRobot, Axis.Y); floatingRobot.addRootJoint(horizontalJoint); Link linkHorizontal = new Link("linkHorizontal"); linkHorizontal.setMass(0.5); linkHorizontal.setComOffset(length / 2.0, 0.0, 0.0); linkHorizontal.setMomentOfInertia(0.0, 0.01, 0.0); Graphics3DObject linkHorizontalGraphics = new Graphics3DObject(); linkHorizontalGraphics.addCylinder(length * 10, 0.005, YoAppearance.Orange()); linkHorizontal.setLinkGraphics(linkHorizontalGraphics); horizontalJoint.setLink(linkHorizontal); verticalJoint = new SliderJoint("z", new Vector3D(0.0, 0.0, 0.0), floatingRobot, Axis.Z); Link linkVertical = new Link("linkVertical"); linkVertical.setMass(0.5); linkVertical.setComOffset(length / 2.0, 0.0, 0.0); linkVertical.setMomentOfInertia(0.0, 0.01, 0.0); Graphics3DObject linkVerticalGraphics = new Graphics3DObject(); linkVerticalGraphics.addCylinder(length, 0.005, YoAppearance.Blue()); linkVertical.setLinkGraphics(linkVerticalGraphics); verticalJoint.setLink(linkVertical); horizontalJoint.addJoint(verticalJoint); createFloatingRobotController(); robots[0] = floatingRobot; robots[0].setController(floatingRobotController); }
private void setupSCS() { SimulationTestingParameters simulationTestingParameters = SimulationTestingParameters.createFromSystemProperties(); simulationTestingParameters.setKeepSCSUp(visualize); Robot robot = new Robot("Dummy"); yoTime = robot.getYoTime(); scs = new SimulationConstructionSet(robot, simulationTestingParameters); }
Robot robot = new Robot("linkTest"); robot.addRootJoint(rootJoint); robot.setGravity(0.0); rootJoint.setAngularVelocityInBody(rotationAxis);
private String getLastVariableNameFromRobotRegistry(Robot robotModel) { int lastIndex = robotModel.getRobotsYoVariableRegistry().getAllVariablesArray().length - 1; return robotModel.getRobotsYoVariableRegistry().getAllVariablesArray()[lastIndex].getName(); }