/** * DOUBLE BLACK DIAMOND DOUBLE BLACK DIAMOND * * //\\ //\\ //\\ //\\ * ///\\\ ///\\\ ///\\\ ///\\\ * \\\/// \\\/// \\\/// \\\/// * \\// \\// \\// \\// * * EXPERTS ONLY!! EXPERTS ONLY!! * * This file implements the mapping functions needed to lay out the physical * cubes and the output ports on the panda board. It should only be modified * when physical changes or tuning is being done to the structure. */ static final float SPACING = 27; static final float RISER = 13.5; static final float FLOOR = 0; /** * Definitions of tower positions. This is all that should need * to be modified. Distances are measured from the left-most cube. * The first value is the offset moving NE (towards back-right). * The second value is the offset moving NW (negative comes forward-right). */ static final TowerConfig[] TOWER_CONFIG = { new TowerConfig("A", 0, 0, RISER, 4), new TowerConfig("B", 25, -10, RISER, 4), new TowerConfig("C", 50, -22.5, FLOOR, 5), new TowerConfig("D", 17.25, -35.5, FLOOR, 6), new TowerConfig("E", 43.25, -51.5, RISER, 6), new TowerConfig("F", 69.25, -56, FLOOR, 6), new TowerConfig("G", 12.75, -62.5, RISER, 4), new TowerConfig("H", 38.75, -78.5, FLOOR, 5), new TowerConfig("I", 65.75, -83, RISER, 5), new TowerConfig("J", 11.75, -89, RISER, 3), new TowerConfig("K", -50, -28, FLOOR, 3), new TowerConfig("L", -14, -28, FLOOR, 4), new TowerConfig("M", -16, -81, FLOOR, 3), new TowerConfig("N", -56, 8, FLOOR, 2), new TowerConfig("O", -9, 27, RISER, 2), new TowerConfig("P", -28, 0, RISER, 3), new TowerConfig("Q", -14, 54, FLOOR, 2), new TowerConfig("R", -30, -54, RISER, 2), }; /** * Mappings for the output drivers. Can mix grizzly boards with * panda boards in here no problem. */ IPOutput[] buildOutputs() throws SocketException, UnknownHostException { return new IPOutput[] { // new GrizzlyOutput(lx, "192.168.88.100", 0, 0, 0, 39, 38, 40, 0, 37, 35, 0, 21, 20, 22, 0, 33, 32 ), // new GrizzlyOutput(lx, "192.168.88.104", 0, 13, 12, 0, 1, 2, 6, 5, 7, 0, 0, 4, 3, 9, 10, 11 ), // new GrizzlyOutput(lx, "192.168.88.105", 42, 41, 0, 43, 45, 44, 0, 0, 0, 0, 0, 0, 0, 24, 23, 25 ), // new GrizzlyOutput(lx, "192.168.88.107", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), new PandaOutput(lx, "10.200.1.29", new String[][] { new String[] { "00", "00", "00", "00" }, // 1 new String[] { "00", "00", "00", "00" }, // 2 new String[] { "E1", "E2", "E3", "E4" }, // 3 new String[] { "E5", "E6", "D5", "D6" }, // 4 new String[] { "H2", "H3", "H4", "H5" }, // 5 new String[] { "G1", "G2", "G3", "G4" }, // 6 new String[] { "00", "00", "00", "00" }, // 7 new String[] { "D1", "D2", "D3", "D4" }, // 8 }), new PandaOutput(lx, "10.200.1.30", new String[][] { new String[] { "00", "00", "00", "00" }, // 1 new String[] { "J1", "J2", "J3", "00" }, // 2 new String[] { "B1", "B2", "B3", "B4" }, // 3 new String[] { "K1", "K2", "K3", "00" }, // 4 new String[] { "F1", "F2", "F3", "F4" }, // 5 new String[] { "L1", "L2", "L3", "L4" }, // 6 new String[] { "C1", "C2", "C3", "C4" }, // 7 new String[] { "I1", "I2", "I3", "I4" }, // 8 }), new PandaOutput(lx, "10.200.1.31", new String[][] { new String[] { "00", "00", "00", "00" }, // 1 new String[] { "00", "00", "00", "00" }, // 2 new String[] { "A1", "A2", "A3", "A4" }, // 3 new String[] { "M1", "M2", "M3", "00" }, // 4 new String[] { "N1", "N2", "O1", "O2" }, // 5 new String[] { "C5", "F5", "F6", "I5" }, // 6 new String[] { "P1", "P2", "P3", "00" }, // 7 new String[] { "Q1", "Q2", "R1", "R2" }, // 8 }), }; } static class TowerConfig { public final String id; public final float x; public final float z; public final float base; public final int numCubes; public TowerConfig(String id, float z, float x, float base, int numCubes) { this.id = id; this.x = x; this.z = z; this.base = base; this.numCubes = numCubes; } } public Model buildModel() { List towers = new ArrayList(); Cube[] cubes = new Cube[200]; int cubeIndex = 1; float rt2 = sqrt(2); float x, y, z, xd, zd, num; for (TowerConfig tc : TOWER_CONFIG) { x = -tc.x; z = tc.z; y = tc.base; num = tc.numCubes; if (z < x) { zd = -(x-z)/rt2; xd = z*rt2 - zd; } else { zd = (z-x)/rt2; xd = z*rt2 - zd; } List tower = new ArrayList(); for (int n = 0; n < num; ++n) { Cube cube = new Cube(tc.id + (n+1), xd + 24, y, zd + 84, 0, -45, 0); tower.add(cube); cubes[cubeIndex++] = cube; y += SPACING; } towers.add(new Tower(tc.id, tower)); } return new Model(towers, cubes); }