Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 20 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,44 @@ name: CI

on:
pull_request:
push:
branches:
- '**'
- humble
- jazzy
- kilted
- rolling
workflow_call:
inputs:
branch:
description: 'Branch to checkout'
required: false
type: string
default: 'rolling'
workflow_dispatch:

jobs:

micro_ros_idf:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
idf_target: [ esp32, esp32s2, esp32s3, esp32c3, esp32c6]
idf_version: [ "espressif/idf:release-v5.2" ]
exclude:
# Skip IDF v4 + ESP32C6 combination
- idf_target: esp32c6
idf_version: espressif/idf:release-v4.4
idf_target: [esp32, esp32s2, esp32s3, esp32c3, esp32c6]
idf_version: [v5.2, v5.3, v5.4]

container:
image: ${{ matrix.idf_version }}
image: 'espressif/idf:release-${{ matrix.idf_version }}'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
path: micro_ros_espidf_component
ref: ${{ inputs.branch || github.ref }}

- name: Dependencies
shell: bash
run: |
apt update
export DEBIAN_FRONTEND=noninteractive
apt install -y git python3-pip
. $IDF_PATH/export.sh
pip3 install catkin_pkg lark-parser colcon-common-extensions
# This line avoids the error when using Python < 3.7 https://importlib-resources.readthedocs.io/en/latest/
pip3 install importlib-resources
# this installs the modules also for global python interpreter, needed for IDF v5
/usr/bin/pip3 install catkin_pkg lark-parser colcon-common-extensions importlib-resources

# This line can be removed when https://github.com/colcon/colcon-python-setup-py/issues/56 is solved
- name: Patch setuptools
shell: bash
if: matrix.idf_version == 'espressif/idf:release-v4.4'
run: |
. $IDF_PATH/export.sh
pip3 install setuptools==68.1.2
pip install catkin_pkg colcon-common-extensions lark

- name: Build sample - int32_publisher
shell: bash
Expand Down Expand Up @@ -86,7 +79,7 @@ jobs:

- name: Build sample - int32_publisher_custom_transport_usbcdc
shell: bash
if: (matrix.idf_target == 'esp32s2' || matrix.idf_target == 'esp32s3') && matrix.idf_version == 'espressif/idf:release-v5.2'
if: matrix.idf_target == 'esp32s2' || matrix.idf_target == 'esp32s3'
run: |
. $IDF_PATH/export.sh
cd micro_ros_espidf_component/examples/int32_publisher_custom_transport_usbcdc
Expand Down
113 changes: 6 additions & 107 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,117 +1,16 @@
name: Nightly

on:
workflow_dispatch:
inputs:
name:
description: "Manual trigger"
schedule:
- cron: '0 4 * * *'
- cron: '0 4 * * *'
workflow_dispatch:

jobs:
micro_ros_idf:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
branch: [rolling, jazzy, humble]
idf_target: [ esp32, esp32s2, esp32c3, esp32s3, esp32c6]
idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2" ]
exclude:
# Skip IDF v4 + ESP32C6 combination
- idf_target: esp32c6
idf_version: espressif/idf:release-v4.4
# Skip IDF v4 for rolling and kilted
- branch: rolling
idf_version: espressif/idf:release-v4.4
- branch: kilted
idf_version: espressif/idf:release-v4.4


container:
image: ${{ matrix.idf_version }}

steps:
- uses: actions/checkout@v2
with:
path: micro_ros_espidf_component
ref: ${{ matrix.branch }}

- name: Dependencies
shell: bash
run: |
apt update
export DEBIAN_FRONTEND=noninteractive
apt install -y git python3-pip
. $IDF_PATH/export.sh
pip3 install catkin_pkg lark-parser empy==3.3.4 colcon-common-extensions
# This line avoids the error when using Python < 3.7 https://importlib-resources.readthedocs.io/en/latest/
pip3 install importlib-resources
# this installs the modules also for global python interpreter, needed for IDF v5
/usr/bin/pip3 install catkin_pkg lark-parser empy==3.3.4 colcon-common-extensions importlib-resources

# This line can be removed when https://github.com/colcon/colcon-python-setup-py/issues/56 is solved
- name: Patch setuptools
shell: bash
if: matrix.idf_version == 'espressif/idf:release-v4.4'
run: |
. $IDF_PATH/export.sh
pip3 install setuptools==68.1.2

- name: Build sample - int32_publisher
shell: bash
run: |
. $IDF_PATH/export.sh
cd micro_ros_espidf_component/examples/int32_publisher
idf.py set-target ${{ matrix.idf_target }}
idf.py build

- name: Build sample - low_consumption
shell: bash
if: matrix.idf_target != 'esp32c3' && matrix.idf_target != 'esp32s3' && matrix.idf_target != 'esp32c6'
run: |
. $IDF_PATH/export.sh
cd micro_ros_espidf_component/examples/low_consumption
idf.py set-target ${{ matrix.idf_target }}
idf.py build

