static void getWall (Position2DInterface posi, RangerInterface rngi) {
        // get all SONAR values and perform the necessary adjustments
        getSonars (rngi);
        
        // if the robot is in open space, go ahead until it "sees" the wall
        while ((leftSide > MAX_WALL_THRESHOLD) && 
                (frontSide > MAX_WALL_THRESHOLD)) {
            posi.setSpeed (0.6, 0);
            try { Thread.sleep (100); } catch (Exception e) { }
            getSonars (rngi);
        }
        while(!posi.isDataReady());
        startX = posi.getX();
        startY = posi.getY();
        startTime = System.nanoTime();
        double previousLeftSide = sonarValues[4];
        
        // rotate until we get a smaller value in sonar 0 
        while (sonarValues[4] >1) {
            previousLeftSide = sonarValues[4];
            
            // rotate more if we're almost bumping in front
             if (Math.min (leftSide, frontSide) == frontSide){
                if(sonarValues[8] >1)
                yawSpeed = -DEF_YAW_SPEED * 5;
                else
                        turnR180();
            }
            else
                yawSpeed = -DEF_YAW_SPEED;
            
            // Move the robot
            posi.setSpeed (-0.05, yawSpeed);
            try { Thread.sleep (100); } catch (Exception e) { }
            
            getSonars (rngi);
        }
        posi.setSpeed (0, 0);
    }