MicroROS Setup
Prerequisites
- Install ROS2
- Install VSCode
Install PlatformIO for VSCode:
- Install VSCode, if you haven’t already
sudo snap install code --classic # Assuming you are on Ubuntu- Install PlatformIO extension for VSCode by navigating to:
extensions (
ctrl+shift+x) > search “platformio ide” > Install OR,
code --install-extension platformio.platformio-ide- After Installing the extension,
Click on the PlatformIO button or clicking the home button on status bar or by searching “platfomio home” on command palette (
ctrl+shift+p)
Setting up PlatformIO Project
Resolve Dependencies
- Install the requirement dependencies mentioned here.
sudo apt install -y git cmake python3-pipCreate a New Project
Open VSCode
Initialise PIO for VSCode (Only for the first time) Click on the PlatformIO button present in the sidebar. That’s It!!
For the first time PIO will take its time to download binaries and initialise everything.Navigate to PlatformIo Home by, Clicking on the PlatformIO button or, clicking the home button on status bar or, by searching “platfomio home” on command palette (
ctrl+shift+p)Click on
Create Project- Give a proper name
- Select board according to your model (i.e. DOIT ESP Devkit V1)
- Keep the framework to “Arduino”
- Save it in a recognisable place (uncheck the
locatonoption to turn off default location).
Note: To open the project later you only have to open this specific older where the
.inifile is stored.
Configure .ini file
The {project}.ini file should already be populated with some values:
; PlatformIO Project Configuration File
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduinoPlease Note: This is the configuration for basic ESP32 Wroom Modeule, and most likely will not work for any other models. If you are using ESP32-S3, navigate to Troubleshooting section to check if anything helps!
Add these lines onto this file:
board_microros_transport = serial
board_microros_distro = jazzy
lib_deps =
https://github.com/micro-ROS/micro_ros_platformioboard_microros_* are optional and should be changed based on your preferred value (all possible values can be found here.)
Upon saving this file pltformIO will download all the pkgs and will build everything in the background, Don’t panic and Do Not close the Application.
Basic setup for the project is done, Now do the code in main.cpp under /src folder.