Use select and ioct to check if the needed bytes are available instead of polling.
Read only one message from uart at a time to be sure to no corrupt the next one.
Fix most of the synchronization issue that leads to corrupted read messages.
Reduce CPU usage and latency. Call to usleep(10000) in the main loop can be remove
without any synchronization issues and corrupted message.
More measure per second can be retrived from BrickPi.
Use select and ioct to check if the needed bytes are available instead of polling. Read only one message from uart at a time to be sure to no corrupt the next one.
Fix most of the synchronization issue that leads to corrupted read messages. Reduce CPU usage and latency. Call to usleep(10000) in the main loop can be remove without any synchronization issues and corrupted message. More measure per second can be retrived from BrickPi.