public static void main(String[] args) throws IOException {
		
		/*
		 * bluetooth initialization
		 */

		bluetoothInit();

		// **************************************************************
/*		// set zone coordinates manually for testing
 * 
		Constants.goodZone = new int[] { 5 * Constants.SQUARE_LENGTH,
				5 * Constants.SQUARE_LENGTH, 7 * Constants.SQUARE_LENGTH,
				6 * Constants.SQUARE_LENGTH };

		Constants.badZone = new int[] { 0 * Constants.SQUARE_LENGTH,
				4 * Constants.SQUARE_LENGTH, 1 * Constants.SQUARE_LENGTH,
				6 * Constants.SQUARE_LENGTH };
*/
		// ***************************************************************

		/*
		 * hardware initialization
		 */

		// initialize block pick up first since it takes the longest
		LCD.clear();
		LCD.drawString("Connected to Slave", 0, 0);
		BlockPickUp.init();
		BlockPickUp.openClamp();
		BlockPickUp.raiseTo(BlockPickUp.IDLE);
		LCD.clear();

		// set up robot motors
		NXTRegulatedMotor leftMotor = new NXTRegulatedMotor(
				Constants.leftMotorPort);
		NXTRegulatedMotor rightMotor = new NXTRegulatedMotor(
				Constants.rightMotorPort);

		// odometry
		Odometer odo = new Odometer(leftMotor, rightMotor);

		// navigation
		Navigation nav = new Navigation(odo);

		// light sensors
		ColorSensor backS = new ColorSensor(Constants.backSensorPort);
		ColorSensor frontS = new ColorSensor(Constants.frontLightSensorPort);
		
		// light poller
		LightPoller back = new LightPoller(backS, Constants.LIGHT_SAMPLE,
				Constants.M_PERIOD);

		// two front us sensors
		UltrasonicSensor leftS = new UltrasonicSensor(Constants.leftSensorPort);
		UltrasonicSensor rightS = new UltrasonicSensor(
				Constants.rightSensorPort);

		// us pollers
		USPoller left = new USPoller(leftS, Constants.US_SAMPLE,
				Constants.M_PERIOD);
		USPoller right = new USPoller(rightS, Constants.US_SAMPLE,
				Constants.M_PERIOD);

		// odometry correction
		OdometryCorrection odoCorr = new OdometryCorrection(odo, back);
		

		/*
		 * US LOCALIZATION
		 */
				
		  //set up us localization 
		USLocalizer usLoc = new USLocalizer(odo,
		  nav, left, USLocalizer.LocalizationType.RISING_EDGE);
		  
		  // do us localization
		usLoc.doLocalization();
		
		// take small break
		try{
			Thread.sleep(100);
		}catch(Exception e){};
				
		/*
		 * LIGHT LOCALIZATION
		 */
		
		  // set up light localization
		LightLocalizer lightLoc = new
		  LightLocalizer(odo, nav, back);
		  
		  // do light localization
		lightLoc.doLocalization();
		 		
		/*
		 * main program loop
		 */

		// start odometry correction
		try {
			odoCorr.start();
		} catch (Exception e) {
			LCD.clear();
			LCD.drawString("problem", 0, 0);
		}

		// set robot's destination
		Constants.robotDest[0] = Constants.goodZone[0]+15;
		Constants.robotDest[1] = Constants.goodZone[1]+15;

		// initialize boolean
		String status = "";

		// travel to construction zone while detecting objects
		do {

			// turn towards destination point
			nav.turnTowards(Constants.robotDest[0], Constants.robotDest[1]);

			// move forward with goFwdUS
			status = nav.goFwdCaution(10, Navigation.FAST, left, right);

			// check various scenarios

			if (status.equals("obstacle")) {
				
				// identify object
				int code = identify(odo,nav,left,right,frontS,2000);
				
				// act upon result of identification
				switch(code){
				case 1:
					avoidObstacle(odo,nav,frontS, left,right);
					break;
				case 2:
					getFoam(nav);
					break;
				case 3:
					//do nothing
					break;
				}	

				// execute if robot has reached its destination
			} else if (status.equals("destination")) {

				// go to center
				Constants.robotDest[0] = 5*Constants.SQUARE_LENGTH;
				Constants.robotDest[1] = 5*Constants.SQUARE_LENGTH;
				
				// execute if too close to enemy zone
			} else if (status.equals("enemy")) {

				// avoid enemy's zone	
				avoidEnemyZone();
			}

			// no obstacle encountered. repeat until destination reached

		} while (blocks<10);

		/*
		 * end program
		 */
		Sound.beepSequence();
		exit();
	}