micro-ROS Sensors Demo
This demo illustrates micro-ROS capabilities in combination with the STM32L4 Discovery kit IoT node node and Zephyr RTOS. micro-ROS integration with common ROS 2 tools such as RQt are shown in this demo case of use. The used board is an ST development board with a complete set of sensors and communication peripherals: 3-axis inertial units (IMU), environmental sensors (temperature, humidity, and pressure), a time of flight laser ranging sensor, NFC, low-power radio and 802.11 devices.
The vast majority of these peripherals are out-of-the-box supported by Zephyr RTOS. So, by using the micro-ROS + Zephyr port, this demo case will put some of these sensors’ measurements to the ROS 2 world. Concretely, the 3-axis accelerometer data will be published on
/sensors/imu ROS 2 topic as a three-position array of 32 bits floating-point data. The range measurement of the time of flight laser sensor will be published on
/sensors/tof ROS 2 topic.
Finally, in order to test communications from the ROS 2 world to the embedded board running micro-ROS, the board is subscribed to a simple boolean topic on
/sensors/led that will turn a LED on and off.
This demo is also focused on the micro-ROS’s middleware layer where eProsima Micro XRCE-DDS is the default implementation. This software, base on the DDS-XRCE wire protocol, offers to micro-ROS client-server communication with the following characteristics:
- Multi-transport protocol support (UDP, TCP and Serial).
- Peer-to-peer communication.
- Server discovery.
- Best-effort and reliable communication.
- Message fragmentation.
This demo aims to be an entry point for further IoT development using the STM32L4 Discovery kit IoT node, Zephyr and micro-ROS. It will also show the ease of use of the micro-ROS development environment for a ROS 2 developer.
The following is a list of the hardware needed to reproduce this demo:
- 1 x STM32L4 Discovery kit IoT node
- 1 x MicroUSB to USB cable.
How to build and flash the firmware?
- Run the builder Docker:
docker-compose run stiot_builder
This demo aims to be an entry point for further IoT development using STM32L4 Discovery kit IoT node, Zephyr and micro-ROS. It will also show the ease of use of the micro-ROS development environment for a ROS 2 developer.
- Configure and build the micro-ROS firmware inside the Docker:
ros2 run micro_ros_setup configure_firmware.sh sensors_publisher --transport serial-usb ros2 run micro_ros_setup build_firmware.sh
Connect the board using the STLink USB port
- Flash the micro-ROS firmware:
ros2 run micro_ros_setup flash_firmware.sh
How to use?
To start the application just two steps are needed:
Connect host USB to your computer. You can disconnect the STLink USB port and modify the board supply jumper on the bottom layer.
Up the Docker Compose:
docker-compose up -d
To stop the application just down the Docker Compose:
Purpose of the project
The software is not ready for a production use. It has neither been developed nor tested for a specific use case. However, the license conditions of the applicable Open Source licenses allow you to adapt the software to your needs. Before using it in a safety relevant setting, make sure that the software fulfills your requirements and adjust ot according to any applicable safety standards (e.g. ISO 26262).