2 * DOUBLE BLACK DIAMOND DOUBLE BLACK DIAMOND
5 * ///\\\ ///\\\ ///\\\ ///\\\
6 * \\\/// \\\/// \\\/// \\\///
9 * EXPERTS ONLY!! EXPERTS ONLY!!
11 * This file implements the mapping functions needed to lay out the physical
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.
17 public final float x, y, z;
18 public final float[][] cubePositions;
20 TowerMapping(float x, float y, float z, float[][] cubePositions) {
24 this.cubePositions = cubePositions;
28 public Model buildModel() {
29 // The model is represented as an array of towers. The cubes in the tower
30 // are represenented relatively. Each tower has an x, y, z reference position,
31 // which is typically the base cube's bottom left corner.
33 // Following that is an array of floats. A 2-d array contains an x-offset
34 // and a z-offset from the reference position. Typically the first cube
35 // will just be {0, 0}.
37 // A 3-d array contains an x-offset, a z-offset, and a rotation about the
40 // The cubes automatically increment their y-position by Cube.EDGE_HEIGHT.
41 TowerMapping[] mapping = new TowerMapping[] {
43 new TowerMapping(0, 0, 0, new float[][] {
50 new TowerMapping(Cube.EDGE_WIDTH + 2, 0, 0, new float[][] {
57 // Back Cubes behind DJ platform (in order of increasing x)
58 new TowerMapping(50, 5, BASS_DEPTH, new float[][] {
66 new TowerMapping(79, 5, BASS_DEPTH, new float[][] {
74 new TowerMapping(107, 5, BASS_DEPTH, new float[][] {
82 new TowerMapping(133, 5, BASS_DEPTH, new float[][] {
90 new TowerMapping(165, 5, BASS_DEPTH, new float[][] {
99 new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2, BASS_HEIGHT, 10, new float[][] {
104 new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + Cube.EDGE_HEIGHT, BASS_HEIGHT, 10, new float[][] {
109 new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 2*Cube.EDGE_HEIGHT + 5, BASS_HEIGHT, 10, new float[][] {
114 new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 3*Cube.EDGE_HEIGHT + 9, BASS_HEIGHT, 10, new float[][] {
119 new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 4*Cube.EDGE_HEIGHT + 15, BASS_HEIGHT, 10, new float[][] {
125 new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2, BASS_HEIGHT, Cube.EDGE_HEIGHT + 2, new float[][] {
130 new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2, BASS_HEIGHT, 2*Cube.EDGE_HEIGHT + 4, new float[][] {
136 new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 4*Cube.EDGE_HEIGHT + 15, BASS_HEIGHT, Cube.EDGE_HEIGHT + 2, new float[][] {
141 new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 4*Cube.EDGE_HEIGHT + 15, BASS_HEIGHT, 2*Cube.EDGE_HEIGHT + 4, new float[][] {
146 new TowerMapping(200, 0, 0, new float[][] {
154 new TowerMapping(0, 0, Cube.EDGE_HEIGHT + 10, new float[][] {
162 new TowerMapping(20, 0, 2*Cube.EDGE_HEIGHT + 18, new float[][] {
170 new TowerMapping(210, 0, Cube.EDGE_HEIGHT + 15, new float[][] {
178 new TowerMapping(210, 0, 2*Cube.EDGE_HEIGHT + 25, new float[][] {
188 ArrayList<Tower> towerList = new ArrayList<Tower>();
189 ArrayList<Cube> tower;
190 Cube[] cubes = new Cube[79];
193 for (TowerMapping tm : mapping) {
194 tower = new ArrayList<Cube>();
198 for (float[] cp : tm.cubePositions) {
199 ry = (cp.length >= 3) ? cp[2] : 0;
200 tower.add(cubes[cubeIndex++] = new Cube(x + cp[0], y, z + cp[1], 0, ry, 0));
201 y += Cube.EDGE_HEIGHT;
203 towerList.add(new Tower(tower));
206 return new Model(towerList, cubes);
209 public PandaMapping[] buildPandaList() {
210 return new PandaMapping[] {
212 "10.200.1.28", new int[][] {
213 { 1, 2, 3, 4 }, // ch1
214 { 5, 6, 7, 8 }, // ch2
215 { 9, 10, 11, 12 }, // ch3
216 { 13, 14, 15, 16 }, // ch4
217 { 17, 18, 19, 20 }, // ch5
218 { 21, 22, 23, 24 }, // ch6
219 { 25, 26, 27, 28 }, // ch7
220 { 29, 30, 31, 32 }, // ch8
224 "10.200.1.29", new int[][] {
225 { 33, 34, 35, 36 }, // ch9
226 { 37, 38, 39, 40 }, // ch10
227 { 41, 42, 43, 44 }, // ch11
228 { 45, 46, 47, 48 }, // ch12
229 { 49, 50, 51, 52 }, // ch13
230 { 53, 54, 55, 56 }, // ch14
231 { 57, 58, 59, 60 }, // ch15
232 { 61, 62, 63, 64 }, // ch16
240 // How many channels are on the panda board
241 public final static int CHANNELS_PER_BOARD = 8;
243 // How many cubes per channel xc_PB is configured for
244 public final static int CUBES_PER_CHANNEL = 4;
246 // How many total pixels on each channel
247 public final static int PIXELS_PER_CHANNEL = Cube.POINTS_PER_CUBE * CUBES_PER_CHANNEL;
249 // How many total pixels on the whole board
250 public final static int PIXELS_PER_BOARD = PIXELS_PER_CHANNEL * CHANNELS_PER_BOARD;
253 final int[][] channelList = new int[CHANNELS_PER_BOARD][CUBES_PER_CHANNEL];
255 PandaMapping(String ip, int[][] rawChannelList) {
257 for (int chi = 0; chi < CHANNELS_PER_BOARD; ++chi) {
258 int[] cubes = (chi < rawChannelList.length) ? rawChannelList[chi] : new int[]{};
259 for (int cui = 0; cui < CUBES_PER_CHANNEL; ++cui) {
260 channelList[chi][cui] = (cui < cubes.length) ? cubes[cui] : 0;