ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

micro-ROS porting to ESP32

The micro-ROS team is glad to announce that the pool of boards officially supported by the project has widened! The ESP32 MCU is now part of the family. ESP32 is a series of low-cost, low-power microcontrollers with integrated Wi-Fi and dual-mode Bluetooth, widely used for both commercial and industrial purposes.

micro-ROS targets mid-range and medium-to-high performance 32-bits microcontrollers families. Up to now, the boards officially supported by the project were solely based on the STM32 series from ST, MCUs featuring ARM Cortex-M processors. On the other hand, the ESP32 is an ultra-low power consumption dual-core system with two Xtensa LX6 CPUs, exposing a large collection of peripherals.

Specifically, the port has been carried out for an Espressif ESP32-DevKitC-32E, an entry-level development board featuring an ESP32-WROOM-32E module integrating Wi-Fi and Bluetooth functions. The port makes use of FreeRTOS, one of the three RTOSes officially supported by the micro-ROS project, which is natively used by this family of boards, and supports the latest Foxy release of ROS 2. It works both with serial and Wi-Fi transports, the latter being particularly appealing as it marks the first hardware support of the micro-ROS project that exploits a natively integrated Wi-Fi antenna. Therefore, thanks to the combination of this highly capable Espressif board with micro-ROS, users will be able to develop wireless ROS2 applications that take advantage of the huge set of peripherals that ESP32 offers: I²C, SPI, I²S, LED drivers, PWM, etc. Furthermore, the ESP32-DevKitC-32E development board perfectly fits the typical requirements of the IoT systems targeted by micro-ROS, as it features a Flash memory of 4 MB, 448 KB ROM for booting and core functions, 520 KB SRAM for data and instructions and 16 KB SRAM in RTC.

The recent port of micro-ROS to ESP32 thus sets a milestone towards expanding the family of MCUs supported by micro-ROS and paves the way for further ports, ensuring this project an ever wider base of hardware support.

In order to try the new port, follow one of the core tutorials to install the micro-ROS build system, and then follow the instructions below:


ros2 run micro_ros_setup create_firmware_ws.sh freertos esp32

ros2 run micro_ros_setup configure_firmware.sh int32_publisher -t udp -i [your local machine IP] -p 8888

ros2 run micro_ros_setup build_firmware.sh menuconfig

# Now go to the micro-ROS Transport Settings → WiFi Configuration menu and fill your WiFi SSID and password. Save your changes, exit the interactive menu, and run:

ros2 run micro_ros_setup build_firmware.sh

# Connect your ESP32 to the computer with a micro-USB cable, and run:

ros2 run micro_ros_setup flash_firmware.sh

In order to open an agent you can find instructions here but we recommend using the docker image:


docker run -it --rm --net=host microros/micro-ros-agent:foxy udp4 --port 8888 -v6

24 Likes

This is great news. Thanks for the hard work.

4 Likes

Another great news: we’ve developed a tool into our build system that generates the static libraries and header folders required to ease the integration of micro-ROS into external build systems.

Thanks to this tool, we were able to successfully integrate micro-ROS into the ESP-IDF (Espressif IoT Development Framework), the official development framework for the ESP32 and ESP32-S Series SoCs. Check out the dedicated repo!

5 Likes

Have created docker image that can be used to build esp32 program with esp32 microros component.

  1. clone example app with esp-idf micro-ros component from
    https://github.com/micro-ROS/micro_ros_espidf_component
    to /home/username

  2. enter /home/username/micro_ros_espidf_component

  3. run docker command to build example app
    docker run -it --rm -v $(pwd):$(pwd) --workdir $(pwd) dsryzhov/esp-idf-microros /bin/bash -c ‘pip3 install catkin_pkg lark-parser empy && idf.py build’

P.S. by some reason catkin_pkg was not installed in the docker image. Now it is updated before idf.py build. In the next version I will solve this issue.

4 Likes

Hello @Dmitry_Ryzhov, this looks amazing.

Would you PR the Dockerfile to the official repo? Maybe we can add a folder named docker with your dockerfile here and some instructions in the README.md.

If you are interested, I will be happy to check and merge the pull requests.

Thanks a lot!

Hello @pablogs. Yes, I am interested and will add PR to https://github.com/micro-ROS/micro_ros_espidf_component

@pablogs, have created PR

Merged and uploaded to micro-ROS dockerhub, thanks!!

Tested new image. In general in works!
Some one mistake in docker run command in README. There is no need && at the end with new image.
Created PR https://github.com/micro-ROS/micro_ros_espidf_component/pull/7

1 Like

By some reason --net=host does not work for me.
In this case esp32 is not connected to agent.
I use option -p 8888:8888/udp when starting agent

