public void createSimulation(DRCNetworkModuleParameters networkParameters, boolean automaticallySpawnSimulation, boolean automaticallySimulate) { if ((networkParameters != null)) { createControllerCommunicator(networkParameters); } this.avatarSimulation = createAvatarSimulation(); if (automaticallySpawnSimulation) avatarSimulation.start(); if (automaticallySpawnSimulation && automaticallySimulate) avatarSimulation.simulate(); if ((networkParameters != null) && networkParameters.isNetworkProcessorEnabled()) //&& (networkParameters.useController())) { startNetworkProcessor(networkParameters); } }
public void destroySimulation() { if (avatarSimulation != null) { avatarSimulation.dispose(); } } }
public SimulationConstructionSet getSimulationConstructionSet() { return avatarSimulation.getSimulationConstructionSet(); }
initializeSimulationConstructionSet(); AvatarSimulation avatarSimulation = new AvatarSimulation(); avatarSimulation.setSimulationConstructionSet(simulationConstructionSet); avatarSimulation.setMomentumBasedControllerFactory(momentumBasedControllerFactory.get()); avatarSimulation.setYoVariableServer(yoVariableServer); avatarSimulation.setCloseableAndDisposableRegistry(closeableAndDisposableRegistry); avatarSimulation.setControllerThread(controllerThread); avatarSimulation.setStateEstimationThread(stateEstimationThread); avatarSimulation.setHumanoidGlobalDataProducer(humanoidGlobalDataProducer.get()); avatarSimulation.setThreadedRobotController(threadedRobotController); avatarSimulation.setHumanoidFloatingRootJointRobot(humanoidFloatingRootJointRobot); avatarSimulation.setSimulatedRobotTimeProvider(simulatedRobotTimeProvider); avatarSimulation.setThreadDataSynchronizer(threadDataSynchronizer);
initializeSimulationConstructionSet(); AvatarSimulation avatarSimulation = new AvatarSimulation(); avatarSimulation.setSimulationConstructionSet(simulationConstructionSet); avatarSimulation.setHighLevelHumanoidControllerFactory(highLevelHumanoidControllerFactory.get()); avatarSimulation.setYoVariableServer(yoVariableServer); avatarSimulation.setCloseableAndDisposableRegistry(closeableAndDisposableRegistry); avatarSimulation.setControllerThread(controllerThread); avatarSimulation.setStateEstimationThread(stateEstimationThread); avatarSimulation.setThreadedRobotController(threadedRobotController); avatarSimulation.setHumanoidFloatingRootJointRobot(humanoidFloatingRootJointRobot); avatarSimulation.setSimulatedRobotTimeProvider(simulatedRobotTimeProvider); avatarSimulation.setThreadDataSynchronizer(threadDataSynchronizer);
public void assertRobotDidNotFall() { Point3D center = new Point3D(0.0, 0.0, 0.8882009563211146); Vector3D plusMinusVector = new Vector3D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, 0.5); BoundingBox3D boundingBox = BoundingBox3D.createUsingCenterAndPlusMinusVector(center, plusMinusVector); DRCSimulationTestHelper.assertRobotsRootJointIsInBoundingBox(boundingBox, drcFlatGroundWalkingTrack.getAvatarSimulation().getHumanoidFloatingRootJointRobot()); } }
AvatarSimulation avatarSimulation = avatarSimulationFactory.createAvatarSimulation(); simulationConstructionSet = avatarSimulation.getSimulationConstructionSet(); avatarSimulation.start(); FullRobotModelCorruptor fullRobotModelCorruptor = avatarSimulation.getFullRobotModelCorruptor(); if (fullRobotModelCorruptor == null) throw new RuntimeException("This only works with model corruption on. Change DRCControllerThread.ALLOW_MODEL_CORRUPTION to true!");
public LocalObjectCommunicator createSimulatedSensorsPacketCommunicator() { scsSensorOutputPacketCommunicator = new LocalObjectCommunicator(); if (createSCSSimulatedSensors) { DRCRobotSensorInformation sensorInformation = robotModel.getSensorInformation(); DRCRobotJointMap jointMap = robotModel.getJointMap(); TimestampProvider timeStampProvider = avatarSimulation.getSimulatedRobotTimeProvider(); HumanoidFloatingRootJointRobot robot = avatarSimulation.getHumanoidFloatingRootJointRobot(); Graphics3DAdapter graphics3dAdapter = simulationConstructionSet.getGraphics3dAdapter(); printIfDebug("Streaming SCS Video"); DRCRobotCameraParameters cameraParameters = sensorInformation.getCameraParameters(0); if (cameraParameters != null) { String cameraName = cameraParameters.getSensorNameInSdf(); int width = sdfRobot.getCameraMount(cameraName).getImageWidth(); int height = sdfRobot.getCameraMount(cameraName).getImageHeight(); CameraConfiguration cameraConfiguration = new CameraConfiguration(cameraName); cameraConfiguration.setCameraMount(cameraName); int framesPerSecond = 25; DRCRenderedSceneVideoHandler drcRenderedSceneVideoHandler = new DRCRenderedSceneVideoHandler(scsSensorOutputPacketCommunicator); simulationConstructionSet.startStreamingVideoData(cameraConfiguration, width, height, drcRenderedSceneVideoHandler, timeStampProvider, framesPerSecond); } for (DRCRobotLidarParameters lidarParams : sensorInformation.getLidarParameters()) { DRCLidar.setupDRCRobotLidar(robot, graphics3dAdapter, scsSensorOutputPacketCommunicator, jointMap, lidarParams, timeStampProvider, true); } } return scsSensorOutputPacketCommunicator; }
avatarSimulation.setExternalPelvisCorrectorSubscriber(externalPelvisCorrectorSubscriber); simulationConstructionSet = avatarSimulation.getSimulationConstructionSet(); sdfRobot = avatarSimulation.getHumanoidFloatingRootJointRobot();
scriptBasedControllerCommandGenerator = new ScriptBasedControllerCommandGenerator(controllerCommands, fullRobotModel); simulationConstructionSet = avatarSimulation.getSimulationConstructionSet(); sdfRobot = avatarSimulation.getHumanoidFloatingRootJointRobot();
public void simulate() { System.out.println("Starting simulation"); avatarSimulation.simulate(); }
avatarSimulation.start();
public void attachControllerFailureListener(ControllerFailureListener listener) { avatarSimulation.getHighLevelHumanoidControllerFactory().attachControllerFailureListener(listener); }
private void setupTest(DRCRobotModel robotModel) throws SimulationExceededMaximumTimeException, InterruptedException { boolean runMultiThreaded = false; setupTrack(runMultiThreaded, robotModel); FullHumanoidRobotModel fullRobotModel = robotModel.createFullRobotModel(); pushRobotController = new PushRobotController(drcFlatGroundWalkingTrack.getAvatarSimulation().getHumanoidFloatingRootJointRobot(), fullRobotModel); if (VISUALIZE_FORCE) { drcFlatGroundWalkingTrack.getSimulationConstructionSet().addYoGraphic(pushRobotController.getForceVisualizer()); } SimulationConstructionSet scs = drcFlatGroundWalkingTrack.getSimulationConstructionSet(); YoBoolean enable = (YoBoolean) scs.getVariable("PushRecoveryControlModule", "enablePushRecovery"); // enable push recovery enable.set(true); }
AvatarSimulation avatarSimulation = avatarSimulationFactory.createAvatarSimulation(); simulationConstructionSet = avatarSimulation.getSimulationConstructionSet(); avatarSimulation.start(); FullRobotModelCorruptor fullRobotModelCorruptor = avatarSimulation.getFullRobotModelCorruptor(); if(fullRobotModelCorruptor == null) throw new RuntimeException("This only works with model corruption on. Change DRCControllerThread.ALLOW_MODEL_CORRUPTION to true!");
TimestampProvider timeStampProvider = avatarSimulation.getSimulatedRobotTimeProvider(); HumanoidFloatingRootJointRobot robot = avatarSimulation.getHumanoidFloatingRootJointRobot(); Graphics3DAdapter graphics3dAdapter = simulationConstructionSet.getGraphics3dAdapter();
avatarSimulation = avatarSimulationFactory.createAvatarSimulation(); avatarSimulation.start();
public CommonHumanoidReferenceFrames getReferenceFrames() { HighLevelHumanoidControllerFactory momentumBasedControllerFactory = avatarSimulation.getHighLevelHumanoidControllerFactory(); HighLevelHumanoidControllerToolbox highLevelHumanoidControllerToolbox = momentumBasedControllerFactory.getHighLevelHumanoidControllerToolbox(); return highLevelHumanoidControllerToolbox.getReferenceFrames(); }
public void createSimulation(DRCNetworkModuleParameters networkParameters, boolean automaticallySpawnSimulation, boolean automaticallySimulate) { if ((networkParameters != null)) { createControllerCommunicator(networkParameters); } this.avatarSimulation = createAvatarSimulation(); if (automaticallySpawnSimulation) avatarSimulation.start(); if (realtimeRos2Node != null) realtimeRos2Node.spin(); if (automaticallySpawnSimulation && automaticallySimulate) avatarSimulation.simulate(); if ((networkParameters != null) && networkParameters.isNetworkProcessorEnabled()) //&& (networkParameters.useController())) { startNetworkProcessor(networkParameters); } }
private DRCFlatGroundWalkingTrack setupWalkingSim() { DRCRobotModel robotModel = getRobotModel(); DRCGuiInitialSetup guiInitialSetup = new DRCGuiInitialSetup(true, false, simulationTestingParameters); GroundProfile3D groundProfile = new FlatGroundProfile(); DRCSCSInitialSetup scsInitialSetup = new DRCSCSInitialSetup(groundProfile, robotModel.getSimulateDT()); scsInitialSetup.setDrawGroundProfile(false); externalPelvisPosePublisher = new ExternalPelvisPoseCreator(); DRCFlatGroundWalkingTrack drcFlatGroundWalkingTrack = new DRCFlatGroundWalkingTrack(robotModel.getDefaultRobotInitialSetup(0.0, 0.0), guiInitialSetup, scsInitialSetup, true, false, getRobotModel(), externalPelvisPosePublisher); simulationConstructionSet = drcFlatGroundWalkingTrack.getSimulationConstructionSet(); robot = drcFlatGroundWalkingTrack.getAvatarSimulation().getHumanoidFloatingRootJointRobot(); registry = robot.getRobotsYoVariableRegistry(); YoBoolean walk = (YoBoolean) simulationConstructionSet.getVariable("walkCSG"); walk.set(true); return drcFlatGroundWalkingTrack; }