ROS 2: micro-ROS ESP32-cam camera_publisher
micro-ROS ESP32-cam image capture from camera_publisher
Experimentation @ ASU RISE Lab: https://home.riselab.info/
Step 1: Install ROS 2 in your Host computer
Host Computer I am using has OS: Ubuntu 20.04.5 LTS
ROS 2 Galactic is installed following https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html
Step 2: ESP IDF Hello World
This step is not needed but helps in understanding the Flashing of the ESP32 https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html#get-started-linux-macos-first-steps
Step 3: Micro-ROS Installation
# Source the ROS 2 installation
source /opt/ros/$ROS_DISTRO/setup.bash# Create a workspace and download the micro-ROS tools
# make this directory in ~/Documents/espcamera
mkdir microros_ws
cd microros_ws
git clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup# Update dependencies using rosdep
ls
# src directory is added
sudo apt update && rosdep update
rosdep install --from-path src --ignore-src -y
# Install pip
sudo apt-get install python3-pip
# Check the ROS Middleware
echo $RMW_IMPLEMENTATION
# As the host computer has galactic ROS2, rmw_microxrcedds is required
export RMW_IMPLEMENTATION=rmw_microxrcedds
# Build micro-ROS tools and source them
colcon build
ls
# build install log directories are created
source install/local_setup.bash
Step 4: Creating a new firmware workspace for ESP32
ros2 run micro_ros_setup create_firmware_ws.sh freertos esp32
# this takes 20-40 minutes
ls
# will display new firmware directory
Step 5: camera_publisher Program from github
git clone https://github.com/achyutsun/esp32camera.git
# Rename the folder to camera_publisher
mv esp32camera camera_publisher
# Move the camera_publisher to microros_ws/firmware/freertos_apps/apps
mv camera_publisher firmware/freertos_apps/apps
Step 6: Configuring the firmware
# Get the IP Address of your computer
# Configure the WiFi credential
ifconfig
# PROJECT NAME = camera_publisher LOCAL MACHINE IP ADDRESS = 192.168.1.1X or similar when
ros2 run micro_ros_setup configure_firmware.sh [PROJECT NAME] -t udp -i [LOCAL MACHINE IP ADDRESS] -p 8888
# Configure the WiFi credential
ros2 run micro_ros_setup build_firmware.sh menuconfig
# Select micro-ROS Transport Settings --->
# then Select WiFi Configuration --->
# enter you WiFi SSID and WiFi Password
# Press S to Save, then Q to quit
# Building the Firmware, before flashing
ros2 run micro_ros_setup build_firmware.sh
Step 7: Flash the firmware
Connect the ESP32-CAM board/kit using FTDI (TTL-USB) to your host computer USB and run. Make sure to jump the Flash pin of the ESP32 to GND to bootenable/flashing
ros2 run micro_ros_setup flash_firmware.sh
# Observing error during flashing
# https://answers.ros.org/question/412659/esp32-camera_publisher-program-flash-error/
References:
[1] https://medium.com/@SameerT009/connect-esp32-to-ros2-foxy-5f06e0cc64df
[2] https://github.com/espressif/esp32-camera
[3] https://answers.ros.org/question/412659/esp32-camera_publisher-program-flash-error/