- name: Build sample - handle_static_types
shell: bash
run: |
. $IDF_PATH/export.sh
cd micro_ros_espidf_component/examples/handle_static_types
idf.py set-target ${{ matrix.idf_target }}
idf.py build

- name: Build sample - int32_publisher_custom_transport
shell: bash
run: |
. $IDF_PATH/export.sh
cd micro_ros_espidf_component
make -f libmicroros.mk clean
sed -i 's/DRMW_UXRCE_TRANSPORT=udp/DRMW_UXRCE_TRANSPORT=custom/' colcon.meta
cd examples/int32_publisher_custom_transport
idf.py set-target ${{ matrix.idf_target }}
idf.py build

- name: Build sample - multithread_publisher
shell: bash
run: |
. $IDF_PATH/export.sh
cd micro_ros_espidf_component
make -f libmicroros.mk clean
sed -i 's/DRMW_UXRCE_TRANSPORT=udp/DRMW_UXRCE_TRANSPORT=custom/' colcon.meta
cd examples/multithread_publisher
idf.py set-target ${{ matrix.idf_target }}
idf.py build

- name: EmbeddedRTPS
if: ${{ matrix.branch == 'humble' }}
shell: bash
run: |
. $IDF_PATH/export.sh
cd micro_ros_espidf_component
make -f libmicroros.mk clean
cd examples/int32_publisher_embeddedrtps
idf.py set-target ${{ matrix.idf_target }}
idf.py build
branch: [humble, jazzy, kilted, rolling]
uses: ./.github/workflows/ci.yml
with:
branch: ${{ matrix.branch }}
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@

# micro-ROS component for ESP-IDF

This component has been tested in ESP-IDF v5.2 with ESP32, ESP32-S2, ESP32-S3, ESP32-C3 and ESP32-C6.

_Note: ESP-IDF v4.4 is supported only in ROS 2 Humble and Jazzy due to Python version incompatibilities._
This component has been tested in ESP-IDF v5.2, v5.3, and v5.4 with ESP32, ESP32-S2, ESP32-S3, ESP32-C3 and ESP32-C6.

## Dependencies

This component needs `colcon` and other Python 3 packages inside the IDF virtual environment in order to build micro-ROS packages:

```bash
. $IDF_PATH/export.sh
pip3 install catkin_pkg lark-parser colcon-common-extensions
pip3 install catkin_pkg colcon-common-extensions lark
```

## Middlewares available

This package support the usage of micro-ROS on top of two different middlewares:

