diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dafb8633..a34a0812 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 \ No newline at end of file + idf.py build diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2705db55..ffb11c46 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -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: diff --git a/README.md b/README.md index e58112d7..b5de328b 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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 diff --git a/examples/handle_static_types/main/main.c b/examples/handle_static_types/main/main.c index 350c992b..91c187fc 100644 --- a/examples/handle_static_types/main/main.c +++ b/examples/handle_static_types/main/main.c @@ -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; diff --git a/examples/int32_publisher/main/main.c b/examples/int32_publisher/main/main.c index 2bedc4d1..5b8ebf71 100644 --- a/examples/int32_publisher/main/main.c +++ b/examples/int32_publisher/main/main.c @@ -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; diff --git a/examples/int32_publisher_custom_transport/main/main.c b/examples/int32_publisher_custom_transport/main/main.c index 11a7a2a1..22afb5b1 100644 --- a/examples/int32_publisher_custom_transport/main/main.c +++ b/examples/int32_publisher_custom_transport/main/main.c @@ -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; diff --git a/examples/int32_publisher_embeddedrtps/main/main.c b/examples/int32_publisher_embeddedrtps/main/main.c index ed676630..d08238c3 100644 --- a/examples/int32_publisher_embeddedrtps/main/main.c +++ b/examples/int32_publisher_embeddedrtps/main/main.c @@ -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; diff --git a/examples/int32_sub_pub/main/main.c b/examples/int32_sub_pub/main/main.c index 2a071339..2da217e5 100644 --- a/examples/int32_sub_pub/main/main.c +++ b/examples/int32_sub_pub/main/main.c @@ -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(); diff --git a/examples/low_consumption/main/main.c b/examples/low_consumption/main/main.c index 76bec315..cd7528ef 100644 --- a/examples/low_consumption/main/main.c +++ b/examples/low_consumption/main/main.c @@ -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; diff --git a/examples/parameters/main/main.c b/examples/parameters/main/main.c index 4460634d..1806788e 100644 --- a/examples/parameters/main/main.c +++ b/examples/parameters/main/main.c @@ -1,18 +1,19 @@ -#include #include +#include #include -#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 -#include #include -#include +#include #include +#include #include +#include +#include #include #include @@ -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(¶m_server, "param2", &value); value++; - rclc_parameter_set_int(¶m_server, "param2", (int64_t) value); + rclc_parameter_set_int(¶m_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) @@ -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, ¶m_server, on_parameter_changed); rclc_executor_add_timer(&executor, &timer); @@ -101,7 +104,7 @@ void micro_ros_task(void * arg) rclc_parameter_set_double(¶m_server, "param3", 0.01); bool param1; - int param2; + int64_t param2; double param3; rclc_parameter_get_bool(¶m_server, "param1", ¶m1); diff --git a/examples/ping_pong/main/main.c b/examples/ping_pong/main/main.c index 3ec12ec8..31b8e610 100644 --- a/examples/ping_pong/main/main.c +++ b/examples/ping_pong/main/main.c @@ -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 diff --git a/libmicroros.mk b/libmicroros.mk index af859701..8fd86c8d 100644 --- a/libmicroros.mk +++ b/libmicroros.mk @@ -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: @@ -54,29 +55,29 @@ $(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; \ @@ -84,7 +85,7 @@ $(EXTENSIONS_DIR)/micro_ros_src/src: 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 || :; diff --git a/package.xml b/package.xml index 76c5beaa..c0fdc9da 100644 --- a/package.xml +++ b/package.xml @@ -4,6 +4,7 @@ micro_ros_espidf 6.0.0 micro-ROS tools for Espressif ESP-IDF - Pablo Garrido + Eugenio Collado + Carlos Espinoza Apache License 2.0