Page 60 - Designing Autonomous Mobile Robots : Inside the Mindo f an Intellegent Machine
P. 60

The Basics of Real-time Software (For Mere Mortals)

               Create a configuration definition

               If you want your program to be maintainable, then do not code constants into any part
               of it!  This means that parameters such as distance between the wheels of the robot,
               or the position and orientation of each sensor should be variables that are preset in
               operation. When something in the configuration changes, it will be a simple matter
               to correct all the calculations that use this measurement by simply changing the
               single variable.

               Never code anything specific to a configuration into your library.


               Test your library at every boundary
               One of the best places for software bugs to hide is near boundaries. Test all your
               routines with maximum and minimum input values in all combinations of signs and
               magnitudes. It is even useful to write a simple automatic test program which incre-
               ments the inputs linearly and graphs the output of each function. Mathematical
               glitches in these functions will be very difficult to diagnose once you start your system
               running.








































                                                        43
   55   56   57   58   59   60   61   62   63   64   65