• Stars
    star
    209
  • Rank 188,281 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

micro-ROS library for Platform.IO

banner banner

micro-ROS for PlatformIO

This is a micro-ROS library for bare metal projects based on platformIO.

The build process for ROS 2 and micro-ROS is based on custom meta-build system tools and CMake. PlatformIO will handle the full build process, including dependencies, compilation and linkage.

Supported boards

Supported boards are:

Board Platform Framework Transports Default meta file
portenta_h7_m7 ststm32 arduino serial
wifi
colcon.meta
teensy41 teensy arduino serial
native_ethernet
colcon.meta
teensy40 teensy arduino serial colcon.meta
teensy36
teensy35
teensy31
teensy arduino serial colcon_lowmem.meta
due atmelsam arduino serial colcon_verylowmem.meta
zero atmelsam arduino serial colcon_verylowmem.meta
olimex_e407 ststm32 arduino serial colcon.meta
esp32dev espressif32 arduino serial
wifi
colcon.meta
nanorp2040connect raspberrypi arduino serial
wifi_nina
colcon_verylowmem.meta
pico raspberrypi arduino serial colcon.meta

The community is encouraged to open pull request with custom use cases.

Requirements

  • PlatformIO local installation or PlatformIO IDE for VSCode

  • PlatformIO Core version 6.1.0 or greater

  • PlatformIO needs git, cmake and pip3 to handle micro-ROS internal dependencies:

    apt install -y git cmake python3-pip

Platform specific requirements

MacOS

XCode command line tools are distributed with toolchain that is not fully compatible with micro-ROS build process. To fix this, install GNU binutils using Homebrew:

brew install binutils

How to add to your project

The library can be included as a regular git library dependence on your platform.ini file:

...
lib_deps =
    https://github.com/micro-ROS/micro_ros_platformio

Now to proceed with the PlatformIO workflow:

pio lib install # Install dependencies
pio run # Build the firmware
pio run --target upload # Flash the firmware

After the library is compiled for first time the build process will be skipped, to trigger a library build and apply library modifications on your next platformIO build:

pio run --target clean_microros  # Clean library

Library configuration

This section details the different configuration parameters available on the project platform.ini file. A explanation for adding custom targets is also present

ROS 2 distribution

The target ROS 2 distribution can be configured with the board_microros_distro = <distribution>, supported values are:

  • humble
  • iron (default value)
  • rolling

Transport configuration

The transport can be configured with the board_microros_transport = <transport>, supported values and configurations are:

  • serial (default value)

    Serial.begin(115200);
    set_microros_serial_transports(Serial);
  • wifi

  • wifi_nina

    IPAddress agent_ip(192, 168, 1, 113);
    size_t agent_port = 8888;
    
    char ssid[] = "WIFI_SSID";
    char psk[]= "WIFI_PSK";
    
    set_microros_wifi_transports(ssid, psk, agent_ip, agent_port);
  • native_ethernet

    byte local_mac[] = { 0xAA, 0xBB, 0xCC, 0xEE, 0xDD, 0xFF };
    IPAddress local_ip(192, 168, 1, 177);
    IPAddress agent_ip(192, 168, 1, 113);
    size_t agent_port = 8888;
    
    set_microros_native_ethernet_transports(local_mac, local_ip, agent_ip, agent_port);
  • custom

    The user will need to write transport functions in app code and provide it to the micro-ROS library using rmw_uros_set_custom_transport() API

    bool platformio_transport_open(struct uxrCustomTransport * transport) {...};
    bool platformio_transport_close(struct uxrCustomTransport * transport) {...};
    size_t platformio_transport_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err) {...};
    size_t platformio_transport_read(struct uxrCustomTransport* transport, uint8_t* buf, size_t len, int timeout, uint8_t* err) {...};
    
    rmw_uros_set_custom_transport(
      MICROROS_TRANSPORTS_FRAMING_MODE, // Set the MICROROS_TRANSPORTS_FRAMING_MODE or MICROROS_TRANSPORTS_PACKET_MODE mode accordingly
      NULL,
      platformio_transport_open,
      platformio_transport_close,
      platformio_transport_write,
      platformio_transport_read
    );

