@Override public void setup(Simulator simulator) { super.setup(simulator); AquaticDrone drone = (AquaticDrone) simulator.getRobots().get(0); double x = 0, y = 0; drone.setPosition(x, y); drone.setOrientation(simulator.getRandom().nextDouble() * Math.PI * 2); Waypoint wp = new Waypoint("wp." + drone.getName(), CoordinateUtilities.cartesianToGPS(x, y)); drone.getEntities().add(wp); drone.setActiveWaypoint(wp); LightPole lp = new LightPole(simulator, "wp." + drone.getName(), x, y, 5); addObject(lp); }
@Override public void setup(Simulator simulator) { super.setup(simulator); if (randomSize) { // 1.5 - 2.5 width = random.nextDouble() + 1.5; // 0.8 - 1 height = random.nextDouble() + 0.8; } for (int i = 0; i < numberOfPreys; i++) addPrey(new Prey(simulator, "Prey_" + i, newRandomPosition(), 0, PREY_MASS, PREY_RADIUS)); // Parede do mapa walls.add( new Wall( simulator, "topWall", 0, height / 2, Math.PI, 1, 1, 0, width, 0.05, PhysicalObjectType.WALL)); walls.add( new Wall( simulator, "bottomWall", 0, -height / 2, Math.PI, 1, 1, 0, width, 0.05, PhysicalObjectType.WALL)); walls.add( new Wall( simulator, "leftWall", -width / 2, 0, Math.PI, 1, 1, 0, 0.05, height, PhysicalObjectType.WALL)); walls.add( new Wall( simulator, "rightWall", width / 2, 0, Math.PI, 1, 1, 0, 0.05, height, PhysicalObjectType.WALL)); for (Wall wall : walls) addObject(wall); for (Robot r : getRobots()) { r.setOrientation(random.nextDouble() * (2 * Math.PI)); double max = 1; if (getRobots().size() > 1) placeMultipleRobots(r, max); else r.setPosition(random.nextDouble() * max - max / 2, random.nextDouble() * max - max / 2); } CameraTracker tracker = new CameraTracker(simulator, lag, orientationError); simulator.addCallback(tracker); }