understanding amp check code

Hi,
I was reading over this instructable:http://www.instructables.com/id/Tankbot-Internet-Controlled-Tank-Robot/step4/Tank-Load-Code/
and came across this code: http://www.instructables.com/files/orig/FLU/K0YM/H0K52XTJ/FLUK0YMH0K52XTJ.ino

I don't quite understand how he is measure the amount of current the motors are pulling. The code is below, but I don't understand how it is working, nor do I understand what sensA and sensB would be connected to. Can someone please clarify?

void ampCheck() { //Check to see how much power we are pulling, shut down if we pull more than 2A
  ampA=0;
  ampB=0;
  for (int i=0; i < 25; i++) {
    ampA=ampA + analogRead(sensA);
    ampB=ampB + analogRead(sensB);
    delay(5);
  }
  ampA=(ampA/25);
  ampB=(ampB/25);
  if (ampA > 1000 || ampB > 1000) {
    analogWrite(motorA, 0);
    analogWrite(motorB, 0);
    delay(1000);
  }
}

It's using the Arduino motor shield - http://arduino.cc/en/Main/ArduinoMotorShieldR3. It provides current sensing output.

Why have ampA and ampB both got global scope?

Oh wow, I had assumed it was in the shield and had looked, but I guess I was looking at the wrong motor shield.
Any idea on how I could do something similar for my arbitary high speed/amp/voltage motor? I'd love to get a reading of how much current is being pulled.

If you look at the schematic, there's a couple of 150mOhm resistors (R1 & R2).