Hi,
You say please explain this program but you need to be more specific. What is it that doesn't work? Does the PIC run? Does it have power? Do you get the debug message? Do you get the reading from the ADC? Does the robot run but will not balance?

You say that you are new to PBP, and that's OK, we've all been there, but if you need us to explain the whole program you are aiming to high for a beginner. If that's the case start with the standard LED blinking and hello world projects, then go from there.

If you have specific qestions, don't hesitate.

/Henrik Olsson.