adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
MIT License
3.96k stars 1.16k forks source link

ROS2 networking via MicroROS #8139

Open hierophect opened 1 year ago

hierophect commented 1 year ago

ROS - the Robot Operating System - is a powerful open source collection of software for the development of advanced robotics. The core appeal of the system is that it can tie many different pieces of robotics software together across a shared network, such as navigation, prediction, machine learning, motor control, etc, without needing a bunch of custom communication software. This is obviously super important for commercial robotics teams, but it's also used by smaller robotics dev groups in research or hobby spaces.

I'm interested in attempting to create a ROS2 module for Circuitpython, using a project called MicroROS, which implements the networking stuff required for a microcontroller such as the ESP32, RP2040, or various ST devices to talk to other ROS2 "nodes". This would allow you to do things like run ROS2's navigation, computer vision, and simulation software on a host computer, but have your embedded devices running things like sensors and motors on the same network, all without having to know anything about embedded C or C++ programming.

For example, I could have an ESP32S2 running a drone, connected to wifi. It sends accelerometer and camera data to ROS2 software on a host computer, which runs SLAM algorithms, does navigation, etc and sends movement instructions back on the same network.

The core API for this would be pretty simple, basically a bunch of communication functions for sending and receiving data in ROS2's publish/subscribe structure. The tricky part would be including MicroROS, which substantial enough it might want to be cordoned off with a build flag.

Anyway, anyone interested in this? It's not super beginner software, but at least in my local maker circle, there's a lot of enthusiasm for learning more about ROS since it's so common in robotics. I hope it'd make it a bit easier to get started.

casainho commented 1 year ago

It is on my plans to learn ROS. The idea to use an ESP32 with CircuitPython for reading sensors and send to ROS, is great!! Even because if I understand correctly, ROS can be programmed in Python also.

Note that CircuitPython do not support Bluetooth on ESP32. The wireless communications can then be wifi or ESPNow. I am being using ESPNow on CircuitPython and works very well.

The most cheap ESP32 I am being using is the ESP32-S2 Lolin mini board.