docker run -it --rm -p 8888:8888/udp microros/micro-ros-agent:foxy udp4 --port 8888 -v5

One more good news!
Today was able to compile and run microros example app (based on micro_ros_espidf_component)
with an arduino-esp32 idf component.

So it’s possible to use different arduino-esp32 libraries (with high level hardware API) in microros applications. Sometimes it’s more convinient than using low level API from esp-idf sdk.

arduino-esp32 component does not support esp-idf v 4.1 yet. It supports only esp-idf v.4.0

to compile microros example app with arduino-esp32 component

  1. use esp-idf sdk v 4.0 (but no 4.1) (I’ve build another docker image esp-idf-microros:idf-v4.0 based on 4.0 revision).
  2. cheout arduino-esp32 component from branch idf-release/v4.0 into components/arduino
  3. modify files in example app
    3.1 change files extensions from .c to cpp (in CMakefiles.txt also)
    3.2 modify main.cpp to use library WiFi.h from arduino-esp32 component (based on es-idf v4.0). There were compile errors with current implementation (as I understand because esp-idf wifi was changed from 4.0 to 4.1 release)
    3.3 use extern “C” for main functions and freertos callbacks
  4. configure arduino via idf.py menuconfig
    4.1 Main configurations steps see https://github.com/espressif/arduino-esp32/blob/master/docs/esp-idf_component.md
    4.2 enable mbedTLS\TLS key Exchange Methods\Enable pre-shared-key ciphersuites\Enable PSK based ciphersuites modes (without it there is a compilation error of arduino component)

all my modifications of example app can be seen on the link

Next step can be include microros-component to arduino IDE or intergarte it to XOD.io.

1 Like

Hello @Dmitry_Ryzhov, this sounds amazing!

Regarding this arduino-esp32 component let me check it and I really want to integrate it in the official micro-ROS GIthub organization. Maybe we can open an issue there to discuss which is the best way of integrating both ESP32 components. If you have ideas, PR are really welcome.

Regarding the integration with Arduino IDE, we have an internal ongoing proyect for integrating this and our preliminary results look great. So stay tunned and I will alert you when we have some prototype.

I didn’t know about XOD.io, it seems really interesting. Let us know any work you do in this way.

3 Likes

Hello @pablogs,

I will add more detailed instructions how to build microros example app with arduino-component today or tomorrow.

Great to know about ongoing Arduino IDE integration.

I’ve started to use XOD.io for esp32 projects. There is quite active community that creates many libraries for XOD. (https://xod.io/libs/ ) And I have an desire to add microros library to it to be able to use microros in XOD programs.

1 Like

Have created an issue to discuss build with arduino-esp32 component, as you suggested

1 Like

I am just going to leave this here.

The ESP8266 was really fun to work with for DEFCON/HOPE . I would love to replicate that experience for the ROS community, maybe for ROSCon 2021. I’ll try to pull a crew together after ROS World.

6 Likes

@Katherine_Scott Would be super cool! Definitely count on us if the project hits the road :raised_hands: :turtle:

3 Likes

micro-ROS strikes again!

We have further enlarged the family of supported boards, by porting the small turtle to the ESP32-S2. This MCU is a highly integrated Wi-Fi SoC endowed with a rich set of peripherals and I/O capabilities, designed for high-performance ultra-low-power applications.

The ESP-S2 features a high performance single-core (up to 240 MHz), 128 KB of ROM, 320 KB of SRAM plus an embedded flash depending on the specific board version.

As a welcome addition, we mention that the ultra-low power consumption mode in this chip has been recently investigated by @MS71. This resulted in an example app configured so as to cut down the consumption to a mean current of ~ 5 mA when minimizing the wireless communications, corresponding to a lot of micro-ROS working hours on batteries.

5 Likes

Great news, I just received some ESP32-S2 , but I ordered the raw component wich is really cheap about 2$ https://www.digikey.com/en/products/detail/espressif-systems/ESP32-S2-WROOM-I/11613181 . I have to design, mill and solder a PCB to test.

If anyone wants to learn how to do that in a 6-month program, I still have a few places for FabAcademy students in AgriLab : http://agrilab.unilasalle.fr/fabacademy/

1 Like

We are glad to announce that, thanks to the contribution of a community member (Felipe Neves), it is now possible to use micro-ROS on the ESP32 over ethernet in those boards exposing a routed ethernet port. Find the PR where the magic happened here!

Ethernet microROS and ESP32post2no cables

Notice that the WiFi still is the default transport for micro-ROS on the ESP32, but the configuration options can now be set to allow the user selecting the ethernet interface, too. To do so, following the default configuration procedure of the ESP-IDF will do the trick.

Enjoy this newcomer of the micro-ROS & ESP32 family!

1 Like