Autonomoy Computer Software Setup
Let's get started making some software!
Installation
The software setup for the autonomy computer will assume that host operating system is Ubuntu 22.04.5 LTS and the required software has been installed according to their respective documents. The full list of software applications required and their installation procedures are listed below:
- ROS2 Humble
- Visual Studio Code
- PlatformIO IDE for VSCode
- Docker Engine
- micro-ROS (only do the "Installing ROS2 and the micro-ROS build system" and "Creating the micro-ROS agent" sections)
With everything installed, we need to make a slight configuration change to Docker to make it easier to use. With a fresh installation, Docker requires a root user (sudo) to function. If your device policies allow it, follow the Docker documentation to manage Docker as a non-root user.
Cloning the Repository
With that completed, we can clone the latest project workspace to a project directory on the machine.
git clone https://github.com/Legohead259/ESP32-P4-Test
The project (v1.0.0-rc1) has the following directory structure:
ESP32-P4-Test/
├── .git/
│ ├── COMMIT_EDITMSG
│ ├── FETCH_HEAD
│ ├── HEAD
│ ├── ORIG_HEAD
│ ├── branches/
│ ├── config
│ ├── description
│ ├── hooks/
│ ├── index
│ ├── info/
│ ├── logs/
│ ├── objects/
│ ├── packed-refs
│ └── refs/
├── .gitignore
├── apps/
│ ├── elegant_ota/
│ ├── ethernet_ota/
│ ├── ethernet_test/
│ ├── hello_world/
│ └── micro_ros_test/
├── boards/
│ └── esp32_p4.json
├── config/
│ └── uros_colcon.meta
├── docs/
│ ├── main.py
│ ├── mkdocs.yml
│ ├── site/
│ └── source/
├── envs/
│ ├── common.ini
│ ├── controller_1.ini
│ ├── controller_2.ini
│ ├── controller_3.ini
│ ├── controller_4.ini
│ ├── ethernet_ota_followup.ini
│ ├── ethernet_ota_initial.ini
│ ├── ethernet_test.ini
│ └── micro_ros_test.ini
├── include/
├── lib/
│ ├── README
│ ├── controller/
│ ├── micro_ros_controller/
│ ├── micro_ros_pubsub/
│ └── uros/
├── platformio.ini
├── src/
├── test/
└── variants/
└── esp32_p4/
PlatformIO Environment File Interactions
Breaking down this structure, we can start with the platformio.ini file with is the main configuration file for the PlatformIO project workspace.
It imports the files located in the env/
directory which in turn cross-reference each other and build the configurations for each controller programming environment.
The interactions between the environmental files and the rest of the application code is documented in the chart below.
Note that for brevity, only "controller_1" is shown in the chart.
The interactions are the same for the other controllers.
The blue boxes, "OTA Initial", "OTA Followup", and "MicroROS Test" denote the actual PlatformIO environments that are uploaded the microcontrollers.
These will be explore more in-depth shortly.
The green "ESP32-P4 Base" component leverages the Arduino framework's capability to define custom board variants for a project. This will allow us to define custom pin variables in the future depending on what is connected to the microcontroller. For the moment, we have to source the ESP32-P4 build framework from the PIOArduino fork of PlatformIO since official support has not been rolled out at time of writing. Within the "Common" configuration, we can also define environmental variables that will be shared by all the microcontrollers like the IP address domain. From the ESP32-P4 base, we can build out the "Controller Base" definition which will include all of the build flags like the IP domain, controller name, ROS domain ID. From the "Controller Base" definition, we can define an extended definition for "Controller OTA" that contains the information like the upload protocol, IP address, port, and login information to enable OTA programming.