Skip to content
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
idf_target: [ esp32, esp32s2, esp32s3, esp32c3, esp32c6]
idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2" ]
idf_version: [ "espressif/idf:release-v5.2" ]
exclude:
# Skip IDF v4 + ESP32C6 combination
- idf_target: esp32c6
Expand Down Expand Up @@ -112,4 +112,4 @@ jobs:
make -f libmicroros.mk clean
cd examples/int32_publisher_embeddedrtps
idf.py set-target ${{ matrix.idf_target }}
idf.py build
idf.py build
7 changes: 6 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ jobs:
strategy:
fail-fast: false
matrix:
branch: [rolling, jazzy, humble]
branch: [rolling, kilted, 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:
Expand Down
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

# micro-ROS component for ESP-IDF

This component has been tested in ESP-IDF v4.4, and v5.2 with ESP32, ESP32-S2, ESP32-S3, ESP32-C3 and ESP32-C6.
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._

## Dependencies

Expand Down Expand Up @@ -53,18 +55,34 @@ Is possible to use a micro-ROS Agent just with this docker command:

```bash
# UDPv4 micro-ROS Agent
docker run -it --rm --net=host microros/micro-ros-agent:foxy udp4 --port 8888 -v6
docker run -it --rm --net=host microros/micro-ros-agent:kilted udp4 --port 8888 -v6
```

## Build with docker container

It's possible to build this example application using preconfigured docker container. Execute this line to build an example app using docker container:
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 run -it --rm --user espidf --volume="/etc/timezone:/etc/timezone:ro" -v $(pwd):/micro_ros_espidf_component -v /dev:/dev --privileged --workdir /micro_ros_espidf_component microros/esp-idf-microros:latest /bin/bash -c "cd examples/int32_publisher; idf.py menuconfig build flash monitor"
```
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

Dockerfile for this container is provided in the ./docker directory and available in dockerhub. This approach uses ESP-IDF v5.
git clone 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

$IDF_PATH/export.sh
cd examples/int32_publisher
# Set target board [esp32|esp32s2|esp32s3|esp32c3]
idf.py set-target esp32
idf.py menuconfig
# Set your micro-ROS configuration and WiFi credentials under micro-ROS Settings
idf.py build
idf.py flash
idf.py monitor
```

## Using serial transport

Expand All @@ -90,7 +108,7 @@ Is possible to use a micro-ROS Agent just with this docker command:

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

## Purpose of the Project
Expand Down
5 changes: 3 additions & 2 deletions examples/handle_static_types/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ void micro_ros_task(void * arg)
// create timer,
rcl_timer_t timer;
const unsigned int timer_timeout = 1000;
RCCHECK(rclc_timer_init_default(
RCCHECK(rclc_timer_init_default2(
&timer,
&support,
RCL_MS_TO_NS(timer_timeout),
timer_callback));
timer_callback,
true));

// create executor
rclc_executor_t executor;
Expand Down
5 changes: 3 additions & 2 deletions examples/int32_publisher/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ void micro_ros_task(void * arg)
// create timer,
rcl_timer_t timer;
const unsigned int timer_timeout = 1000;
RCCHECK(rclc_timer_init_default(
RCCHECK(rclc_timer_init_default2(
&timer,
&support,
RCL_MS_TO_NS(timer_timeout),
timer_callback));
timer_callback,
true));

// create executor
rclc_executor_t executor;
Expand Down
5 changes: 3 additions & 2 deletions examples/int32_publisher_custom_transport/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ void micro_ros_task(void * arg)
// create timer,
rcl_timer_t timer;
const unsigned int timer_timeout = 1000;
RCCHECK(rclc_timer_init_default(
RCCHECK(rclc_timer_init_default2(
&timer,
&support,
RCL_MS_TO_NS(timer_timeout),
timer_callback));
timer_callback,
true));

// create executor
rclc_executor_t executor;
Expand Down
5 changes: 3 additions & 2 deletions examples/int32_publisher_embeddedrtps/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ void micro_ros_task(void * arg)
// create timer,
rcl_timer_t timer;
const unsigned int timer_timeout = 1000;
RCCHECK(rclc_timer_init_default(
RCCHECK(rclc_timer_init_default2(
&timer,
&support,
RCL_MS_TO_NS(timer_timeout),
timer_callback));
timer_callback,
true));

// create executor
rclc_executor_t executor;
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 @@ -82,11 +82,12 @@ void micro_ros_task(void * arg)
// Create timer.
rcl_timer_t timer = rcl_get_zero_initialized_timer();
const unsigned int timer_timeout = 1000;
RCCHECK(rclc_timer_init_default(
RCCHECK(rclc_timer_init_default2(
&timer,
&support,
RCL_MS_TO_NS(timer_timeout),
timer_callback));
timer_callback,
true));

// Create executor.
rclc_executor_t executor = rclc_executor_get_zero_initialized_executor();
Expand Down
5 changes: 3 additions & 2 deletions examples/low_consumption/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ void micro_ros_task(void * arg)
// create timer,
rcl_timer_t timer;
const unsigned int timer_timeout = 1000;
RCCHECK(rclc_timer_init_default(
RCCHECK(rclc_timer_init_default2(
&timer,
&support,
RCL_MS_TO_NS(timer_timeout),
timer_callback));
timer_callback,
true));

// create executor
rclc_executor_t executor;
Expand Down
41 changes: 22 additions & 19 deletions examples/parameters/main/main.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include <uros_network_interfaces.h>
#include <rcl/rcl.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rcl/rcl.h>
#include <rclc/executor.h>
#include <rclc/rclc.h>
#include <rclc_parameter/rclc_parameter.h>
#include <uros_network_interfaces.h>
#include <uxr/client/config.h>

#include <rmw_microros/rmw_microros.h>
#include <uxr/client/config.h>
Expand All @@ -27,30 +28,31 @@ void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
(void) timer;
(void) last_call_time;

int value;
int64_t value;
rclc_parameter_get_int(&param_server, "param2", &value);
value++;
rclc_parameter_set_int(&param_server, "param2", (int64_t) value);
rclc_parameter_set_int(&param_server, "param2", value);
}

