In late 2008/early 2009 I wrote the real-time controllers for the PR2. At first we only had the head of the PR2. I wrote a controller for the pan-tilt of the head and provided API calls for tracking or pointing the cameras at an object in space. As more PR2 parts came online, I wrote controller code for each component and then finally when the arm was fully assembled tuned everything together and we had a working robot.
I then worked on Milestone 2 which involved the PR2 alpha navigating autonomously around Willow Garage, opening 8 doors, and plugging into 9 standard wall outlets. The whole run took more than an hour to complete and we had been testing for days before that to make sure that it could do a full run without interruption or failure. Ironically one thing that almost killed everything during our official Milestone 2 run was the engineers logging into the robot to monitor the state machine progress and taking up CPU causing a huge slow down early in the test run.
About 8 months later I revisited the plugging in problem, the PR2 betas were available and we wanted to make plugging in robust and accurate. We took many of our lessons learned in Milestone 2 and went to work creating an all new state machine for plugging. The new code used the forearm cameras to detect the outlet and plug location and insert the plug in the outlet in a single attempt.