public SimplePendulumSimulation() { SimplePendulumRobot robot = new SimplePendulumRobot(); robot.setController(new SimplePendulumController(robot)); SimulationConstructionSetParameters parameters = new SimulationConstructionSetParameters(); parameters.setDataBufferSize(32000); sim = new SimulationConstructionSet(robot, parameters); sim.setDT(DT, 20); sim.setGroundVisible(true); sim.setCameraPosition(0, -9.0, 0.6); sim.setCameraFix(0.0, 0.0, 0.70); sim.setSimulateDuration(60.0); // sets the simulation duration to 60 seconds Thread myThread = new Thread(sim); myThread.start(); }
/* Print out the various spectra on SCS. */ public static void main(String[] args) { // A spectrum size larger than 32 tests color interpolation. int spectrumSize = 100; double cubeSize = 0.03; double cubeY = 0.3; // 0.5; for reverse maps SimulationConstructionSetParameters parameters = new SimulationConstructionSetParameters(); parameters.setDataBufferSize(32000); SimulationConstructionSet scs = new SimulationConstructionSet(new Robot("NullBot"), parameters); // Print all maps and print their reverse maps. boolean reverseMap = true; // for (int i = 0; i <= 1; i++) { reverseMap = !reverseMap; // jet cubeY -= 3 * cubeSize; ColorSpectrum spectrum = ColorSpectrum.jetColors(spectrumSize, reverseMap); printSpectrum(spectrum, cubeY, cubeSize, scs); // jet2 cubeY -= 3 * cubeSize; spectrum = ColorSpectrum.jet2Colors(spectrumSize, reverseMap); printSpectrum(spectrum, cubeY, cubeSize, scs); // hsv cubeY -= 3 * cubeSize; spectrum = ColorSpectrum.hsvColors(spectrumSize, reverseMap); printSpectrum(spectrum, cubeY, cubeSize, scs); // bone cubeY -= 3 * cubeSize; spectrum = ColorSpectrum.boneColors(spectrumSize, reverseMap); printSpectrum(spectrum, cubeY, cubeSize, scs); // copper cubeY -= 3 * cubeSize; spectrum = ColorSpectrum.copperColors(spectrumSize, reverseMap); printSpectrum(spectrum, cubeY, cubeSize, scs); // hot cubeY -= 3 * cubeSize; spectrum = ColorSpectrum.hotColors(spectrumSize, reverseMap); printSpectrum(spectrum, cubeY, cubeSize, scs); // cool cubeY -= 3 * cubeSize; spectrum = ColorSpectrum.coolColors(spectrumSize, reverseMap); printSpectrum(spectrum, cubeY, cubeSize, scs); // gray cubeY -= 3 * cubeSize; spectrum = ColorSpectrum.grayColors(spectrumSize, reverseMap); printSpectrum(spectrum, cubeY, cubeSize, scs); } Thread thread = new Thread(scs); thread.start(); }