Extra packages

Colcon packages can be added to the build process using this two methods:

  • Package directories copied on the <Project_directory>/extra_packages folder.
  • Git repositories included on the <Project_directory>/extra_packages/extra_packages.repos yaml file.

This should be used for example when adding custom messages types or custom micro-ROS packages.

Other configuration

Library packages can be configured with a customized meta file on the project main folder: board_microros_user_meta = <file_name.meta>.

This allows the user to customize the library memory resources or activate optional functionality such as multithreading, including configuration of user Extra packages.

  • Documentation on available parameters can be found here and here.

  • Default configurations can be found on the metas folder.

    Note: the common.meta file makes general adjustments to the library and shall not be modified by the user.

Extend library targets

This library can be easily adapted to different boards, transports or RTOS, to achieve this the user shall provide:

Transport implementation

New transport implementations shall follow the signatures shown on micro_ros_platformio.h, the provided sources can be used as reference along this documentation. Contributed transport source code shall be added on the ./platform_code/<framework>/<board_microros_transport> path. Example:

  • platform.ini:

    framework = arduino
    board_microros_transport = wifi
  • Transport source files: platform_code/arduino/wifi

  • Also, a MICRO_ROS_TRANSPORT_<FRAMEWORK>_<TRANSPORT> definition will be available:

    #if defined(MICRO_ROS_TRANSPORT_ARDUINO_WIFI)

    Note: board_microros_transport = custom should not be used, as it is used to add custom transports on user app code

Time source

micro-ROS needs a time source to handle executor spins and synchronize reliable communication. To achieve this, a clock_gettime POSIX compliant implementation is required, with a minimum resolution of 1 millisecond.

This method shall be included on a clock_gettime.cpp source file under the ./platform_code/<framework>/ path, an example implementation can be found on clock_gettime.cpp

Using the micro-ROS Agent

It is possible to use a micro-ROS Agent just by using this docker command:

# UDPv4 micro-ROS Agent
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO udp4 --port 8888 -v6

# Serial micro-ROS Agent
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO serial --dev [YOUR BOARD PORT] -v6

# TCPv4 micro-ROS Agent
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO tcp4 --port 8888 -v6

# CAN-FD micro-ROS Agent
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO canfd --dev [YOUR CAN INTERFACE] -v6

For the supported transports, only the serial and udp4 versions shall be used, although users can develop and use the agent to test their own tcp4 and canfd custom transports.

It is also possible to use custom transports on a micro-XRCE Agent instance. More info available here.

Examples

A simple publisher project using serial transport is available on the examples directory, this examples is meant to be modified with the user board.

Purpose of the Project

This software is not ready for 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 it according to any applicable safety standards, e.g., ISO 26262.

License

This repository is open-sourced under the Apache-2.0 license. See the LICENSE file for details.

For a list of other open-source components included in this repository, see the file 3rd-party-licenses.txt.

Known Issues/Limitations

  • For wifi_nina transport, the following versioning shall be used:

    lib_deps =
      arduino-libraries/WiFiNINA@^1.8.13
  • For nanorp2040connect board with serial transport, the library dependency finder shall be set to chain+:

    lib_ldf_mode = chain+
  • For pico board with serial transport, the library dependency finder shall be set to chain+:

    lib_ldf_mode = chain+

More Repositories

1

micro_ros_arduino

micro-ROS library for Arduino
C
437
star
2

micro_ros_setup

Support macros for building micro-ROS-based firmware.
Shell
365
star
3

micro_ros_espidf_component

micro-ROS ESP32 IDF component and sample code
C
254
star
4

micro_ros_stm32cubemx_utils

A set of utilities for integrating micro-ROS in a STM32CubeMX project
C
163
star
5

micro-ROS.github.io

A platform for seamless integration of resource constrained devices in the ROS ecosystem.
SCSS
110
star
6

micro-ROS-Agent

ROS 2 package using Micro XRCE-DDS Agent.
C++
101
star
7

