public RobotFreezeFramer(Robot robot, Joint rootJoint, SimulationConstructionSet scs) { this.robot = robot; this.graphicsRobot = scs.getStandardSimulationGUI().getGraphicsRobot(robot); this.graphics3dAdapter = scs.getGraphics3dAdapter(); if(rootJoint != null) { this.rootJoint = graphicsRobot.getGraphicsJoint(rootJoint); } else { this.rootJoint = graphicsRobot.getRootNode(); } doFreezeFrame.set(false); freezeInterval.set(1.0); nextFreezeTime.set(1.0); }
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(); }
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; }
TimestampProvider timeStampProvider = drcSimulationFactory.getTimeStampProvider(); HumanoidFloatingRootJointRobot robot = drcSimulationFactory.getRobot(); Graphics3DAdapter graphics3dAdapter = simulationConstructionSet.getGraphics3dAdapter();
TimestampProvider timeStampProvider = avatarSimulation.getSimulatedRobotTimeProvider(); HumanoidFloatingRootJointRobot robot = avatarSimulation.getHumanoidFloatingRootJointRobot(); Graphics3DAdapter graphics3dAdapter = simulationConstructionSet.getGraphics3dAdapter();
scs.addYoGraphicsListRegistry(yoGraphicsListRegistry); scs.getGraphics3dAdapter().addRootNode(robotGraphics.getRootNode()); scs.setGroundVisible(false); scs.startOnAThread();
scs.addYoGraphicsListRegistry(yoGraphicsListRegistry); scs.getGraphics3dAdapter().addRootNode(robotGraphics.getRootNode()); scs.setGroundVisible(false); scs.startOnAThread();