micro-ROS + ESP32-cam

Coming from the wonderful ROS framework, I’d like to get more familiar with ROS2 through a project.

I would like to build a versatile and useful mobile platform using the ESP32-cam module, leveraging the very low cost of it, the camera it comes with, and some extra bits and pieces to have a sort of “spy-bot”. It could have many other interesting uses (RC car, camera turret, model train controller…). I fully realize that the camera resolution will be low and update rate will be probably slow, but I’d like to try. The ESP32-cam module can control an H-bridge to actuate two motors, serve the camera image over WiFi and possibly do OTA updates…

These projects have done what I aim for, but without ROS2:

I think using ROS2 framework would allow to build interesting applications by offloading the heavy computation to a computer. It would also allow to extend the hardware, such as using a game controller to control the platform.

I have researched ways to do this and I’ve found two options:

  1. The micro-ROS has been ported to ESP32 and can cross-compile functional programs. However, there are no examples on how to add an external library such as the epressif ESP32-camera library.
  2. micro-ROS for Arduino would be another option, as adding the camera library should be painless, but micro-ROS for Arduino does not support ESP32. There is a branch for that, however I have not tested it.

I could test the first approach, adding my own publishers and subscribers, but I was unsuccessful in adding the camera library. I do not want to rewrite the tested and functional library as part of this project if possible. I could not find any examples that add external libraries to a micro-ROS project and the file structure is too complex for me to navigate and understand.

I have not tested the second method yet.

My question is: at this point, what is the most promising method? Are there any resources that show how to add a library to micro-ROS or is the Arduino method perhaps easier?

2 Likes

Hi @Nurgak! micro-ROS team speaking here.

There’s a third and overall best option that you may have not stumbled across, which is our micro-ROS component for the ESP-IDF. This module allows you to seamlessly integrate your micro-ROS project w/ the Espressif development framework, and thus using any ESP-IDF compatible library that might come at handy, such as the GitHub - espressif/esp32-camera in your case.

Anyhows, the project you have in mind is totally feasible (and looks cool!). Actually, along the same line, we have a WIP project in collaboration w/ LUXonis (FYI @Luxonis-Brandon) that uses this module to leverage the cameras integrated into their DepthAI BW1092, which hosts an ESP32 chip. Check out our ongoing work here: GitHub - micro-ROS/micro_ros_espidf_component at feature/luxonis_BW1092.

Good luck and let us know how that goes when you try this out!

6 Likes

Hi @FraFin, thank you very much for pointing me to the right direction.

I was really surprised not to see this kind of project done with ROS/2, in the DIY realm, considering the cheapness of the hardware and the versatility/capabilities of the board/chip.

As I was waiting for the answer I started on an easier path of using ROS Noetic with rosserial_arduino, but I realize the major issues with it (mainly connectivity) and will switch over to ROS2 in the future.

1 Like

Thanks for the tag and recommendation, @FraFin !

2 Likes

Regarding not finding any projects using ROS and ESP32-CAM module, I spoke too early. I found this project here that does exactly that. Also this one from the same author that is even closer to what I want to do, but it doesn’t have any code right now and is still ROS1.

It is using the sensor_msgs/CompressedImage instead of sensor_msgs/Image topic, probably for performance reasons.

5 Likes

Hey,

I think the author you mentioned (Reinbert) indicated in both repo that they are both Work in Progress. I am wondering if you gave their repo a try? Does it work?

Thanks!

This example is working

Hi @FraFin I am following steps in ROS 2: micro-ROS ESP32-cam camera_publisher | by Achyut | Feb, 2023 | Medium
I am getting the following error. Please guide me. Thank you
ESP32 camera_publisher program Flash error - ROS Answers: Open Source Q&A Forum

Why micro ros or rtos… When u can play even much easier and cooler @ GitHub - bharath5673/ros_ws: my ROS workspace