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

Communications and Control

                                                 9
               It is mathematically demonstrable  that this form of checking is much less likely to
               be subject to error canceling.
               The ratio of non-data to actual data in a message protocol is called the overhead. Ge-
               nerally, longer checks are more reliable, but tend to increase the overhead. Error
               correcting codes take many more bytes than a simple 16-bit CRC, which in turn is
               better than a checksum. The type and extent of error checking should match the
               nature of the medium. There is no sense in increasing message lengths 10% to
               correct errors that happen only 1% of the time. In such cases it is much easier to
               retransmit the message.


               Temporal integrity
               A more common and less anticipated problem is that of temporal integrity. This
               problem can take on many forms, but the most common is when we need data
               that represents a snapshot in time. To understand how important this can become,
               consider that we request the position of the robot.
               First, consider the case where the X and Y position are constantly being updated by
               dead reckoning as the result of interrupts from an encoder on the drive system. Ser-
               vicing the interrupts from this encoder cannot be delayed without the danger of
               missing interrupts, so it has been given the highest interrupt priority. This is in fact
               usually the case.
               Now assume the following scenario. The hexadecimal value of the X position is re-
               presented by the 32-bit value consisting of two words, 0000h and FFFFh, at the
               moment our position request is received. The communications program begins
               sending the requested value by sending the high byte of 0000h first. At that moment
               an encoder interrupt breaks in and increments the X position by one, to 0001h and
               0000h. After this interruption, our communications program resumes and sends the
               low word as 0000h. We receive a valid message indicating that the X position is 0000h,
               0000h, an error of 32,768!
               We cannot escape this problem by simply making the communications interrupt
               have a higher priority than the encoder interrupt. If we do this, we may interrupt
               the dead reckoning calculation while it is in a roll over or roll under condition,
               resulting in the same type of error as just discussed.



               9  The author makes no claim to be able to demonstrate this fact, but believes those who claim they
                 can!



                                                       101
   113   114   115   116   117   118   119   120   121   122   123