Page 195 - Anatomy of a Robot
P. 195

07_200256_CH07/Bergren  4/10/03  3:30 PM  Page 180
                             180 CHAPTER SEVEN
                             Pipelines for Speed
                             In Chapter 3 on computer hardware, we discussed using pipelines to speed up process-
                             ing. The specific example used was “If A, then B, else C.” In a pipeline optimized for
                             speed, A, B, and C are put into the pipeline simultaneously and are computed simulta-
                             neously. Either B or C comes out of the pipeline (already precomputed) based on the
                             value of A. This is the way a pipeline optimized for speed would behave. It burns energy
                             as fast as possible.


                             Pipelines for Power

                             As the processor goes about executing the instructions inside the pipeline, it sometimes
                             notices that some of the instructions don’t have to be executed. Power can be saved if
                             unneeded instructions are not executed. Let’s revisit our example program, “If A, then
                             B, else C.” In a pipeline optimized for power, A is put in the pipeline and computed
                             first.Based  on  the  value  of  A,  either  B  or  C  is  put  into  the  pipeline  for  computation.
                             This method is clearly slower but saves the energy that might be used in unneeded
                             computations.
                               We just looked at how a pipeline in a processor can be optimized for energy conser-
                             vation. The processor has a pipeline that handles instructions that are executed in a serial
                             manner. In the same manner, we can construct a pipeline of tasks that the robot executes
                             in a serial manner. If we buffer up these tasks instead of executing them immediately,
                             we may discover tasks that do not have to be executed. In a real operation, various com-
                             mands may arise that just don’t make sense. One set of commands might look like this:
                             “Go to from Point B to Point C and pick up the Rock C. Bring it back to Point B and
                             examine Fact A. If A is true, drop Rock C and pick up Rock B.”
                               A properly constructed robot task pipeline would look at this series of commands and
                             alter it to the following: “Examine Fact A. If A is true, pick up Rock B, or else go to
                             Point C and pick up Rock C.”
                               A very well constructed robot task pipeline would question whether the robot should
                             do any of this work. If neither the information about fact A nor the rocks are needed in
                             subsequent tasks, all this work can be avoided. If a subsequent robot task requires Rock
                             B or Rock C, then the pipelined tasks can be executed. Further, the robot task pipeline
                             can determine if the robot really needs to return to Point B at all.
                               Most people, while cleaning house, will find lots of reasons to go upstairs and down-
                             stairs to achieve specific goals. If no emergencies occur, it makes sense to pipeline all
                             the tasks for a while. Go upstairs for the upstairs tasks and downstairs for the down-
                             stairs tasks. It’s easy to tell that this saves energy. If the robot can afford to hesitate for
                             a while, it can pipeline its tasks and probably save some energy.
   190   191   192   193   194   195   196   197   198   199   200