void on_parameter_changed(Parameter * param)
{
printf("Parameter %s modified.", param->name.data);
switch (param->value.type)
bool on_parameter_changed(const Parameter *old_param, const Parameter *new_param, void *context)
{
printf("Parameter %s modified.", new_param->name.data);
switch (new_param->value.type)
{
case RCLC_PARAMETER_BOOL:
printf(" New value: %d (bool)", param->value.bool_value);
printf(" New value: %d (bool)", new_param->value.bool_value);
break;
case RCLC_PARAMETER_INT:
printf(" New value: %lld (int)", param->value.integer_value);
printf(" New value: %lld (int)", new_param->value.integer_value);
break;
case RCLC_PARAMETER_DOUBLE:
printf(" New value: %f (double)", param->value.double_value);
printf(" New value: %f (double)", new_param->value.double_value);
break;
default:
break;
}
printf("\n");
return true;
}

void micro_ros_task(void * arg)
Expand Down Expand Up @@ -79,15 +81,16 @@ void micro_ros_task(void * arg)

// create timer,
rcl_timer_t timer;
rclc_timer_init_default(
rclc_timer_init_default2(
&timer,
&support,
RCL_MS_TO_NS(1000),
timer_callback);
timer_callback,
true);

// Create executor
rclc_executor_t executor;
rclc_executor_init(&executor, &support.context, RCLC_PARAMETER_EXECUTOR_HANDLES_NUMBER + 1, &allocator);
rclc_executor_init(&executor, &support.context, RCLC_EXECUTOR_PARAMETER_SERVER_HANDLES + 1, &allocator);
rclc_executor_add_parameter_server(&executor, &param_server, on_parameter_changed);
rclc_executor_add_timer(&executor, &timer);

Expand All @@ -101,7 +104,7 @@ void micro_ros_task(void * arg)
rclc_parameter_set_double(&param_server, "param3", 0.01);

bool param1;
int param2;
int64_t param2;
double param3;

rclc_parameter_get_bool(&param_server, "param1", &param1);
Expand Down
5 changes: 3 additions & 2 deletions examples/ping_pong/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ void micro_ros_task(void * arg)
ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Header), "/microROS/pong"));