NuttX

Official micro-ROS RTOS
C
88
star
8

micro-ROS-demos

Sample code using rclc and rclcpp implementations.
C
84
star
9

freertos_apps

Sample applications for FreeRTOS + micro-ROS
C
81
star
10

micro_ros_zephyr_module

micro-ROS Zephyr module and sample code
C
54
star
11

docker

Docker-related material to setup, configure and develop with micro-ROS hardware.
Dockerfile
49
star
12

system_modes

System modes for ROS 2 and micro-ROS
C++
43
star
13

rmw_microxrcedds

RMW implementation using Micro XRCE-DDS middleware.
C
35
star
14

micro-ROS_moveit2_demo

Provides a demo of micro-ROS and MoveIt2 based on ST Disco L475 IOT01 board IMU sensors.
C++
22
star
15

zephyr_apps

Sample applications for Zephyr + micro-ROS
C
19
star
16

micro_ros_mbed

micro-ROS mbed sample code
Makefile
18
star
17

micro-ROS_crazyflie_demo

Provides a demo of micro-ROS based on a Crazyflie.
Python
18
star
18

micro-ROS_openmanipulator_demo

Provides a demo of micro-ROS based on ROBOTIS OpenManipulator, Olimex STM32 E407 and VL53L1X ToF sensor.
C++
14
star
19

micro-ROS_kobuki_demo

Provides a demo of micro-ROS based on a Kobuki and an Olimex STM32-E407 board.
Python
14
star
20

rmw_embeddedrtps

RMW implementation for EmbeddedRTPS middleware
C++
13
star
21

micro-ROS_sensors_demo

Provides a demo of micro-ROS based on ST Disco L475 IOT01 board.
Shell
12
star
22

micro_ros_nuttx_app

An standalone micro-ROS app for Nuttx
Makefile
11
star
23

nuttx_apps

C
10
star
24

micro_ros_azure_rtos_app

micro-ROS app for Azure RTOS
C
8
star
25

micro_ros_utilities

General utilities for easing the usage of micro-ROS on different platforms
C
8
star
26

micro_ros_diagnostics

Diagnostics framework for micro-ROS
C
8
star
27

micro-ROS-bridge_RPI

Shell
7
star
28

micro_ros_rtthread_component

Python
7
star
29

micro_ros_msgs

Collection of ROS 2 message definitions used throughout the implementation of micro-ROS, both in the agent and client endpoints.
CMake
6
star
30

micro_ros_renesas2estudio_component

A set of utilities for integrating micro-ROS in a Renesas e2 studio project
C
6
star
31

micro-ROS_warehouse_demo

Python
5
star
32

rosidl_typesupport_microxrcedds

Type support for Micro XRCE-DDS
EmberScript
4
star
33

micro_ros_renesas_testbench

micro-ROS hardware in the loop testing
C
4
star
34

micro_ros_tivac_launchpad_app

micro-ROS app for TI Tiva C Series TM4C123GXL LaunchPad
C
4
star
35

micro_ros_vitis_component

Shell
4
star
36

micro_ros_renesas_demos

Demo code for Renesas e2 studio
C
4
star
37

benchmarking

A sets a tools and framework to develop embedded system benchmarks
C
4
star
38

benchmarking_shadow-builder

Repositiory containing the shadow-builder benchmarking tool
C++
3
star
39

executor_testbench

Executor modul for rcl with customizable scheduling semantics
C
2
star
40

raspbian_apps

C
2
star
41

micro-ROS_thumper_demo

A 6 wheel mobile robot contraller over 6LoWPAN and micro-ROS
Shell
2
star
42

micro-ROS-rtt

Micro-ROS Round-Trip Tests
C++
1
star
43

benchmarking-results

Benchmarking results
HTML
1
star
44

micro-ROS_demobox_demo

The demo box is a portable suitcase demonstration, showing advantage of using micro-ROS over ROS2 by showing power measurement and bootup time.
Shell
1
star
45

.github

micro-ROS GitHub Organization-wide files
1
star