My knowledge is limited, as I use RobotC, but I believe that the calibration routine must be made manually. I suggest that you just use a file to put the intensity from two different (predetermined) distances from the beacon. You can then use those readings in teleop (assuming the calibration was done in autonomous).
The best way to get the readings, in my opinion, would be to just slam in to the lower goal, get a reading, then go backward in to the wall, and get a reading. If you don't want to do this, you could even just get a reading while the robot is waiting to start autonomous. It would be a bit less accurate (read: one datapoint instead of two), but would still work.
For calculating distances, assuming that intensity/distance graph is linear, your equation is:
intensity[calibration]/dist[calibration]=intensity[current]/dist[current].
From this, you can do:
dist[current] = dist[calibration] * (intensity[current] / intensity[calibration])
If you did more than one calibration measurement, get an average of all of the readings and store that in the [calibration] variables.
Best of luck.
