ESP32 robotics monorepo with multiple ESP-IDF apps plus simulator tooling.
Current ESP-IDF apps:
legacy/micromouse-robot-maindevelopment/localization
Non-IDF tooling:
development/SA_Simulator
Project_A/
idfapp # repo-root multi-app wrapper
setup_env.sh # developer environment helper
development/
SA_Simulator/ # Python simulator, not an ESP-IDF app
components/ # shared components for development apps
localization/ # ESP-IDF app root
legacy/
micromouse-robot-main/ # ESP-IDF app root
tools/
idfwrap.sh # shared ESP-IDF wrapper
esp-idf/ # optional repo-local ESP-IDF checkout
This repo supports two clean setups:
- Use an existing ESP-IDF installation by exporting
IDF_PATH - Optional: keep a repo-local ESP-IDF checkout at
tools/esp-idf
If you already have a working ESP-IDF installation, use that first:
cd /path/to/Project_A
source /path/to/esp-idf/export.sh
./idfapp development/localization buildOr, if you prefer to prepare the shell through the repo helper:
cd /path/to/Project_A
export IDF_PATH=/path/to/esp-idf
source ./setup_env.shOptional repo-local setup:
cd /path/to/Project_A
git clone --branch v5.1.6 --recursive https://github.com/espressif/esp-idf.git tools/esp-idf
source ./setup_env.sh --installOn later shells:
cd /path/to/Project_A
source ./setup_env.shWhat setup_env.sh does:
- prefers your existing
$IDF_PATHif already exported - otherwise uses
tools/esp-idfif present - sources
export.sh - with
--install, runsinstall.sh esp32
If you only use ./idfapp, you do not need to source setup_env.sh every time. idfapp and tools/idfwrap.sh source ESP-IDF for you.
If your partner already has a local clone of this repo, recloning is not required.
Update the existing clone with:
cd /path/to/Project_A
git fetch origin
git pull --rebase origin mainIf there are local changes first:
- commit them before pulling, or
- stash them before pulling
Example:
git status
git stash push -u
git pull --rebase origin main
git stash popBuild the legacy app:
cd /path/to/Project_A
./idfapp legacy/micromouse-robot-main buildBuild the localization app:
cd /path/to/Project_A
./idfapp development/localization buildDirect idf.py still works if you want it:
cd /path/to/Project_A
source ./setup_env.sh
cd legacy/micromouse-robot-main
idf.py buildcd /path/to/Project_A
source ./setup_env.sh
cd development/localization
idf.py buildLocalization app:
./idfapp development/localization -p /dev/ttyUSB0 flash
./idfapp development/localization -p /dev/ttyUSB0 monitor
./idfapp development/localization -p /dev/ttyUSB0 flash monitorLegacy app:
./idfapp legacy/micromouse-robot-main -p /dev/ttyUSB0 flash
./idfapp legacy/micromouse-robot-main -p /dev/ttyUSB0 monitor
./idfapp legacy/micromouse-robot-main -p /dev/ttyUSB0 flash monitorTo build without hardware attached, just use build.
To inspect the generated flash arguments after a build:
sed -n '1,120p' development/localization/build/flash_project_args
sed -n '1,120p' legacy/micromouse-robot-main/build/flash_project_argsFor a future app under development/, follow the same pattern:
development/
measurement_prediction/
CMakeLists.txt
main/
CMakeLists.txt
main.cpp
sdkconfig.defaults # recommended
partitions.csv # optional
idf_component.yml # optional
Each app should usually have:
- top-level
CMakeLists.txt main/main/CMakeLists.txtsdkconfig.defaults
Per-app optional files:
sdkconfigpartitions.csvidf_component.ymlmanaged_components/(generated)build/(generated)
Share reusable code through development/components/, not by cross-including from one app’s main/ into another’s.
Good candidates for development/components/:
- shared interfaces
- reusable drivers
- generic runtime helpers
- algorithm libraries used by multiple apps
Keep app-local in each app’s main/:
app_main()- app wiring
- app-specific maps, mocks, and behavior
The repo includes a portable task file at .vscode/tasks.json.
Available tasks:
ESP-IDF: Build (app path)ESP-IDF: Fullclean (app path)ESP-IDF: Flash (app path)ESP-IDF: Monitor (app path)ESP-IDF: Flash Monitor (app path)
These tasks call ./idfapp, so they work from the repo root without hardcoded user paths.
The ESP-IDF extension UI is optional. Terminal workflows are the source of truth for this repo.
Local-only IDE files such as .vscode/settings.json and .vscode/c_cpp_properties.json are intentionally ignored and should stay developer-specific.
Commit:
idfappsetup_env.sh- root
README.md - app
CMakeLists.txt - app
sdkconfig.defaults - app
sdkconfigwhen you want stable app config checked in - app
partitions.csvwhen app-specific - app
idf_component.yml - app
dependencies.lock - shared components under
development/components/ .vscode/tasks.json
Ignore:
**/build/**/managed_components/- local
.vscodefiles other thantasks.json - Python virtual environments and caches
Missing ESP-IDF:
- export
IDF_PATH, or clone ESP-IDF intotools/esp-idf - then run
source ./setup_env.sh
./idfapp says the app path is invalid:
- use a path relative to repo root
- make sure the target directory contains
CMakeLists.txt
No serial port found:
ls -l /dev/ttyUSB* /dev/ttyACM* 2>/dev/null
dmesg | tail -n 50Want the repo-root workflow only:
- use
./idfapp <app-path> ... - no need to
cdinto each app