private void orientToLine() {
		// d.msDelay(10000);

		if (corner) {
			while (localMap.getPosition().getCorridor(heading).getWeight() == 9999) {
				Sputnik.pilot.rotate(90);
				Sputnik.pilot.stop();
				heading = (heading - 1) % 4;
				if (heading < 0)
					heading = 3;
			}
		}

		else if (localMap.getPosition().getCorridor(heading).getWeight() == 9999) {
			Sputnik.pilot.rotate(90);
			Sputnik.pilot.stop();
			heading = (heading + 1) % 4;
		}

		// on T intersection, rotates to straight line
		else if (checkTSection()) {
			// if opposite side line is also weighted as 1, then robot is
			// already on the straight line.
			if (localMap.getPosition().getCorridor(((heading + 2) % 4))
					.getWeight() != 1) {
				Sputnik.pilot.rotate(90);
				heading = (heading + 1) % 4;
			}
		}

		if (localMap.getPosition().getCorridor((heading + 1) % 4).getWeight() == 1)
			sideCorner = (heading + 2) % 4;

		else
			sideCorner = Math.abs((heading + 2) % 4);
	} // end of orientToLine()