Index: trunk/code/projects/colonet/ColonetGUI/Colonet.java
===================================================================
--- trunk/code/projects/colonet/ColonetGUI/Colonet.java	(revision 469)
+++ trunk/code/projects/colonet/ColonetGUI/Colonet.java	(revision 470)
@@ -175,7 +175,7 @@
 		txtInfo = new JTextArea();
 		txtInfo.setBorder(BorderFactory.createTitledBorder("Info"));
 		txtInfo.setEditable(false);
-		txtHost = new JTextField("localhost");
+		txtHost = new JTextField(this.getDocumentBase().getHost());
 		txtHost.setBorder(BorderFactory.createTitledBorder("Host"));
 		txtPort = new JTextField("10123");
 		txtPort.setBorder(BorderFactory.createTitledBorder("Port"));
@@ -189,7 +189,7 @@
 		panelConnect.add(txtHost);
 		panelConnect.add(txtPort);
 		panelConnect.add(btnConnect);
-		panelConnect.add(btnGetXBeeIDs);
+		//panelConnect.add(btnGetXBeeIDs);
 		panelServerInterface = new JPanel();
 		panelServerInterface.setLayout(new GridLayout(2,1));
 		panelServerInterface.add(panelConnect);
@@ -437,7 +437,7 @@
 			return;
 		btnConnect.setEnabled(false);
 		lblConnectionStatus.setText("Status: Connected");
-		paintThread.start();
+		//paintThread.start();
 		dataUpdater.start();
 		webcamLoader.start();
 	}
@@ -537,8 +537,7 @@
 			int id = Integer.parseInt(str[i]);
 			int x = Integer.parseInt(str[i+1]);
 			int y = Integer.parseInt(str[i+2]);
-			RobotIcon newIcon = new RobotIcon(x, y);
-			newIcon.id = id;
+			RobotIcon newIcon = new RobotIcon(id, x, y);
 			newList.add(newIcon);
 		}
 		
@@ -564,12 +563,15 @@
 	    if (setWaypoint && setWaypointID  >= 0) {
 	        setWaypoint = false;
 	        panelWebcam.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
-	        if (selectedBot < 0 || robotIcons.get(selectedBot).id < 0) 
+	        if (selectedBot < 0)
 	            return;
 	        
 	        RobotIcon r = robotIcons.get(selectedBot);
 	        r.destx = e.getX();
 	        r.desty = e.getY();
+	        
+	        csi.sendAbsoluteMove(r.id, r.destx, r.desty);
+	        
 	        return;
 	    }
 	    
@@ -579,8 +581,6 @@
 	        panelWebcam.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
 	        for (int i = 0; i < robotIcons.size(); i++) {
 	            RobotIcon r = robotIcons.get(i);
-	            if (r.id < 0)
-	                continue;
 	            r.destx = e.getX();
 	            r.desty = e.getY();
 	        }
@@ -592,10 +592,7 @@
 		    RobotIcon r = robotIcons.get(i);
 		    if (r.contains(e.getX(), e.getY())) {
 		        selectedBot = i;
-		        if (r.id < 0)
-		            lblSelected.setText("Unidentified");
-		        else
-		            lblSelected.setText(" " + r.id);
+		        lblSelected.setText(" " + r.id);
 		    }
 		}
 		repaint();
@@ -906,14 +903,12 @@
 				try {
 					//request more data
 					if (csi != null && csi.isReady()) {
-						//csi.sendSensorDataRequest();
+                        csi.sendPositionRequest();
 						csi.sendXBeeIDRequest();
 						if (cmbRobotNum.getSelectedIndex() > 0) {
 						    String sel = (String) cmbRobotNum.getSelectedItem();
 						    int num = Integer.parseInt(sel);
 							csi.sendBatteryRequest(num);
-						} else {
-							csi.sendBatteryRequest(200);
 						}
 					}
 					Thread.sleep(DATAUPDATER_DELAY);
@@ -970,59 +965,52 @@
 			img = newimg;
 		}
 		
