Tuesday, April 7, 2009

Communication protocol

In order for our transmission of instructions to be as effective, and so that our project may be subdivided into the user control side and the tank respond side a unified communication protocol must be established.

Earlier today we discussed various methods, but have settled on the following scheme:
  • Instructions may be of various lengths, to terminate an instruction a semicolon must be present. After a semicolon in a sequential string is reached the next character is the start of the next instruction.
  • All requests come from the user. This includes sending motor direction and speed to the tank, and requesting distance data. (The distance data is considered to be of a lower priority than updating the motors).
syntax
  • Location: ``R'' for `right'. ``L'' for `left'. ``F'' for front. ``B'' for `back'.
  • Component: ``M'' for `motor'. ``S'' for `sensor'.
  • Request: ``?'' for `request'.
  • Adjective: ``f'' for `forward'. ``r'' for `reverse'.
  • Decimal value: integers are allowed to represent decimal values.
semantics
  • Location must come first during instruction; unless it is a request, then both sensors are sent back.
  • Component always follows the location.
  • This may be followed by an adjective.
  • And can be followed by a decimal value.
  • Must end with semicolon;
Example

RMf255;

This reads as ``R''ight ``M''otor ``f''orward with pulse width at decimal 255.

No comments:

Post a Comment