This project demonstrates the implementation of a Micro-ROS subscriber on an ESP32. The ESP32 subscribes to the /led_control
topic and controls an LED based on the received messages.
- Implements a Micro-ROS subscriber to listen for LED control commands.
- Uses
urosHandler
for managing Micro-ROS nodes and subscriptions. - Controls an LED using GPIO on the ESP32.
- Compatible with the
std_msgs/msg/Int32
message type.
├── main.cpp # Entry point for the Micro-ROS application
├── sim_sub.cpp # Implements the subscriber functionality
├── sim_sub.hpp # Header file for the subscriber class
├── urosHandler # External repository for handling Micro-ROS elements
- ESP-IDF (ESP32 Development Framework)
- Micro-ROS (ROS2 client for microcontrollers)
- Clone this repository:
git clone https://github.com/your-username/your-repository.git cd your-repository
- Initialize submodules:
git submodule update --init --recursive
- Install ESP-IDF: Follow the official ESP-IDF installation guide.
- Set up Micro-ROS:
Configure Micro-ROS settings if required.
idf.py menuconfig
- Build the project:
idf.py build
- Flash the firmware to ESP32:
idf.py flash
- Monitor the serial output:
idf.py monitor
- The ESP32 subscribes to the
/led_control
topic. - Sending
std_msgs/msg/Int32
messages with values:1
→ Turns the LED ON0
→ Turns the LED OFF
- Example command to publish a message from ROS 2:
ros2 topic pub /led_control std_msgs/msg/Int32 '{"data": 1}'