I like to use microcontrollers to take care of different aspects of a robot in real time (such as controlling motors and loads, reading sensors, etc.), while the robot intelligence is taken care of by a computer. This has a series of advantages, namely:
1. Each microcontroller can take care of the real time issues of reading sensors, shaft encoders, and other variables at a fast pace.
2. The computer requests the information on an interval basis and as needed.
3. The computer does not need to interrupt intelligent control to take care of mundane tasks such as those mentioned on item 1.
This is pretty much parallel processing, which is how our brain works. But how do we add controller boards to a computer? As you can see on the picture below, we wcan take advantage of the computer's serial port. It can be an RS-232 port (which are pretty much obsolete) or USB ports, which are very popular nowadays, plus the amount of them are practically infinite to the application at hand. There is of course a limit, but I can not imagine a robot that will ever close to such.

What I like to do is have each microcontroller coded to accept a series of bytes (I will from now on call a packet) which includes an instruction and data on how to perform said instruction. Per example, I could have a motor controller board coded to accept a command such that a particular motor speed is maintained and another command to stop the motor. I can have another controller board coded to accept commands such that a series of sensors are read. Why not put the motor controller and the sensor board together? It can be done, but if you have about a dozen of very simple MCU's with very simple tasks, you will get better performance than if you have a giant MCU with a ton of tasks to resolve.
The other advantage is that you can have multiple boards for a particular task. Say you need 15 sensors, but each board can only tackle 8 sensors. It is easier to add a second module than it is to redesign the entire application to take up more inputs. I think modularity is pretty advantageous and in this case, it usually proves as such.
In upcoming posts, I will explain how the serial communication works from a microcontroller stand point and what does the computer needs to do.