public void testSetupInEnvironment() { // Not an actual test, could be given @Test(timeout=300000) for visual confirmation though SimulationConstructionSet scs = new SimulationConstructionSet(); scs.addStaticLinkGraphics(inclinedTopFaceOctagon3d.getLinkGraphics()); scs.setGroundVisible(false); scs.startOnAThread(); while (true) { try { Thread.sleep(1000); } catch (InterruptedException e) { } } }
public static void main(String[] args) { SimulationConstructionSet scs = new SimulationConstructionSet(); scs.setGroundVisible(false); scs.addStaticLinkGraphics(new CinderBlockFieldPlanarRegionEnvironment().getTerrainObject3D().getLinkGraphics()); scs.startOnAThread(); }
private void startSimAndDisplayLink(Link linkToDisplay) { // Robot nullRobot = new Robot("Null"); sim = new SimulationConstructionSet(parameters); sim.addStaticLink(linkToDisplay); // position the camera to view links sim.setCameraPosition(6.0, 6.0, 3.0); sim.setCameraFix(0.5, 0.5, 0.0); sim.setGroundVisible(false); sim.startOnAThread(); ThreadTools.sleep(3000); sim.closeAndDispose(); }
public static void main(String[] args) { YoGraphicsListRegistry yoGraphicsListRegistry = new YoGraphicsListRegistry(); DRCDemoEnvironmentSimpleSteeringWheelContact env = new DRCDemoEnvironmentSimpleSteeringWheelContact(yoGraphicsListRegistry); List<Robot> robots = env.getEnvironmentRobots(); Robot[] robotArray = new Robot[robots.size()]; robots.toArray(robotArray); SimulationConstructionSetParameters parameters = new SimulationConstructionSetParameters(); parameters.setDataBufferSize(36000); SimulationConstructionSet scs = new SimulationConstructionSet(robotArray, parameters); scs.setDT(1e-4, 20); TerrainObject3D terrainObject = env.getTerrainObject3D(); scs.addStaticLinkGraphics(terrainObject.getLinkGraphics()); scs.addYoGraphicsListRegistry(yoGraphicsListRegistry); scs.setGroundVisible(false); scs.startOnAThread(); }
public static void main(String[] args) { SimulationConstructionSet scs = new SimulationConstructionSet(new Robot("robot")); scs.addStaticLinkGraphics(new TwoBollardEnvironment(0.75).getTerrainObject3D().getLinkGraphics()); scs.setGroundVisible(false); scs.startOnAThread(); } }
public static PlanarRegionBipedalFootstepPlannerVisualizer createWithSimulationConstructionSet(double dtForViz, SideDependentList<ConvexPolygon2d> footPolygonsInSoleFrame) { YoVariableRegistry registry = new YoVariableRegistry(PlanarRegionBipedalFootstepPlannerVisualizerFactory.class.getSimpleName()); YoGraphicsListRegistry graphicsListRegistry = new YoGraphicsListRegistry(); PlanarRegionBipedalFootstepPlannerVisualizer footstepPlannerVisualizer = new PlanarRegionBipedalFootstepPlannerVisualizer(10, footPolygonsInSoleFrame, registry, graphicsListRegistry); SimulationConstructionSet scs = new SimulationConstructionSet(new Robot("Test")); footstepPlannerVisualizer.setTickAndUpdatable(scs); scs.changeBufferSize(32000); scs.addYoVariableRegistry(registry); scs.addYoGraphicsListRegistry(graphicsListRegistry); scs.setDT(dtForViz, 1); scs.setGroundVisible(false); scs.startOnAThread(); return footstepPlannerVisualizer; }
public static void main(String[] args) { SimulationConstructionSet scs = new SimulationConstructionSet(new Robot("exampleRobot")); // PlanarRegionsList planarRegionsList = createMazeEnvironment(); PlanarRegionsList planarRegionsList = generateSteppingStoneField(0.1, 0.1, 0.25, 0.3, 6); PlanarRegionsListDefinedEnvironment environment = new PlanarRegionsListDefinedEnvironment("ExamplePlanarRegionsListEnvironment", new PlanarRegionsList[] {planarRegionsList}, null, 1e-5, false); TerrainObject3D terrainObject3D = environment.getTerrainObject3D(); scs.addStaticLinkGraphics(terrainObject3D.getLinkGraphics()); scs.setGroundVisible(false); // Graphics3DObject startAndEndGraphics = new Graphics3DObject(); // startAndEndGraphics.translate(0.0, 0.0, 0.5); // startAndEndGraphics.addSphere(0.2, YoAppearance.Green()); // startAndEndGraphics.identity(); // startAndEndGraphics.translate(3.0, 2.5, 0.5); // startAndEndGraphics.addSphere(0.2, YoAppearance.Red()); // scs.addStaticLinkGraphics(startAndEndGraphics); scs.startOnAThread(); } }
public static void main(String[] args) { SimulationConstructionSet scs = new SimulationConstructionSet(new Robot("Null")); ConvexPolygon2D footPolygon = new ConvexPolygon2D(Vertex2DSupplier.asVertex2DSupplier(new double[][] { {-0.2, -0.2}, {-0.2, 0.2}, {0.2, 0.2}, {0.2, -0.2} })); // SteppingStones steppingStones = SteppingStones.generateRandomSteppingStones(new Random(1776L), 20, footPolygon); // Inside out? // SteppingStones steppingStones = SteppingStones.generateRectangularCheckeredStripSteppingStones(0.0,0.0,0.2,0.2,0.1,0.1,-0.1, 0.0,33); // Inside out? // SteppingStones steppingStones = SteppingStones.generateRectangularChessBoardSteppingStones(0.0,0.0,0.2,0.2,0.0,0.0,-0.1,0.0,6,6); // Inside out? // SteppingStones steppingStones = SteppingStones.generateRectangularUniformSteppingStones(0.0, 0.0, 2.0, 2.0, 0.5, 0.5, -0.1, 0.0, 6, 6, footPolygon, // false); // Inside out? // SteppingStones steppingStones = SteppingStones.generateRegularPolygonalCheckeredStripSteppingStones(0.0,0.0,0.2,5,0.0,0.0,-0.1,0.0,33); // SteppingStones steppingStones = SteppingStones.generateRegularPolygonalChessBoardSteppingStones(0.0,0.0,0.2,7,0.0,0.0,-0.1,0.0,8,8); // SteppingStones steppingStones = SteppingStones.generateRegularPolygonalUniformSteppingStones(0.0,0.0,0.2,5,0.0,0.0,-0.1,0.0,5,5); // SteppingStones steppingStones = SteppingStones.generateRandomPolygonalCheckeredStripSteppingStones(0.0,0.0,0.2,7,0.0,0.0,-0.1,0.0,33); // SteppingStones steppingStones = SteppingStones.generateRandomPolygonalChessBoardSteppingStones(0.0,0.0,0.2,5,0.0,0.0,-0.2,0.0,8,8); SteppingStones steppingStones = SteppingStones.generateRandomPolygonalUniformSteppingStones(0.0,0.0,0.5,6,0.0, 0.0, -0.1, 0.01, 5, 5, footPolygon, false); ArrayList<Graphics3DObject> linkGraphics = steppingStones.createLinkGraphics(); scs.setGroundVisible(false); scs.addStaticLinkGraphics(linkGraphics); scs.startOnAThread(); }
private DRCFlatGroundWalkingTrack setupSimulationTrack(WalkingControllerParameters drcControlParameters, GroundProfile3D groundProfile, GroundProfile3D groundProfile3D, boolean drawGroundProfile, boolean useVelocityAndHeadingScript, boolean cheatWithGroundHeightAtForFootstep, DRCRobotInitialSetup<HumanoidFloatingRootJointRobot> robotInitialSetup) { DRCGuiInitialSetup guiInitialSetup = createGUIInitialSetup(); DRCSCSInitialSetup scsInitialSetup; if (groundProfile != null) { scsInitialSetup = new DRCSCSInitialSetup(groundProfile, robotModel.getSimulateDT()); } else { scsInitialSetup = new DRCSCSInitialSetup(groundProfile3D, robotModel.getSimulateDT()); } scsInitialSetup.setDrawGroundProfile(drawGroundProfile); if (cheatWithGroundHeightAtForFootstep) scsInitialSetup.setInitializeEstimatorToActual(true); DRCFlatGroundWalkingTrack drcFlatGroundWalkingTrack = new DRCFlatGroundWalkingTrack(robotInitialSetup, guiInitialSetup, scsInitialSetup, useVelocityAndHeadingScript, cheatWithGroundHeightAtForFootstep, robotModel); SimulationConstructionSet scs = drcFlatGroundWalkingTrack.getSimulationConstructionSet(); scs.setGroundVisible(false); setupCameraForUnitTest(scs); return drcFlatGroundWalkingTrack; }
public ValkyrieSDFLoadingDemo() { ValkyrieRobotModel robotModel = new ValkyrieRobotModel(RobotTarget.SCS, false); FloatingRootJointRobot valkyrieRobot = robotModel.createHumanoidFloatingRootJointRobot(false); valkyrieRobot.setPositionInWorld(new Vector3D()); if (SHOW_ELLIPSOIDS) { addIntertialEllipsoidsToVisualizer(valkyrieRobot); } if (SHOW_COORDINATES_AT_JOINT_ORIGIN) addJointAxis(valkyrieRobot); FullRobotModel fullRobotModel = robotModel.createFullRobotModel(); YoGraphicsListRegistry yoGraphicsListRegistry = new YoGraphicsListRegistry(); CommonInertiaEllipsoidsVisualizer inertiaVis = new CommonInertiaEllipsoidsVisualizer(fullRobotModel.getElevator(), yoGraphicsListRegistry); inertiaVis.update(); scs = new SimulationConstructionSet(valkyrieRobot); scs.addYoGraphicsListRegistry(yoGraphicsListRegistry); scs.setGroundVisible(false); scs.startOnAThread(); }
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); }
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); }
scs = new SimulationConstructionSet(robot); scs.setGroundVisible(false);
scs.setCameraPosition(CAMPOS[0], CAMPOS[1], CAMPOS[2]); scs.setGroundVisible(SHOW_COLLISION_TERRAIN);
public void startSimulation() throws IOException { SimpleLidarRobot robot = new SimpleLidarRobot(); SimulationConstructionSetParameters parameters = new SimulationConstructionSetParameters(true, RealtimeTools.nextPowerOfTwo(200000)); SimulationConstructionSet scs = new SimulationConstructionSet(robot, parameters); double simDT = 0.0001; double controlDT = 0.01; scs.setDT(simDT, 10); scs.setSimulateDoneCriterion(() -> false); Graphics3DAdapter graphics3dAdapter = scs.getGraphics3dAdapter(); YoGraphicsListRegistry yoGraphicsListRegistry = new YoGraphicsListRegistry(); SimpleLidarRobotController controller = new SimpleLidarRobotController(robot, controlDT, ros2Node, graphics3dAdapter, yoGraphicsListRegistry); robot.setController(controller, (int) (controlDT / simDT)); scs.addYoGraphicsListRegistry(yoGraphicsListRegistry); createGroundTypeListener(scs); scs.setGroundVisible(false); scs.startOnAThread(); scs.simulate(); }
private static SimulationConstructionSet setupSCS(String testName, YoVariableRegistry testRegistry, PlanarRegionsList regions, Point3D start, Point3D goal) { Robot robot = new Robot(VisibilityGraphsOcclusionTest.class.getSimpleName()); robot.addYoVariableRegistry(testRegistry); SimulationConstructionSet scs = new SimulationConstructionSet(robot, simulationTestingParameters); Graphics3DObject graphics3DObject = new Graphics3DObject(); graphics3DObject.addCoordinateSystem(0.8); if (regions != null) { Graphics3DObjectTools.addPlanarRegionsList(graphics3DObject, regions, YoAppearance.White(), YoAppearance.Grey(), YoAppearance.DarkGray()); scs.setGroundVisible(false); } graphics3DObject.identity(); graphics3DObject.translate(start); graphics3DObject.translate(0.0, 0.0, 0.05); graphics3DObject.addCone(0.3, 0.05, YoAppearance.Green()); graphics3DObject.identity(); graphics3DObject.translate(goal); graphics3DObject.translate(0.0, 0.0, 0.05); graphics3DObject.addCone(0.3, 0.05, YoAppearance.Red()); scs.addStaticLinkGraphics(graphics3DObject); scs.setCameraPosition(-7.0, -1.0, 25.0); scs.setCameraFix(0.0, 0.0, 0.0); return scs; }
public PolygonSnapperVisualizer(ConvexPolygon2D snappingPolygonShape) { Robot robot = new Robot("Robot"); scs = new SimulationConstructionSet(robot); scs.setDT(0.1, 1); polygonToSnap = new YoFrameConvexPolygon2D("polygonToSnap", ReferenceFrame.getWorldFrame(), 4, registry); snappedPolygon = new YoFrameConvexPolygon2D("snappedPolygon", ReferenceFrame.getWorldFrame(), 4, registry); polygonToSnap.set(snappingPolygonShape); snappedPolygon.set(snappingPolygonShape); polygonToSnapPose = new YoFramePoseUsingYawPitchRoll("polygonToSnapPose", ReferenceFrame.getWorldFrame(), registry); snappedPolygonPose = new YoFramePoseUsingYawPitchRoll("snappedPolygonPose", ReferenceFrame.getWorldFrame(), registry); polygonToSnapPose.setToNaN(); snappedPolygonPose.setToNaN(); polygonToSnapViz = new YoGraphicPolygon("polygonToSnapViz", polygonToSnap, polygonToSnapPose, 1.0, YoAppearance.Green()); snappedPolygonViz = new YoGraphicPolygon("snappedPolygonViz", polygonToSnap, snappedPolygonPose, 1.0, YoAppearance.Red()); polygonToSnapViz.update(); snappedPolygonViz.update(); scs.addYoGraphic(polygonToSnapViz); scs.addYoGraphic(snappedPolygonViz); scs.addYoVariableRegistry(registry); scs.setGroundVisible(false); scs.startOnAThread(); }
scs.setGroundVisible(false); scs.startOnAThread(); ThreadTools.sleepForever();