Changes between Version 6 and Version 7 of PadawanPitfalls


Ignore:
Timestamp:
26.01.2017 14:58:11 (23 months ago)
Author:
tim
Comment:

Add another typical pitfall "I do not get any new data", had this conversation again today

Legend:

Unmodified
Added
Removed
Modified
  • PadawanPitfalls

    v6 v7  
    2323 Check the incoming component ID: 
    2424   If you receive messages for example using the [doxygen:FawkesNetworkClient FawkesNetworkClient] check the component ID for each and every incoming message. If you only look at the message ID it can happen that you receive a message with a message type you know, but for another component. This will lead to chaos and havoc because you interpret the message wrongly. Note that you shall check the component ID even if you only expect messages for one component. Output a warning or call aunt Tilda if you receive a message for an unexpected component ID. We call this defensive programming to eliminate problem because of other's failures before it bugs you. See the [source:trunk/src/tools/navigator_gui/navigator_gui.cpp navigator GUI] as an example. 
     25 
     26== !BlackBoard == 
     27 I do not get any new data: 
     28  The typical cause for this kind of problem that you have forgotten to add a {{{read()}}} call for the interfaces. For a typical interface the data exists three times, once in the writer, once in the blackboard, and once in the reader (this is you). To always have consistent data and to allow for choosing the point in time when to update it, the data is only updated on request. The writer needs to call {{{write()}}} to copy its version (that it may modify without influencing anyone else) to the blackboard. From there, readers can pull in the latest data by calling {{{read()}}}. This also holds true if you use a !BlackBoardListener to get notified about data updates, you still have to call {{{read()}}} yourself!