Commit | Line | Data |
---|---|---|
1ecdb44a MS |
1 | /** |
2 | * DOUBLE BLACK DIAMOND DOUBLE BLACK DIAMOND | |
3 | * | |
4 | * //\\ //\\ //\\ //\\ | |
5 | * ///\\\ ///\\\ ///\\\ ///\\\ | |
6 | * \\\/// \\\/// \\\/// \\\/// | |
7 | * \\// \\// \\// \\// | |
8 | * | |
9 | * EXPERTS ONLY!! EXPERTS ONLY!! | |
10 | * | |
186bc4d3 | 11 | * This file implements the mapping functions needed to lay out the physical |
1ecdb44a MS |
12 | * cubes and the output ports on the panda board. It should only be modified |
13 | * when physical changes or tuning is being done to the structure. | |
14 | */ | |
45f43cc2 | 15 | |
e18b4cb7 MS |
16 | static final float SPACING = 27; |
17 | static final float RISER = 13.5; | |
18 | static final float FLOOR = 0; | |
e037f60f | 19 | |
e18b4cb7 MS |
20 | /** |
21 | * Definitions of tower positions. This is all that should need | |
22 | * to be modified. Distances are measured from the left-most cube. | |
23 | * The first value is the offset moving NE (towards back-right). | |
24 | * The second value is the offset moving NW (negative comes forward-right). | |
25 | */ | |
bffb6a80 MS |
26 | static final TowerConfig[] TOWER_CONFIG = { |
27 | new TowerConfig("A", 0, 0, RISER, 4), | |
28 | new TowerConfig("B", 25, -10, RISER, 4), | |
29 | new TowerConfig("C", 50, -22.5, FLOOR, 5), | |
30 | new TowerConfig("D", 17.25, -35.5, FLOOR, 6), | |
31 | new TowerConfig("E", 43.25, -51.5, RISER, 6), | |
32 | new TowerConfig("F", 69.25, -56, FLOOR, 6), | |
33 | new TowerConfig("G", 12.75, -62.5, RISER, 4), | |
34 | new TowerConfig("H", 38.75, -78.5, FLOOR, 5), | |
35 | new TowerConfig("I", 65.75, -83, RISER, 5), | |
36 | new TowerConfig("J", 11.75, -89, RISER, 3), | |
37 | new TowerConfig("K", -50, -28, FLOOR, 3), | |
38 | new TowerConfig("L", -14, -28, FLOOR, 4), | |
39 | new TowerConfig("M", -16, -81, FLOOR, 3), | |
40 | new TowerConfig("N", -56, 8, FLOOR, 2), | |
41 | new TowerConfig("O", -9, 27, RISER, 2), | |
42 | new TowerConfig("P", -28, 0, RISER, 3), | |
43 | new TowerConfig("Q", -14, 54, FLOOR, 2), | |
44 | new TowerConfig("R", -30, -54, RISER, 2), | |
e18b4cb7 | 45 | }; |
ae579223 | 46 | |
bffb6a80 MS |
47 | /** |
48 | * Mappings for the output drivers. Can mix grizzly boards with | |
49 | * panda boards in here no problem. | |
50 | */ | |
51 | IPOutput[] buildOutputs() throws SocketException, UnknownHostException { | |
52 | return new IPOutput[] { | |
53 | // new GrizzlyOutput(lx, "192.168.88.100", 0, 0, 0, 39, 38, 40, 0, 37, 35, 0, 21, 20, 22, 0, 33, 32 ), | |
54 | // new GrizzlyOutput(lx, "192.168.88.104", 0, 13, 12, 0, 1, 2, 6, 5, 7, 0, 0, 4, 3, 9, 10, 11 ), | |
55 | // new GrizzlyOutput(lx, "192.168.88.105", 42, 41, 0, 43, 45, 44, 0, 0, 0, 0, 0, 0, 0, 24, 23, 25 ), | |
56 | // new GrizzlyOutput(lx, "192.168.88.107", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), | |
57 | ||
58 | new PandaOutput(lx, "10.200.1.29", new String[][] { | |
59 | new String[] { "00", "00", "00", "00" }, // 1 | |
60 | new String[] { "00", "00", "00", "00" }, // 2 | |
61 | new String[] { "E1", "E2", "E3", "E4" }, // 3 | |
62 | new String[] { "E5", "E6", "D5", "D6" }, // 4 | |
63 | new String[] { "H2", "H3", "H4", "H5" }, // 5 | |
64 | new String[] { "G1", "G2", "G3", "G4" }, // 6 | |
65 | new String[] { "00", "00", "00", "00" }, // 7 | |
66 | new String[] { "D1", "D2", "D3", "D4" }, // 8 | |
67 | }), | |
68 | ||
69 | new PandaOutput(lx, "10.200.1.30", new String[][] { | |
70 | new String[] { "00", "00", "00", "00" }, // 1 | |
71 | new String[] { "J1", "J2", "J3", "00" }, // 2 | |
72 | new String[] { "B1", "B2", "B3", "B4" }, // 3 | |
73 | new String[] { "K1", "K2", "K3", "00" }, // 4 | |
74 | new String[] { "F1", "F2", "F3", "F4" }, // 5 | |
75 | new String[] { "L1", "L2", "L3", "L4" }, // 6 | |
76 | new String[] { "C1", "C2", "C3", "C4" }, // 7 | |
77 | new String[] { "I1", "I2", "I3", "I4" }, // 8 | |
78 | }), | |
79 | ||
80 | new PandaOutput(lx, "10.200.1.31", new String[][] { | |
81 | new String[] { "00", "00", "00", "00" }, // 1 | |
82 | new String[] { "00", "00", "00", "00" }, // 2 | |
83 | new String[] { "A1", "A2", "A3", "A4" }, // 3 | |
84 | new String[] { "M1", "M2", "M3", "00" }, // 4 | |
85 | new String[] { "N1", "N2", "O1", "O2" }, // 5 | |
86 | new String[] { "C5", "F5", "F6", "I5" }, // 6 | |
87 | new String[] { "P1", "P2", "P3", "00" }, // 7 | |
88 | new String[] { "Q1", "Q2", "R1", "R2" }, // 8 | |
89 | }), | |
90 | ||
91 | }; | |
92 | } | |
93 | ||
94 | static class TowerConfig { | |
95 | public final String id; | |
96 | public final float x; | |
97 | public final float z; | |
98 | public final float base; | |
99 | public final int numCubes; | |
100 | ||
101 | public TowerConfig(String id, float z, float x, float base, int numCubes) { | |
102 | this.id = id; | |
103 | this.x = x; | |
104 | this.z = z; | |
105 | this.base = base; | |
106 | this.numCubes = numCubes; | |
107 | } | |
108 | } | |
109 | ||
e18b4cb7 | 110 | public Model buildModel() { |
e27a8652 | 111 | |
e18b4cb7 | 112 | List<Tower> towers = new ArrayList<Tower>(); |
3fa45e9e | 113 | Cube[] cubes = new Cube[200]; |
e18b4cb7 MS |
114 | int cubeIndex = 1; |
115 | ||
116 | float rt2 = sqrt(2); | |
117 | float x, y, z, xd, zd, num; | |
bffb6a80 MS |
118 | for (TowerConfig tc : TOWER_CONFIG) { |
119 | x = -tc.x; | |
120 | z = tc.z; | |
121 | y = tc.base; | |
122 | num = tc.numCubes; | |
e18b4cb7 MS |
123 | if (z < x) { |
124 | zd = -(x-z)/rt2; | |
125 | xd = z*rt2 - zd; | |
126 | } else { | |
127 | zd = (z-x)/rt2; | |
128 | xd = z*rt2 - zd; | |
bf1fe2d4 | 129 | } |
e18b4cb7 MS |
130 | List<Cube> tower = new ArrayList<Cube>(); |
131 | for (int n = 0; n < num; ++n) { | |
bffb6a80 | 132 | Cube cube = new Cube(tc.id + (n+1), xd + 24, y, zd + 84, 0, -45, 0); |
e18b4cb7 MS |
133 | tower.add(cube); |
134 | cubes[cubeIndex++] = cube; | |
135 | y += SPACING; | |
045b432d | 136 | } |
bffb6a80 | 137 | towers.add(new Tower(tc.id, tower)); |
84086fa3 | 138 | } |
e18b4cb7 | 139 | |
b9b7b3d4 | 140 | return new Model(towers, cubes); |
2bb56822 | 141 | } |