ESP32-CAM ROS rosserial_arduino platformio

ESP32-CAM ROS rosserial_arduino platformio

Create a new project, and select:
Board: AI Thinker ESP32-CAM
Framework: Arduino

Add the Rosserial Arduino Library from frankjoshua to the project
lib_deps = frankjoshua/Rosserial Arduino Library@^0.9.1

For a simple demo over wifi copy the sample in the following file

Esp8266HelloWorld.ino
.pio/libdeps/esp32cam/Rosserial Arduino Library/examples/Esp8266HelloWorld

Remove the following line (near line 13)
#include <ESP8266WiFi.h>

//Change the wifi ssid and pass
const char* ssid = “your-ssid”;
const char* password = “your-password”;

// Set the rosserial socket server IP address
IPAddress server(192,168,1,1);

// Check the
const uint16_t serverPort = 11411;

Compile and upload

On the ros master run the rosserial node in tcp mode

rosrun rosserial_python serial_node.py tcp

We can build and install the ros_lib for the current ros version by install the rosserial arduino

sudo apt install ros-noetic-rosserial-arduino

And build the library with the following command

rosrun rosserial_arduino make_libraries.py .

After, we shall copy the ros_lib folder to the lib folder of the platformio project

The last rosserial_arduino version on the following address

https://github.com/ros-drivers/rosserial/