Planning the code for the robot
We started planning code in layers in Chapter 2, Exploring Robot Building Blocks – Code and Electronics, and then explored this further in Chapter 7, Drive and Turn – Moving Motors with Python under the Robot Object section.
Let's recall how we planned our code structure with layers.
System layers
The general idea is to create layers of code in the system, as shown in the following diagram:
As Figure 19.3 shows, there are some suggested layers, as follows:
- At the bottom of the stack, Vendor Libraries. These, as the name implies, usually come from the hardware supplier, third parties, or a community. These are things such as the
gpiozero
library we have been using or the various Arduino libraries for that ecosystem. This layer may include I/O control, bus layers, and network stacks. - The next layer is Libraries and Middleware. This software...