OpenAgricultureFoundation / openag_python

**DEPRECATED** python code - it now lives in openag_brain/.../openag_lib
GNU General Public License v3.0
20 stars 12 forks source link

Use status codes instead of status messages #16

Closed LeonChambers closed 7 years ago

LeonChambers commented 7 years ago

The current implementation requires modules to define a status_level basically indicating whether or not they are working properly and a status_msg with useful debugging information in the case that something is wrong. Operating with the ROS plugin in with real hardware with a significant number of sensors, we have found it too expensive to transmit status messages for every module, so we would like a way to convey the same information in a more compact form for transmission from the Arduino to the Raspberry Pi.

I propose we add an additional field status_code which will be an 8-bit integer value with some module-specific meaning. A code of 0 should always mean that the module is operating normally, and there should be a lookup table in the module.json file with the meaning of all other error codes. This would render the status_msg field obsolete, and we could probably remove it later once all of the modules have been modified to use status_codes instead.

For the ROS plugin, this means we will have to create a new message type that is a lighter version of DiagnosticStatus to publish from the Arduino and a software module that can convert from the new message type back to DiagnosticStatus messages for integration with the ROS diagnostics stack.

If we deprecate the status_msg field, the CSV plugin will have to be rewritten as well. For ease of debugging, it seems very useful for the error messages to be transmitted directly on the serial port instead of error codes. Thus, we may have the plugin generate Arduino code that converts the error codes to messages on the Arduino before that information is sent over.

LeonChambers commented 7 years ago

Resolved in #17