Raw sensor question? What is raw sensor and what is on port 3?

Is this code only for robot to go completely straight without errors?
PID stands for Proportional-Integral-Derivative - which is an industry standard way of controlling processes and minimizing the deviation from a setpoint. It assigns 3 factors (K_p, K_i and K_d) to three calculated variables all based on the measured process, in this case the deviation from the ideal sensor value coming from the color sensor connected to port 3.

Those three calculated variables contain the proportional deviation (i.e. just the difference between the ideal value and the measured value), the integral of the error (sort of like the sum of all errors over time) and the derivate (the change in the error value over time). The final adjustment the motors need to do is calculated based on those three deviations (P, I and D) to get to a "turn" amount, which is then passed on to the motor to execute.

You can read all about the PID control implemented here in the link in the left top corner of your diagram, which is this: http://inpharmix.com/jps/PID_Controller_For_Lego_Mindstorms_Robots.html. It actually explains the concept pretty well and is relatively easy to follow, as it is targeted towards FLL students (i.e. 9-14 year old kids).

The author of the article also explains why he uses the sensor in RAW mode:


  Using raw light values (0 to 1023 scale), instead of uncalibrated
  light values, might increase the dynamic range of the light sensors.
  For our example light values black would be 400 and white 500. The
  offset would be 450 with a range of +/-50 instead of +/-5. The raw
  light values is available from a data port on the light sensor block.
  If you calibrate your light sensor under your lighting conditions and
  use the calibrated values then white will be about 100 and black will
  be about 0. This is another way to increase the proportional range of
  the light sensor. In both the raw and calibrated modes the light
  values probably are not accurate in the last digit but hopefully the
  values are somewhat more precise than using a light value range of
  just 10 or so.


In short: the range of values coming from the default light sensor is more coarse (0-100) than when using the sensor in raw mode (0-1023), so you get better control over the motor output as there are more light levels to play with.