but I'm having trouble with getting the ping to go enough times per second to get the data to tell it to stop.
Perhaps you should put a timeout in the call to pulseIn(). You should also Serial.print() the time before and after the call to ping(), to see how long it is taking. (Obviously, the robot can't be running around loose while tethered to the PC.)
Failing to increase the frequency of the sensor, you could always slow down.