// Create a 3 seconds ping timer timer,
// Create a 2 seconds ping timer timer,
rcl_timer_t timer;
RCCHECK(rclc_timer_init_default(&timer, &support, RCL_MS_TO_NS(2000), ping_timer_callback));
RCCHECK(rclc_timer_init_default2(&timer, &support, RCL_MS_TO_NS(2000),
ping_timer_callback, true));


// Create executor
Expand Down
57 changes: 29 additions & 28 deletions libmicroros.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ $(EXTENSIONS_DIR)/esp32_toolchain.cmake: $(EXTENSIONS_DIR)/esp32_toolchain.cmake
$(EXTENSIONS_DIR)/micro_ros_dev/install:
rm -rf micro_ros_dev; \
mkdir micro_ros_dev; cd micro_ros_dev; \
git clone -b rolling https://github.com/ament/ament_cmake src/ament_cmake; \
git clone -b rolling https://github.com/ament/ament_lint src/ament_lint; \
git clone -b rolling https://github.com/ament/ament_package src/ament_package; \
git clone -b rolling https://github.com/ament/googletest src/googletest; \
git clone -b rolling https://github.com/ros2/ament_cmake_ros src/ament_cmake_ros; \
git clone -b rolling https://github.com/ament/ament_index src/ament_index; \
git clone -b kilted https://github.com/ament/ament_cmake src/ament_cmake; \
git clone -b kilted https://github.com/ament/ament_lint src/ament_lint; \
git clone -b kilted https://github.com/ament/ament_package src/ament_package; \
git clone -b kilted https://github.com/ament/googletest src/googletest; \
git clone -b kilted https://github.com/ros2/ament_cmake_ros src/ament_cmake_ros; \
git clone -b kilted https://github.com/ament/ament_index src/ament_index; \
touch src/ament_cmake_ros/rmw_test_fixture_implementation/COLCON_IGNORE; \
touch src/ament_cmake_ros/rmw_test_fixture/COLCON_IGNORE; \
colcon build --cmake-args -DBUILD_TESTING=OFF -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=gcc;

