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:
- Nexus Android initiate start of exploration
- RPI receives it and send to Arduino
- Arduino sends back sensor information to RPI
- RPI sends sensor information to PC (algorithm)
- After calculation, PC sends robot’s movement to RPI
- 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:
- Split the message into variables according to the interface message format (See system analysis and design – interface message).
- Check status header to determine the current status of the robot (E.g. Terminated, Exploration, Fastest Path).
- Bind required information together for a particular device into one message string.
- Call the appropriate message sending the thread to send the message string to the correct device.