-		public void setPoints (Point [] newpoints) {
-			// test code -- need to remove later
-			if (newpoints == null) {
-				Point [] p = new Point [3];
-				p[0] = new Point(200,200);
-				p[1] = new Point(100,100);
-				p[2] = new Point(400,300);
-				setPoints(p);
+				
+		public void paint (Graphics g) {
+			
+			if (img == null)
 				return;
-			}
+			// Place the image on the screen, inside the panel
 			
-			for (int i = 0; i < newpoints.length; i++) {
-				Point p = newpoints[i];
-				boolean found = false;
-				for (int j = 0; j < robotIcons.size(); j++) {
-					RobotIcon r = robotIcons.get(j);
-					if (r.isClose(p.x, p.y)) {
-						r.move(p.x, p.y);
-						found = true;
-					}
-				}
-				if (!found) {
-					RobotIcon r = new RobotIcon(p.x, p.y);
-					robotIcons.add(r);
-				}
+			int maxWidth = getWidth() - 2*BORDER;
+			int maxHeight = getHeight() - 2*BORDER;
+			double widthRatio = 1.0 * maxWidth / img.getWidth();
+			double heightRatio = 1.0 * maxHeight / img.getHeight();
+			int newWidth = 0;
+			int newHeight = 0;
+			int x = 0;
+			int y = 0;
+			
+			if (widthRatio > heightRatio) {  //height is the limiting factor
+			    newHeight = maxHeight;
+			    newWidth = img.getWidth() * maxHeight / img.getHeight();
+			    y = BORDER;
+			    x = (maxWidth - newWidth) / 2 + BORDER;
+			} else {  //width is the limiting factor
+			    newWidth = maxWidth;
+			    newHeight = img.getHeight() * maxWidth / img.getWidth();
+			    x = BORDER;
+			    y = (maxHeight - newHeight) / 2 + BORDER;
 			}
 			
-		}
-		
-		public synchronized void paint (Graphics g) {
+			Image imgScaled = img.getScaledInstance(newWidth, newHeight, Image.SCALE_FAST);
+			g.drawImage(imgScaled, x, y, this);
 			
-			if (img == null)
-				return;
-			// Place the image on the screen, inside the panel
-			g.drawImage(img, 
-						BORDER,	//dx1 - the x coordinate of the first corner of the destination rectangle.
-						BORDER,	//dy1 - the y coordinate of the first corner of the destination rectangle.
-						this.getWidth() - BORDER, 	//dx2 - the x coordinate of the second corner of the destination rectangle.
-						this.getHeight() - BORDER,	//dy2 - the y coordinate of the second corner of the destination rectangle.
-						0,	//sx1 - the x coordinate of the first corner of the source rectangle.
-						0,	//sy1 - the y coordinate of the first corner of the source rectangle.
-						image.getWidth(),	//sx2 - the x coordinate of the second corner of the source rectangle.
-						image.getHeight(),	//sy2 - the y coordinate of the second corner of the source rectangle.
-						null	//observer - object to be notified as more of the image is scaled and converted.
-						);
 						
 			// Draw Identifiers
 			if (robotIcons == null)
 				return;
+			
 			((Graphics2D)g).setStroke(new BasicStroke(2));
 			for (int i = 0; i < robotIcons.size(); i++) {
 				RobotIcon r = robotIcons.get(i);
 				g.setColor(r.color);
+				if (widthRatio > heightRatio) {
+				    
+				
+				} else {
+				    
+				}
 				g.drawOval(r.x-RADIUS, r.y-RADIUS, 2*r.RADIUS, 2*r.RADIUS);
 				// If the robot has a destination, draw the vector
 				if (r.destx >= 0) {
@@ -1047,7 +1035,7 @@
 	*/
 	class WebcamLoader extends Thread 
 	{
-		final int WEBCAMLOADER_DELAY = 200;
+		final int WEBCAMLOADER_DELAY = 400;
 		final String IMAGE_PATH = "http://roboclub9.frc.ri.cmu.edu/colonet.jpg";
 				
 		URL imagePath;
@@ -1068,7 +1056,7 @@
 			
 		}
 		
-		public synchronized void run ()
+		public void run ()
 		{
 			while (true) {
 				try {
@@ -1098,32 +1086,6 @@
 	}
 	
 	/*
-	*	PositionsLoader class
-	*	Handles the loading of the robot positions as seen by the vision technology.
-	*/
-	class PositionsLoader extends Thread 
-	{
-	
-		final int POSITIONSLOADER_DELAY = 600;
-	
-		public PositionsLoader () {
-			super("PositionsLoader");
-		}
-		
-		public void run () {
-			while (true) {
-				try {
-					Thread.sleep(POSITIONSLOADER_DELAY);
-					if (csi != null)
-						csi.sendPositionRequest();
-				} catch (InterruptedException e) {
-				}
-			}
-		}
-	
-	}
-	
-	/*
 	*  RobotIcon class
 	*  Provides a means for graphically representing and keeping track of webcam bots.
 	*/
@@ -1136,11 +1098,11 @@
 		public int id;
 		public Color color;
 		
-		public RobotIcon (int x, int y) {
-			this.id = -1;
+		public RobotIcon (int id, int x, int y) {
 			this.color = Color.RED;
 			this.x = x;
 			this.y = y;
+			this.id = id;
 			this.destx = -1;
 			this.desty = -1;
 		}
Index: trunk/code/projects/colonet/ColonetGUI/ColonetServerInterface.java
===================================================================
--- trunk/code/projects/colonet/ColonetGUI/ColonetServerInterface.java	(revision 469)
+++ trunk/code/projects/colonet/ColonetGUI/ColonetServerInterface.java	(revision 470)
@@ -68,6 +68,7 @@
 	public static final String GLOBAL_DEST = "200";
 	public static final String CLIENT_REQUEST_ROBOT_POSITIONS = "86";
 	public static final String CLIENT_ASSIGN_ROBOT_ID = "87";
+	public static final String MOVE_TO_ABSOLUTE_POSITION = "83"; //0x53
 	
 	//Queue instructions
 	public static final String COLONET_QUEUE = "100";
@@ -271,11 +272,12 @@
 		String packet = "";
 		packet += ColonetServerInterface.SEND_TO_ROBOT;
 		if (robotNumber != null)
-			packet += " " + robotNumber;
+			packet += " " + 7;  //robotNumber;
 		packet += " " + ColonetServerInterface.COLONET_COMMAND;
 		packet += " " + s;  //add  the command code here
 		packet += "\n";
 		sendString(packet);
+		txtMatrix.append("S:" + packet);
 	}
 	
 	/**
@@ -359,8 +361,14 @@
 		sendString(packet);
 		txtMatrix.append("ID " + oldID + " => " + newID + "\n");
 	}
-
 	
+	/** 
+	* Order a robot to move to an absolute coordinate point.
+	*/
+	public void sendAbsoluteMove (int id, int x, int y) {
+	    sendData(MOVE_TO_ABSOLUTE_POSITION + " " + x + " " + y, "" + id);
+	}
+	
 	/*
 	*	Queue management
 	*/
@@ -449,7 +457,7 @@
 	 * @param text Text to display
 	 */
 	public void msg (String text) {
-		JOptionPane.showMessageDialog(null, text, "Colonet", JOptionPane.INFORMATION_MESSAGE);
+		JOptionPane.showMessageDialog(colonet, text, "Colonet", JOptionPane.INFORMATION_MESSAGE);
 	}
 	
 	/**
@@ -457,7 +465,7 @@
 	 * @param text Text to display
 	 */
 	public void warn (String text) {
-		JOptionPane.showMessageDialog(null, text, "Colonet", JOptionPane.WARNING_MESSAGE);
+		JOptionPane.showMessageDialog(colonet, text, "Colonet", JOptionPane.WARNING_MESSAGE);
 	}
 	
 	/**
@@ -465,7 +473,7 @@
 	 * @param text Text to display
 	 */
 	public void err (String text) {
-		JOptionPane.showMessageDialog(null, text, "Colonet", JOptionPane.ERROR_MESSAGE);
+		JOptionPane.showMessageDialog(colonet, text, "Colonet", JOptionPane.ERROR_MESSAGE);
 	}
 	
 		
@@ -521,7 +529,7 @@
 				colonet.parsePositions(line);
 			// Unknown type
 			else
-				System.out.println("Got data:" + line);
+				txtMatrix.setText("Got unknown data: " + line + "\n");
 				
 		}
 