$(EXTENSIONS_DIR)/micro_ros_src/src:
Expand All @@ -54,37 +55,37 @@ $(EXTENSIONS_DIR)/micro_ros_src/src:
git clone -b main https://github.com/micro-ROS/rmw_embeddedrtps src/rmw_embeddedrtps; \
else \
git clone -b ros2 https://github.com/eProsima/Micro-XRCE-DDS-Client src/Micro-XRCE-DDS-Client; \
git clone -b rolling https://github.com/micro-ROS/rmw_microxrcedds src/rmw_microxrcedds; \
git clone -b kilted https://github.com/micro-ROS/rmw_microxrcedds src/rmw_microxrcedds; \
fi; \
git clone -b ros2 https://github.com/eProsima/micro-CDR src/micro-CDR; \
git clone -b rolling https://github.com/micro-ROS/rcl src/rcl; \
git clone -b rolling https://github.com/ros2/rclc src/rclc; \
git clone -b rolling https://github.com/micro-ROS/rcutils src/rcutils; \
git clone -b rolling https://github.com/micro-ROS/micro_ros_msgs src/micro_ros_msgs; \
git clone -b rolling https://github.com/micro-ROS/rosidl_typesupport src/rosidl_typesupport; \
git clone -b rolling https://github.com/micro-ROS/rosidl_typesupport_microxrcedds src/rosidl_typesupport_microxrcedds; \
git clone -b rolling https://github.com/ros2/rosidl src/rosidl; \
git clone -b rolling https://github.com/ros2/rosidl_dynamic_typesupport src/rosidl_dynamic_typesupport; \
git clone -b rolling https://github.com/ros2/rmw src/rmw; \
git clone -b rolling https://github.com/ros2/rcl_interfaces src/rcl_interfaces; \
git clone -b rolling https://github.com/ros2/rosidl_defaults src/rosidl_defaults; \
git clone -b rolling https://github.com/ros2/unique_identifier_msgs src/unique_identifier_msgs; \
git clone -b rolling https://github.com/ros2/common_interfaces src/common_interfaces; \
git clone -b rolling https://github.com/ros2/example_interfaces src/example_interfaces; \
git clone -b rolling https://github.com/ros2/test_interface_files src/test_interface_files; \
git clone -b rolling https://github.com/ros2/rmw_implementation src/rmw_implementation; \
git clone -b rolling https://github.com/ros2/rcl_logging src/rcl_logging; \
git clone -b rolling https://github.com/ros2/ros2_tracing src/ros2_tracing; \
git clone -b rolling https://github.com/micro-ROS/micro_ros_utilities src/micro_ros_utilities; \
git clone -b rolling https://github.com/ros2/rosidl_core src/rosidl_core; \
git clone -b kilted https://github.com/micro-ROS/rcl src/rcl; \
git clone -b kilted https://github.com/ros2/rclc src/rclc; \
git clone -b kilted https://github.com/micro-ROS/rcutils src/rcutils; \
git clone -b kilted https://github.com/micro-ROS/micro_ros_msgs src/micro_ros_msgs; \
git clone -b kilted https://github.com/micro-ROS/rosidl_typesupport src/rosidl_typesupport; \
git clone -b kilted https://github.com/micro-ROS/rosidl_typesupport_microxrcedds src/rosidl_typesupport_microxrcedds; \
git clone -b kilted https://github.com/ros2/rosidl src/rosidl; \
git clone -b kilted https://github.com/ros2/rosidl_dynamic_typesupport src/rosidl_dynamic_typesupport; \
git clone -b kilted https://github.com/ros2/rmw src/rmw; \
git clone -b kilted https://github.com/ros2/rcl_interfaces src/rcl_interfaces; \
git clone -b kilted https://github.com/ros2/rosidl_defaults src/rosidl_defaults; \
git clone -b kilted https://github.com/ros2/unique_identifier_msgs src/unique_identifier_msgs; \
git clone -b kilted https://github.com/ros2/common_interfaces src/common_interfaces; \
git clone -b kilted https://github.com/ros2/example_interfaces src/example_interfaces; \
git clone -b kilted https://github.com/ros2/test_interface_files src/test_interface_files; \
git clone -b kilted https://github.com/ros2/rmw_implementation src/rmw_implementation; \
git clone -b kilted https://github.com/ros2/rcl_logging src/rcl_logging; \
git clone -b kilted https://github.com/ros2/ros2_tracing src/ros2_tracing; \
git clone -b kilted https://github.com/micro-ROS/micro_ros_utilities src/micro_ros_utilities; \
git clone -b kilted https://github.com/ros2/rosidl_core src/rosidl_core; \
touch src/rosidl/rosidl_typesupport_introspection_cpp/COLCON_IGNORE; \
touch src/rcl_logging/rcl_logging_log4cxx/COLCON_IGNORE; \
touch src/rcl_logging/rcl_logging_spdlog/COLCON_IGNORE; \
touch src/rclc/rclc_examples/COLCON_IGNORE; \
touch src/rcl/rcl_yaml_param_parser/COLCON_IGNORE; \
touch src/ros2_tracing/test_tracetools/COLCON_IGNORE; \
touch src/ros2_tracing/lttngpy/COLCON_IGNORE; \
cp -rf $(EXTRA_ROS_PACKAGES) src/extra_packages || :; \
cp -rfL $(EXTRA_ROS_PACKAGES) src/extra_packages || :; \
test -f src/extra_packages/extra_packages.repos && cd src/extra_packages && vcs import --input extra_packages.repos || :;


Expand Down
3 changes: 2 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<name>micro_ros_espidf</name>
<version>6.0.0</version>
<description>micro-ROS tools for Espressif ESP-IDF</description>
<maintainer email="pablogarrido@eprosima.com">Pablo Garrido</maintainer>
<maintainer email="eugeniocollado@eprosima.com">Eugenio Collado</maintainer>
<maintainer email="carlosespinoza@eprosima.com">Carlos Espinoza</maintainer>
<license>Apache License 2.0</license>
</package>