Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

https://index.ros.org/doc/ros2/Tutorials/Real-Time-Programming/

might have some info for you.

Every time you read sensor and have to move the data over a some kind of network (serial, ethernet, wifi, usb etc etc), you will experience network effects.

What data speeds will your sensors be generating?

It maybe a better idea to have a dedicated microprocessor doing this, rather than a general purpose computer. The MCU can just worry about collecting sensor data, running the algorithm and making adjustments in low latency in a tight loop.

once you start to transmit and receive data in and out of one MCU to another MCU, or to a computer (PI/Desktop) then it can get a little unpredictable with bandwidth, delay, jitter, latency etc etc ... although they can be optimised and set to realtime scheduling to reduce this....factor in the time it takes to run the balance algorithm in the worse case and get those correction out to motors/actuators....... the robot might have been tipped of balance too far, and unable to correct.

With a MCU your guaranteed that every cpu cycle is dedicated to a single task , or a few tasks, quite the opposite to a full computer , running a multitasking kernel , with many devices etc etc etc. The MCU doesn't have to worry about putting the data 'onto the wire', buffering the data etc etc etc...

Your data rates might be lower, and latencies high enough to tollerate this however. Or you maybe be able to some processing on the MCU's to lower data rates, and use high speed interconnection busses to decrease latency and jitter.