Receiving & Sending Messages

To ensure efficiency of message passing, RPI does the job of breaking up messages received, storing it into variables, and only send the required information to the destination device. Below shows an example illustration of how the message is received and sent to devices during exploration:

  1. Nexus Android initiate start of exploration
  2. RPI receives it and send to Arduino
  3. Arduino sends back sensor information to RPI
  4. RPI sends sensor information to PC (algorithm)
  5. After calculation, PC sends robot’s movement to RPI
  6. RPI sends robot’s movement to Arduino and updates Android with Robot’s position

Note: The process loops between step 3 and step 6 until PC sends a completion bit, indicating the end of exploration.

Sending Messages

Message sending thread is straight-forward.  When called upon, it will send the message passed to this thread to the respective devices.

Receiving Messages

Message receiving thread does most of the work for Raspberry Pi. When a message is received, Raspberry Pi:

  1. Split the message into variables according to the interface message format (See system analysis and design – interface message).
  2. Check status header to determine the current status of the robot (E.g. Terminated, Exploration, Fastest Path).
  3. Bind required information together for a particular device into one message string.
  4. Call the appropriate message sending the thread to send the message string to the correct device.