- [eProsima Micro XRCE-DDS](https://micro-xrce-dds.docs.eprosima.com/en/latest/): the default micro-ROS middleware.
- [embeddedRTPS](https://github.com/embedded-software-laboratory/embeddedRTPS): an experimental implementation of a RTPS middleware compatible with ROS 2.

In order to select it, use `idf.py menuconfig` and go to `micro-ROS Settings > micro-ROS middleware`

## Usage

You can clone this repo directly in the `components` folder of your project.
Expand All @@ -36,7 +36,7 @@ In order to test a int32_publisher example:
```bash
. $IDF_PATH/export.sh
cd examples/int32_publisher
# Set target board [esp32|esp32s2|esp32s3|esp32c3]
# Set target board [esp32|esp32s2|esp32s3|esp32c3|esp32c6]
idf.py set-target esp32
idf.py menuconfig
# Set your micro-ROS configuration and WiFi credentials under micro-ROS Settings
Expand All @@ -63,19 +63,16 @@ docker run -it --rm --net=host microros/micro-ros-agent:rolling udp4 --port 8888
It's possible to build this example application using the official Espressif [docker images](https://hub.docker.com/r/espressif/idf), following the same steps:

```bash
docker pull espressif/idf:release-v5.2
# Run ESP-IDF container
docker run --name micro-ros-espidf-component-test -it espressif/idf:release-v5.2 bash
docker run --name micro-ros-espidf-component -it espressif/idf:release-v5.4 bash

git clone https://github.com/micro-ROS/micro_ros_espidf_component.git
git clone -b rolling https://github.com/micro-ROS/micro_ros_espidf_component.git
cd micro_ros_espidf_component/

# Install dependencies
pip3 install catkin_pkg lark-parser colcon-common-extensions
pip install catkin_pkg colcon-common-extensions lark

$IDF_PATH/export.sh
cd examples/int32_publisher
# Set target board [esp32|esp32s2|esp32s3|esp32c3]
# Set target board [esp32|esp32s2|esp32s3|esp32c3|esp32c6]
idf.py set-target esp32
idf.py menuconfig
# Set your micro-ROS configuration and WiFi credentials under micro-ROS Settings
Expand Down
3 changes: 2 additions & 1 deletion examples/handle_static_types/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ sensor_msgs__msg__Image msg_static;

uint8_t my_buffer[1000];

void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
void timer_callback(rcl_timer_t * timer, int64_t last_call_time, uintptr_t arg)
{
RCLC_UNUSED(last_call_time);
RCLC_UNUSED(arg);
if (timer != NULL) {
RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
RCSOFTCHECK(rcl_publish(&publisher, &msg_static, NULL));
Expand Down
3 changes: 2 additions & 1 deletion examples/int32_publisher/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
rcl_publisher_t publisher;
std_msgs__msg__Int32 msg;

void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
void timer_callback(rcl_timer_t * timer, int64_t last_call_time, uintptr_t arg)
{
RCLC_UNUSED(last_call_time);
RCLC_UNUSED(arg);
if (timer != NULL) {
printf("Publishing: %d\n", (int) msg.data);
RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
Expand Down
3 changes: 2 additions & 1 deletion examples/int32_publisher_custom_transport/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
rcl_publisher_t publisher;
std_msgs__msg__Int32 msg;

void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
void timer_callback(rcl_timer_t * timer, int64_t last_call_time, uintptr_t arg)
{
RCLC_UNUSED(last_call_time);
RCLC_UNUSED(arg);
if (timer != NULL) {
RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
msg.data++;
Expand Down
5 changes: 3 additions & 2 deletions examples/int32_publisher_custom_transport_usbcdc/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ rcl_publisher_t publisher; // Publisher
std_msgs__msg__Int32 msg; // Message to be published

// Timer callback. Publishes a message
void timer_callback(rcl_timer_t *timer, int64_t last_call_time) {
void timer_callback(rcl_timer_t *timer, int64_t last_call_time, uintptr_t arg) {
RCLC_UNUSED(last_call_time);
RCLC_UNUSED(arg);
if (timer != NULL) {
// Publish message to topic
RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
Expand Down Expand Up @@ -163,4 +164,4 @@ void app_main(void) {
if (task_handle != NULL) {
ESP_LOGI(TAG_MAIN, "micro-ROS task created");
}
}
}
3 changes: 2 additions & 1 deletion examples/int32_publisher_embeddedrtps/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
rcl_publisher_t publisher;
std_msgs__msg__Int32 msg;

void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
void timer_callback(rcl_timer_t * timer, int64_t last_call_time, uintptr_t arg)
{
RCLC_UNUSED(last_call_time);
RCLC_UNUSED(arg);
if (timer != NULL) {
printf("Publishing: %d\n", (int) msg.data);
RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
Expand Down
5 changes: 3 additions & 2 deletions examples/int32_sub_pub/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ rcl_subscription_t subscriber;
std_msgs__msg__Int32 send_msg;
std_msgs__msg__Int32 recv_msg;

void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
void timer_callback(rcl_timer_t * timer, int64_t last_call_time, uintptr_t arg)
{
(void) last_call_time;
(void) arg;
if (timer != NULL) {
RCSOFTCHECK(rcl_publish(&publisher, &send_msg, NULL));
printf("Sent: %d\n", (int) send_msg.data);
Expand Down Expand Up @@ -127,4 +128,4 @@ void app_main(void)
NULL,
CONFIG_MICRO_ROS_APP_TASK_PRIO,
NULL);
}
}
3 changes: 2 additions & 1 deletion examples/low_consumption/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ std_msgs__msg__Int32 msg;
esp_pm_lock_handle_t pmlock;
#endif /* CONFIG_PM_ENABLE */

void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
void timer_callback(rcl_timer_t * timer, int64_t last_call_time, uintptr_t arg)
{
RCLC_UNUSED(last_call_time);
RCLC_UNUSED(arg);
if (timer != NULL) {
#ifdef CONFIG_PM_ENABLE
esp_pm_lock_acquire(pmlock); // disable wifi sleep mode
Expand Down
5 changes: 3 additions & 2 deletions examples/parameters/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@

rclc_parameter_server_t param_server;

void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
void timer_callback(rcl_timer_t * timer, int64_t last_call_time, uintptr_t arg)
{
(void) timer;
(void) last_call_time;
(void) arg;

int64_t value;
rclc_parameter_get_int(&param_server, "param2", &value);
Expand Down Expand Up @@ -142,4 +143,4 @@ void app_main(void)
NULL,
CONFIG_MICRO_ROS_APP_TASK_PRIO,
NULL);
}
}
3 changes: 2 additions & 1 deletion examples/ping_pong/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ int device_id;
int seq_no;
int pong_count;

void ping_timer_callback(rcl_timer_t * timer, int64_t last_call_time)
void ping_timer_callback(rcl_timer_t * timer, int64_t last_call_time, uintptr_t arg)
{
RCLC_UNUSED(last_call_time);
RCLC_UNUSED(arg);

if (timer != NULL) {

Expand Down
Loading
Loading