@Override public void createAndSetContactControllerToARobot() { ContactController contactController = new ContactController(); contactController.setContactParameters(100000.0, 100.0, 0.5, 0.3); contactController.addContactPoints(contactPoints); for (Robot r : contactableRobots) { if (r instanceof Contactable) contactController.addContactable((Contactable) r); } if (contactableRobots.size() > 0) contactableRobots.get(0).setController(contactController); }
@Override public void createAndSetContactControllerToARobot() { ContactController contactController = new ContactController(); contactController.setContactParameters(100000.0, 100.0, 0.5, 0.3); contactController.addContactPoints(contactPoints); for (Robot r : contactableRobots) { if (r instanceof Contactable) contactController.addContactable((Contactable) r); } if (contactableRobots.size() > 0) contactableRobots.get(0).setController(contactController); }
private SimulationConstructionSet constructRewindableSimulationConstructionSet() { Robot robot = new Robot("Test"); RobotController controller = new RewindableController(robot); robot.setController(controller); return constructSimulationConstructionSet(robot, controller); }
private SimulationConstructionSet constructDifficultToDetectNonRewindableSimulationConstructionSet() { Robot robot = new Robot("Test"); RobotController controller = new DifficultToDetectNonRewindableController(robot); robot.setController(controller); return constructSimulationConstructionSet(robot, controller); }
@Override public void createAndSetContactControllerToARobot() { ContactController contactController = new ContactController(); contactController.setContactParameters(100000.0, 100.0, 0.5, 0.3); contactController.addContactPoints(contactPoints); for (Robot r : contactableRobots) { if (r instanceof Contactable) contactController.addContactable((Contactable) r); } if (contactableRobots.size() > 0) contactableRobots.get(0).setController(contactController); }
private SimulationConstructionSet constructEasilyDetectableNonRewindableSimulationConstructionSet() { Robot robot = new Robot("Test"); RobotController controller = new EasilyDetectableNonRewindableController(robot); robot.setController(controller); return constructSimulationConstructionSet(robot, controller); }
@Override public void createAndSetContactControllerToARobot() { ContactController contactController = new ContactController(); contactController.setContactParameters(10000.0, 1000.0, 0.5, 0.3); contactController.addContactPoints(contactPoints); contactController.addContactables(contactables); envRobots.get(0).setController(contactController); }
@Override public void createAndSetContactControllerToARobot() { // add contact controller to any robot so it gets called ContactController contactController = new ContactController(); contactController.setContactParameters(10000.0, 1000.0, 0.5, 0.3); contactController.addContactPoints(contactPoints); contactController.addContactables(contactables); environmentRobots.get(0).setController(contactController); }
@ContinuousIntegrationAnnotations.ContinuousIntegrationTest(estimatedDuration = 11.3) @Test(timeout=3000000) public void testLinearAndAngularMomentumAreConverved() { int numberOfRobotsToTest = 5; int minNumberOfAxes = 2; int maxNumberOfAxes = 10; Robot[] robots = new Robot[numberOfRobotsToTest]; for (int i = 0; i < numberOfRobotsToTest; i++) { Robot robot = new RobotTools.SCSRobotFromInverseDynamicsRobotModel("robot" + i, getRandomFloatingChain(minNumberOfAxes, maxNumberOfAxes).getRootJoint()); robot.setGravity(0.0, 0.0, 0.0); robot.setController(new ConservedQuantitiesChecker(robot)); robot.setController(new SinusoidalTorqueController(robot)); robots[i] = robot; } SimulationConstructionSet scs = new SimulationConstructionSet(robots, simulationTestingParameters); scs.startOnAThread(); BlockingSimulationRunner blockingSimulationRunner = new BlockingSimulationRunner(scs, 30.0); try { blockingSimulationRunner.simulateAndBlock(8.0); } catch(BlockingSimulationRunner.SimulationExceededMaximumTimeException | ControllerFailureException e) { e.printStackTrace(); fail(); } }
public DRCSimulationVisualizer(Robot robot, YoGraphicsListRegistry yoGraphicsListRegistry) { this.robot = robot; YoGraphicsList yoGraphicsList = new YoGraphicsList("Simulation Viz"); ArrayList<GroundContactPoint> groundContactPoints = robot.getAllGroundContactPoints(); AppearanceDefinition appearance = YoAppearance.Red(); // BlackMetalMaterial(); for (GroundContactPoint groundContactPoint : groundContactPoints) { double scaleFactor = 0.0015; YoGraphicVector dynamicGraphicVector = new YoGraphicVector(groundContactPoint.getName(), groundContactPoint.getYoPosition(), groundContactPoint.getYoForce(), scaleFactor, appearance); yoGraphicsList.add(dynamicGraphicVector); } if (yoGraphicsListRegistry != null) yoGraphicsListRegistry.registerYoGraphicsList(yoGraphicsList); robot.setController(this, 10); }
private void createContactPoints(Robot floatingRobot) { GroundContactPoint contactPoint1 = new GroundContactPoint("contactPoint1", new Vector3D(0.0, 0.0, 0.0), floatingRobot); verticalJoint.addGroundContactPoint(1, contactPoint1); GroundContactPoint contactPoint2 = new GroundContactPoint("contactPoint2", new Vector3D(-0.002, 0.0, 0.0), floatingRobot); verticalJoint.addGroundContactPoint(1, contactPoint2); GroundContactPoint contactPoint3 = new GroundContactPoint("contactPoint3", new Vector3D(0.002, 0.0, 0.0), floatingRobot); verticalJoint.addGroundContactPoint(1, contactPoint3); ContactController contactController = new ContactController(); contactController.setContactParameters(10000.0, 1000.0, 0.5, 0.3); contactController.addContactPoints(robots[0].getAllGroundContactPoints()); ArrayList<Contactable> robotList = new ArrayList<Contactable>(); robotList.add((Contactable) robots[1]); contactController.addContactables(robotList); robots[1].setController(contactController); }
@ContinuousIntegrationTest(estimatedDuration = 0.6) @Test(timeout = 30000) public void testTwoRewindableSimulationsWithAScript() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, UnreasonableAccelerationException { Robot robot0 = createSimpleRobot(); RobotController rewindableController0 = new RewindableOrNotRewindableController(true); robot0.setController(rewindableController0); SimulationConstructionSetParameters parameters = new SimulationConstructionSetParameters(); parameters.setCreateGUI(false); parameters.setDataBufferSize(100); SimulationConstructionSet scs0 = new SimulationConstructionSet(robot0, parameters); scs0.setDT(0.0001, 11); scs0.startOnAThread(); Robot robot1 = createSimpleRobot(); RobotController rewindableController1 = new RewindableOrNotRewindableController(true); robot1.setController(rewindableController1); SimulationConstructionSet scs1 = new SimulationConstructionSet(robot1, parameters); scs1.setDT(0.0001, 11); scs1.startOnAThread(); int nTicksInitial = 121; int nTicksCompare = 121; int nTicksFinal = 11; SimulationComparisonScript script = new SimpleRewindabilityComparisonScript(nTicksInitial, nTicksCompare, nTicksFinal); ReflectionSimulationComparer.compareTwoSimulations(scs0, scs1, script, true, true); }
@ContinuousIntegrationTest(estimatedDuration = 0.5) @Test(timeout = 30000) public void testTwoNonRewindableSimulationsWithAScript() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, UnreasonableAccelerationException { Robot robot0 = new Robot("robot"); RobotController rewindableController0 = new RewindableOrNotRewindableController(false); robot0.setController(rewindableController0); SimulationConstructionSetParameters parameters = new SimulationConstructionSetParameters(); parameters.setCreateGUI(false); parameters.setDataBufferSize(100); SimulationConstructionSet scs0 = new SimulationConstructionSet(robot0, parameters); scs0.setDT(0.0001, 10); scs0.startOnAThread(); Robot robot1 = new Robot("robot"); RobotController rewindableController1 = new RewindableOrNotRewindableController(false); robot1.setController(rewindableController1); SimulationConstructionSet scs1 = new SimulationConstructionSet(robot1, parameters); scs1.setDT(0.0001, 10); scs1.startOnAThread(); int nTicksInitial = 20; int nTicksCompare = 30; int nTicksFinal = 40; SimulationComparisonScript script = new SimpleRewindabilityComparisonScript(nTicksInitial, nTicksCompare, nTicksFinal); ReflectionSimulationComparer.compareTwoSimulations(scs0, scs1, script, false, true); }
robot.setController(toolboxUpdater); robot.setDynamic(false); robot.setGravity(0);
dummy.setController(new Controller(graphicsListRegistry));
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); }
rootJoint = new FloatingJoint("floating", new Vector3d(), robot); robot.getRobotsYoVariableRegistry(); robot.setController(this); scs.setRobot(robot); swingLeg.set(RobotQuadrant.FRONT_RIGHT);
rootJoint = new FloatingJoint("floating", new Vector3d(), robot); robot.getRobotsYoVariableRegistry(); robot.setController(this); scs = new SimulationConstructionSet(); scs.setRobot(robot);
robot.setController(this); scs = new SimulationConstructionSet(); scs.setRobot(robot);