Coder Social home page Coder Social logo

micro_ros_platformio's Introduction

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+

micro_ros_platformio's People

Contributors

acuadros95 avatar bjsowa avatar delihus avatar fischejo avatar hippo5329 avatar jkaflik avatar maru-n avatar pablogs9 avatar vonzeppelin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

micro_ros_platformio's Issues

Make `clean` target remove library's build artifacts

I was trying to rebuild the library after changing some settings. Running:

pio run

again did not rebuild the library so I tried to clean build artifacts first by running:

pio run -t clean

This also didn't work because the build artifacts of micro-ROS library are not recognized as project's build artifacts by PlatformIO.
I then tried the cleanall target:

pio run -t cleanall

which should completely remove the cloned library and its artifacts. It worked but I noticed it takes a really long time to finish, almost 10 minutes in my case.

I found out that running:

rm -rf .pio/libdeps

works but it doesn't feel "proper" for me.

Could not find a package configuration file provided by "rosidl_runtime_cpp" with any of the following names:

  • Hardware description: trying to target teensy 4.1 and building on Ubuntu 22.04 (native install)

Config file :

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
board_microros_transport = serial
lib_deps =
    https://github.com/micro-ROS/micro_ros_platformio

Error

Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.17.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES: 
 - framework-arduinoteensy @ 1.157.220801 (1.57) 
 - tool-teensy @ 1.157.0 (1.57) 
 - toolchain-gccarmnoneeabi @ 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/home/matt/.platformio/penv/bin/python -m pip install pyyaml
Requirement already satisfied: pyyaml in /home/matt/.platformio/penv/lib/python3.10/site-packages (6.0)
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/home/matt/.platformio/penv/bin/python -m pip install markupsafe==2.0.1
Requirement already satisfied: markupsafe==2.0.1 in /home/matt/.platformio/penv/lib/python3.10/site-packages (2.0.1)
Configuring teensy41 with transport serial
Downloading micro-ROS dev dependencies
         - Downloaded ament_cmake
         - Downloaded ament_lint
         - Downloaded ament_package
         - Downloaded googletest
         - Downloaded ament_cmake_ros
         - Downloaded ament_index
Building micro-ROS dev dependencies
Downloading micro-ROS library
         - Downloaded microcdr
         - Downloaded microxrcedds_client
         - Downloaded rcl_action
         - Downloaded rcl_yaml_param_parser (ignored)
         - Downloaded rcl_lifecycle
         - Downloaded rcl
         - Downloaded rclc_parameter
         - Downloaded rclc
         - Downloaded rclc_lifecycle
         - Downloaded rclc_examples (ignored)
         - Downloaded micro_ros_utilities
         - Downloaded rcutils
         - Downloaded micro_ros_msgs
         - Downloaded rmw_microxrcedds
         - Downloaded rosidl_typesupport_c
         - Downloaded rosidl_typesupport_cpp (ignored)
         - Downloaded rosidl_typesupport_microxrcedds_cpp (ignored)
         - Downloaded rosidl_typesupport_microxrcedds_c
         - Downloaded rosidl_typesupport_microxrcedds_c_tests
         - Downloaded rosidl_typesupport_microxrcedds_cpp_tests
         - Downloaded rosidl_typesupport_microxrcedds_test_msg
         - Downloaded rosidl_typesupport_introspection_cpp (ignored)
         - Downloaded rosidl_typesupport_interface
         - Downloaded rosidl_adapter
         - Downloaded rosidl_cmake
         - Downloaded rosidl_runtime_cpp (ignored)
         - Downloaded rosidl_runtime_c
         - Downloaded rosidl_generator_cpp (ignored)
         - Downloaded rosidl_typesupport_introspection_c
         - Downloaded rosidl_parser
         - Downloaded rosidl_cli
         - Downloaded rosidl_generator_c
         - Downloaded rosidl_typesupport_introspection_tests
         - Downloaded rmw_implementation_cmake
         - Downloaded rmw
         - Downloaded rosgraph_msgs
         - Downloaded rcl_interfaces
         - Downloaded test_msgs
         - Downloaded builtin_interfaces
         - Downloaded statistics_msgs
         - Downloaded lifecycle_msgs
         - Downloaded action_msgs
         - Downloaded composition_interfaces
         - Downloaded rosidl_default_generators
         - Downloaded rosidl_default_runtime
         - Downloaded unique_identifier_msgs
         - Downloaded diagnostic_msgs
         - Downloaded sensor_msgs
         - Downloaded stereo_msgs
         - Downloaded std_srvs
         - Downloaded sensor_msgs_py
         - Downloaded nav_msgs
         - Downloaded common_interfaces
         - Downloaded visualization_msgs
         - Downloaded actionlib_msgs
         - Downloaded trajectory_msgs
         - Downloaded std_msgs
         - Downloaded shape_msgs
         - Downloaded geometry_msgs
         - Downloaded test_interface_files
         - Downloaded rmw_implementation
         - Downloaded test_rmw_implementation
         - Downloaded rcl_logging_spdlog (ignored)
         - Downloaded rcl_logging_interface
         - Downloaded rcl_logging_noop
         - Downloaded test_tracetools
         - Downloaded tracetools_read
         - Downloaded test_tracetools_launch
         - Downloaded tracetools_launch
         - Downloaded tracetools_test
         - Downloaded tracetools
         - Downloaded tracetools_trace
         - Downloaded ros2trace
         - Extra packages folder not found, skipping...
Building micro-ROS library
Build mcu micro-ROS environment failed: 
--- stderr: rcutils
In file included from /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c:35:0:
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h: In function '__rcutils_convert_uint64_t_into_c_str':
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h:109:48: warning: unused parameter 'number' [-Wunused-parameter]
 __rcutils_convert_uint64_t_into_c_str(uint64_t number, char * buffer, size_t buffer_size)
                                                ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h:109:63: warning: unused parameter 'buffer' [-Wunused-parameter]
 __rcutils_convert_uint64_t_into_c_str(uint64_t number, char * buffer, size_t buffer_size)
                                                               ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h:109:78: warning: unused parameter 'buffer_size' [-Wunused-parameter]
 __rcutils_convert_uint64_t_into_c_str(uint64_t number, char * buffer, size_t buffer_size)
                                                                              ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h: In function '__rcutils_format_error_string':
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h:142:28: warning: unused parameter 'error_string' [-Wunused-parameter]
   rcutils_error_string_t * error_string,
                            ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h:143:33: warning: unused parameter 'error_state' [-Wunused-parameter]
   const rcutils_error_state_t * error_state)
                                 ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c: In function 'rcutils_get_error_string':
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c:240:38: warning: initializer-string for array of chars is too long
     return (rcutils_error_string_t) {"error not set"};  // NOLINT(readability/braces)
                                      ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c:240:38: note: (near initialization for '(anonymous).str')
In file included from /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c:35:0:
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/error_handling.c: At top level:
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h:91:1: warning: '__rcutils_reverse_str' defined but not used [-Wunused-function]
 __rcutils_reverse_str(char * string_in, size_t string_len)
 ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/./error_handling_helpers.h:109:1: warning: '__rcutils_convert_uint64_t_into_c_str' defined but not used [-Wunused-function]
 __rcutils_convert_uint64_t_into_c_str(uint64_t number, char * buffer, size_t buffer_size)
 ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/logging.c: In function 'rcutils_get_env_var_zero_or_one':
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/logging.c:130:35: warning: unused parameter 'zero_semantic' [-Wunused-parameter]
   const char * name, const char * zero_semantic,
                                   ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/logging.c:131:16: warning: unused parameter 'one_semantic' [-Wunused-parameter]
   const char * one_semantic)
                ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/time_unix.c:47:4: warning: #warning is a GCC extension
 #  warning no monotonic clock function available
    ^
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/time_unix.c:47:4: warning: #warning no monotonic clock function available [-Wcpp]
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/time_unix.c: In function 'rcutils_system_time_now':
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/rcutils/src/time_unix.c:69:3: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
   clock_gettime(CLOCK_REALTIME, &timespec_now);
   ^
---
--- stderr: tracetools_trace
/home/matt/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
--- stderr: tracetools_read
/home/matt/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
--- stderr: rosidl_cli
/home/matt/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
--- stderr: microxrcedds_client
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/Micro-XRCE-DDS-Client/src/c/util/time.c: In function 'uxr_nanos':
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/Micro-XRCE-DDS-Client/src/c/util/time.c:60:5: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
     clock_gettime(CLOCK_REALTIME, &ts);
     ^
---
--- stderr: rcl_logging_interface
CMake Warning at /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'rcutils' exports library 'dl' which couldn't be found
Call Stack (most recent call first):
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
  CMakeLists.txt:19 (find_package)


---
--- stderr: rosidl_runtime_c
CMake Warning at /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'rcutils' exports library 'dl' which couldn't be found
Call Stack (most recent call first):
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
  CMakeLists.txt:15 (find_package)


---
--- stderr: tracetools_launch
/home/matt/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
--- stderr: rcl_logging_noop
CMake Warning at /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'rcutils' exports library 'dl' which couldn't be found
Call Stack (most recent call first):
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcl_logging_interface/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcl_logging_interface/cmake/rcl_logging_interfaceConfig.cmake:41 (include)
  CMakeLists.txt:15 (find_package)


---
--- stderr: ros2trace
/home/matt/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
--- stderr: rmw
CMake Warning at /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'rcutils' exports library 'dl' which couldn't be found
Call Stack (most recent call first):
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
  CMakeLists.txt:21 (find_package)


---
--- stderr: tracetools_test
/home/matt/.platformio/penv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
--- stderr: rosidl_typesupport_microxrcedds_c
CMake Warning at /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'rcutils' exports library 'dl' which couldn't be found
Call Stack (most recent call first):
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_runtime_c/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_runtime_c/cmake/rosidl_runtime_cConfig.cmake:41 (include)
  CMakeLists.txt:22 (find_package)


---
--- stderr: micro_ros_utilities
CMake Warning at /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'rcutils' exports library 'dl' which couldn't be found
Call Stack (most recent call first):
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_runtime_c/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_runtime_c/cmake/rosidl_runtime_cConfig.cmake:41 (include)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_typesupport_introspection_c/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_typesupport_introspection_c/cmake/rosidl_typesupport_introspection_cConfig.cmake:41 (include)
  CMakeLists.txt:18 (find_package)


/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/micro_ros_utilities/src/type_utilities.c: In function 'print_type_info':
/home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/src/micro_ros_utilities/src/type_utilities.c:96:31: warning: format '%u' expects argument of type 'unsigned int', but argument 7 has type 'uint32_t {aka const long unsigned int}' [-Wformat=]
       buffer, sizeof(buffer), "%sIntrospection for %s/%s - %u members, %zu B\n",
                               ^
---
--- stderr: rosidl_typesupport_c
CMake Warning at /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'rcutils' exports library 'dl' which couldn't be found
Call Stack (most recent call first):
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
  CMakeLists.txt:33 (find_package)


---
--- stderr: unique_identifier_msgs
CMake Warning at /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'rcutils' exports library 'dl' which couldn't be found
Call Stack (most recent call first):
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rcutils/cmake/rcutilsConfig.cmake:41 (include)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_runtime_c/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_runtime_c/cmake/rosidl_runtime_cConfig.cmake:41 (include)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_typesupport_introspection_c/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_typesupport_introspection_c/cmake/rosidl_typesupport_introspection_cConfig.cmake:41 (include)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_typesupport_c/cmake/rosidl_typesupport_c-extras.cmake:13 (find_package)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_typesupport_c/cmake/rosidl_typesupport_cConfig.cmake:41 (include)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_default_generators/cmake/rosidl_default_generators-extras.cmake:21 (find_package)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_default_generators/cmake/rosidl_default_generatorsConfig.cmake:41 (include)
  CMakeLists.txt:15 (find_package)


CMake Error at /home/matt/microros_ws/install/rosidl_typesupport_microxrcedds_cpp/share/rosidl_typesupport_microxrcedds_cpp/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package):
  By not providing "Findrosidl_runtime_cpp.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "rosidl_runtime_cpp", but CMake did not find one.

  Could not find a package configuration file provided by
  "rosidl_runtime_cpp" with any of the following names:

    rosidl_runtime_cppConfig.cmake
    rosidl_runtime_cpp-config.cmake

  Add the installation prefix of "rosidl_runtime_cpp" to CMAKE_PREFIX_PATH or
  set "rosidl_runtime_cpp_DIR" to a directory containing one of the above
  files.  If "rosidl_runtime_cpp" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  /home/matt/microros_ws/install/rosidl_typesupport_microxrcedds_cpp/share/rosidl_typesupport_microxrcedds_cpp/cmake/rosidl_typesupport_microxrcedds_cppConfig.cmake:41 (include)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_default_generators/cmake/rosidl_default_generators-extras.cmake:21 (find_package)
  /home/matt/projects/Embedded-UAV-Cooperative-Localisation/src/teensy/simple-publisher/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rosidl_default_generators/cmake/rosidl_default_generatorsConfig.cmake:41 (include)
  CMakeLists.txt:15 (find_package)


---
Failed   <<< unique_identifier_msgs [0.57s, exited with code 1]

======================================================================= [FAILED] Took 67.58 seconds =======================================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Steps to reproduce the issue

  1. Follow teensy_with_arduino guide without docker container
  2. Build the sample publisher package

ESP32 multi-core panic

  • Hardware description: esp32-s3-devkitc-1
  • RTOS: FreeRTOS
  • Installation type: PlatformIO
  • Version or commit hash: humble

Hello, I am trying to use the two ESP32 cores to do separate task, where core 1 handles robot controls and core 0 handles MicroROS.
I made a test script to see if this is feasible, where core 0 runs a task that contains rclc_executor_spin() that has a timer that publishes to a counter topic and core1 runs a dummy serial print task.

Sample code

#include <Arduino.h>

#include <micro_ros_platformio.h>
#include <stdio.h>
#include <rcl/rcl.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>

#include <std_msgs/msg/int32.h>
#include <geometry_msgs/msg/vector3.h>

#if !defined(ESP32) && !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_NANO_RP2040_CONNECT)
#error This example is only avaible for Arduino Portenta, Arduino Nano RP2040 Connect and ESP32 Dev module
#endif

#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}


rcl_publisher_t publisher;
std_msgs__msg__Int32 msg;
const char * publisher_topic_name = "/counter_test1";

rclc_executor_t executor;
rclc_support_t support;
rcl_allocator_t allocator;

rcl_node_t node;
rcl_timer_t timer;

/* End of MicroROS variables */
IPAddress agent_ip(192, 168, 1, 130);
size_t agent_port = 8888;
char ssid[] = "WIFI";
char psk[]= "PASS";

// Error handle loop
void error_loop() {
  while(1) {
  }
}

void rclc_executor_task(void *parameter)
{
	RCSOFTCHECK(rclc_executor_spin(&executor));
}

void dummy_task(void *parameter)
{
	Serial.println("Hello world");
}

void timer_callback(rcl_timer_t * timer, int64_t last_call_time)
{
  RCLC_UNUSED(last_call_time);
  if (timer != NULL) 
  {
	// display the data
    msg.data++;
    RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
	Serial.println("Publishing and incrementing counter msg!!");
  }
}

void setup() {
	// serial to display data
	Serial.begin(115200);
	Serial.println("Begin simple test");
	Serial.println(xPortGetCoreID());

	/* MicroROS stuff */ 
	set_microros_wifi_transports(ssid, psk, agent_ip, agent_port);
	delay(1000);

	allocator = rcl_get_default_allocator();

	//create init_options
	RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

	// create node
	RCCHECK(rclc_node_init_default(&node, "micro_ros_platformio_wifi_node", "", &support));

	// create best effort publishers
	RCCHECK(rclc_publisher_init_best_effort(
	&publisher,
	&node,
	ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32),
	publisher_topic_name));

	// create a msg timer that is triggered every 1000ms
	RCCHECK(rclc_timer_init_default(
		&timer,
		&support,
		RCL_MS_TO_NS(1000),
		timer_callback));

	// create executor
	RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
	RCCHECK(rclc_executor_add_timer(&executor, &timer));	
	
	msg.data = 0;

	Serial.println("Done set up");
	xTaskCreatePinnedToCore(  // Use xTaskCreate() in vanilla FreeRTOS
				dummy_task,     // Function to be called
				"Test",  // Name of task
				1048,           // Stack size (bytes in ESP32, words in FreeRTOS)
				NULL,           // Parameter to pass
				1,              // Task priority (must be same to prevent lockup)
				NULL,           // Task handle
				1);       // Run on one core for demo purposes (ESP32 only)

	xTaskCreatePinnedToCore(  // Use xTaskCreate() in vanilla FreeRTOS
				rclc_executor_task,     // Function to be called
				"Test2",  // Name of task
				1048,           // Stack size (bytes in ESP32, words in FreeRTOS)
				NULL,           // Parameter to pass
				2,              // Task priority (must be same to prevent lockup)
				NULL,           // Task handle
				0);       // Run on one core for demo purposes (ESP32 only)
}

void loop() {
	// Run the executor 
	// RCSOFTCHECK(rclc_executor_spin(&executor));
}

Expected behavior

Able to see ROS2 counter topic and debug output from serial port.

Actual behavior

ESP32 crash and kept on restarting itself.
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled, below is a screenshot of the ouput
image

Thanks!

Problem Building under Windows 10

Issue template

  • Hardware description: Arduino zero
  • Version or commit hash: Galaxy

Steps to reproduce the issue

building works under linux, but build on windows fails during build of micro-ROS dev environment (gtest_vendor)

Expected behavior

Actual behavior

Additional information

Error message:

 --- stderr: gtest_vendor

Traceback (most recent call last):

  File "C:\Users\isk5wi\.platformio\penv\lib\site-packages\colcon_core\executor\__init__.py", line 91, in __call__

    rc = await self.task(*args, **kwargs)

  File "C:\Users\isk5wi\.platformio\penv\lib\site-packages\colcon_core\task\__init__.py", line 93, in __call__

    return await task_method(*args, **kwargs)

  File "C:\Users\isk5wi\.platformio\penv\lib\site-packages\colcon_ros\task\cmake\build.py", line 35, in build

    rc = await extension.build(

  File "C:\Users\isk5wi\.platformio\penv\lib\site-packages\colcon_cmake\task\cmake\build.py", line 87, in build

    rc = await self._reconfigure(args, env)

  File "C:\Users\isk5wi\.platformio\penv\lib\site-packages\colcon_cmake\task\cmake\build.py", line 153, in _reconfigure

    raise RuntimeError(

RuntimeError: VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.

---

Failed   <<< gtest_vendor [2.80s, exited with code 1]

VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.

[Debian10] Failed to build microros library due to missing file

Hardware description: ESP32, Debian10 running in VirtualBox
Version or commit hash: 87baf5e
Steps to reproduce the issue
clone 4ef4b18
open examples/ESP32 project with Platformio
try building
OR

Create new ESP32 platformio project
Add lines below to platformio.ini
microros_transport = serial
microros_distro = galactic
lib_deps =
https://github.com/micro-ROS/micro_ros_platformio
Try building
Expected behavior
code compiles with microros library

Actual behavior
Could not paste actual log, VirtualBox misbehaving
image

set_microros_wifi_transports() invocation hangs with provided example

Issue template

  • Hardware description: esp32dev
  • RTOS: arduino
  • Installation type: pio
  • Version or commit hash: main

Steps to reproduce the issue

I'm trying to get the publisher example working over wifi, with the following platformio.ini file contents:

[env]
monitor_speed = 115200
upload_speed = 921600

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
board_microros_transport = wifi
lib_deps =
    https://github.com/micro-ROS/micro_ros_platformio

The code in Main.cpp is mostly unchanged, except for the wifi setup steps as instructed in the micro_ros_platformio documentation:

const char* ssid = "My-Wifi-Network";
const char* password = "My-Wifi-Password";
const size_t agent_port = 8888;
IPAddress agent_ip(192, 168, 1, 219);
...

void setup() {
    Serial.begin(115200);
    Serial.print("Initializing...");
    set_microros_wifi_transports((char*)ssid, (char*)password, agent_ip, agent_port);
    Serial.print("Done!");
}
...

I'm also running the agent on the host using docker, as follows:

> docker run -it --rm --net=host microros/micro-ros-agent:galactic udp4 -p 8888 -v 6

...with output:

[1653609707.462781] info     | UDPv4AgentLinux.cpp | init                     | running...             | port: 8888
[1653609707.463000] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 6

I then ran the following steps to build and upload the uros client:

> pio lib install
    <Succeeded>
> pio run
    <Succeeded>
> pio run -t upload
   <Succeeded>
> pio device monitor

Expected behavior

I should start seeing messages being published to a ROS2 topic.

Actual behavior

set_microros_wifi_transports() hangs, and there is nothing printed to the serial monitor after that point:

--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Initializing...
  • As per the code, a Done! should be printed after the transport initialization. However, it never gets to that point.
  • Also, on the agent, no additional logs show up beyond the two lines that were printed at agent startup:
> docker run -it --rm --net=host microros/micro-ros-agent:galactic udp4 -p 8888 -v 6
[1653609707.462781] info     | UDPv4AgentLinux.cpp | init                     | running...             | port: 8888
[1653609707.463000] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 6

What am I missing?

Additional information

The host computer (on which the agent is running) has the following ifconfig output (which I have reflected in the wifi connection params in Main.cpp):

wlp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.219  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::65cb:1978:7797:6d81  prefixlen 64  scopeid 0x20<link>
        ether f8:63:3f:df:fe:ad  txqueuelen 1000  (Ethernet)
        RX packets 1865460  bytes 1437880778 (1.4 GB)
        RX errors 0  dropped 6  overruns 0  frame 0
        TX packets 530456  bytes 108092270 (108.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I've separately verified that the ESP32 board's wifi IS working (using the Wifi.h library):

Connecting to wifi........
WiFi connected!
Assigned IP Address: 192.168.1.44

My environment settings on the agent/host are:

RMW_IMPLEMENTATION=rmw_fastrtps_cpp
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_LOCALHOST_ONLY=0
ROS_DISTRO=galactic

Intellisense in VS Code not working with micro_ros_platformio

First of all I want to thank you guys to support PlatformIO, we really appreciate it!

Previously we were working in PlatformIO with micro_ros_arduino. I ported the project to this new repo and everything compiles fine except that Intellisense in VS Code is not recognizing #include <micro_ros_platformio.h> anymore, so syntax highlight in micro-ROS is not working.

PlatformIO correctly adds micro_ros_platformio in c_cpp_properties.json, I also tried to rebuild Intellisense index with no luck. Any help is welcome. Thanks!

  • Hardware description: Teensy 3.2
  • Version or commit hash: Ubuntu 20.04 galactic, main branch last commit, platformio 6.0.1, vs code 1.67.2, c/c++ extension 1.9.8

Steps to reproduce the issue

  • Clone this repository
  • Go to /ci folder
  • Open VS Code
  • Check that PlatformIO and C/C++ extensions are installed and active
  • Open PlatformIO terminal:
pio lib install
pio run
pio run --target upload

Expected behavior

Intellisense should work, #include <micro_ros_platformio.h> is found and code highlight works

Actual behavior

Intellisense is not working, #include <micro_ros_platformio.h> not found.
Error: #include errors detected. Please update your includePath. Squiggles are disabled for this translation unit

Compilation problem when adding tf2 package

Issue template

  • Hardware description: ESP32
  • RTOS: FreeRTOS
  • Installation type:
  • Version or commit hash: galactic

Steps to reproduce the issue

I would like to add tf2 package to the build.
I have updated extra_packages.repo as such :

repositories:
  tf2:
    type: git
    url: https://github.com/ros2/geometry2
    version: galactic

I cleaned the build and made a pio run

Expected behavior

Build OK

Actual behavior

The compilation failed complaining about hpp (geom_msg) files not found in the code of tf2. Indeed they are present with the .h extension but not the hpp extension.

Trying to patch tf2 to replace hpp by h include failed also (complain about the namespace usage of tf2).

It seams that idl is producing c file and not cpp files, any clue ? or something I miss ?
Thanks in advance !

Allow freezing the micro-ROS package versions

I got back to working on my project after a couple of months. When I tried to build it, it no longer compiled because the library builder pulled newer version of micro-ROS packages that contained API changes that were not compatible with my code.

I think this library should either be tied to specific versions of the packages and have a library auto-update workflow (similar to the on micro_ros_arduino) or allow the user to specify the versions.

Supported msg types

What are the supported message types for this library?

micro_ros_arduino arduino provides a list of precompiled ROS 2 types but I cannot find something similar here.

I thought it might be the same between the two packages but I am getting the following error when trying to create a subscriber

image

Wifi support - Status unclear

Issue template

  • Hardware description: ESP32

Steps to reproduce the issue

Check readme https://github.com/micro-ROS/micro_ros_platformio#transport-configuration
Check code https://github.com/micro-ROS/micro_ros_platformio/blob/main/platform_code/arduino/wifi/micro_ros_transport.cpp

Expected behavior

ROS2 computer can communicate with ESP32 device using wifi. This is documented in the readme.

Actual behavior

Wifi support is undocumented

Additional information

If it's not yet implemented I might try this https://github.com/NITKK-ROS-Team/micro_ros_arduino_simpler#readme as it supports wifi I think.

Code stuck at "RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));"

  • Hardware description: Heltec ESP32 LoRa v2
  • Installation type: microROS platformIO configured with Arduino platform
  • Version or commit hash: Foxy

My code ran before, but I've changed my platformIO environment (same installation methods...)

Steps to reproduce the issue

void setup() {
  // ----------- Configure serial transport
  Serial.begin(115200);
  // set_microros_serial_transports(Serial);

  //****** For Main WiFi....
  IPAddress agent_ip(---, ---, -, --);
  size_t agent_port = 8888;
  char ssid[] = "------------";
  char psk[]= "--------------";

  set_microros_wifi_transports(ssid, psk, agent_ip, agent_port);

  //multiarray initialization
  msg2.data.capacity = 10;
  msg2.data.data =  (float*)infoBuffer;
  msg2.data.size = 10;

  SPI2.begin(H_CLK, H_MISO, H_MOSI, H_CS);
  // cli();
  delay(500);
  SetupSD();
  delay(100);
  
  Wire.begin(4, 15);
  // Wire.begin();
  delay(100);
  Wire.setClock(400000); //fast mode
  delay(100);

  delay(2000);
  Serial.println("Initialized...");

  //create Mutex/Semaphores
//   GPSMutex = xSemaphoreCreateMutex();
//   IMUMutex = xSemaphoreCreateMutex();
//   LORAMutex = xSemaphoreCreateMutex();
//   xTaskCreatePinnedToCore(update_latitude_and_longitude, "update_latitude_and_longitude", 8912, NULL, 1, &Task1, 1);
//   delay(100); //important delay
//   xTaskCreatePinnedToCore(update_IMU_data, "update_IMU_data", 8912, NULL, 1, &Task2, 1);
//   delay(100); //important delay

  //=========================ROS2 stuff setup..............===================
  Serial.println("ROS2 Allocator...");
  allocator = rcl_get_default_allocator();
  Serial.println("ROS2 Allocated...");
  //create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));   <------------STUCK HERE********
Serial.println("ROS2 Node Creating...");
  // create node
  RCCHECK(rclc_node_init_default(&node, "micro_ros_platformio_node", "", &support));
Serial.println("ROS2 Node Created...");

  // // create publisher2
  RCCHECK(rclc_publisher_init_best_effort(
    &publisher,
    &node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Float32MultiArray),
    "micro_ros_my_custom_publisher"));

  // create timer,
  const unsigned int timer_timeout = 1000; //this is the speed on which it is published, set to 1 for extra speed
  RCCHECK(rclc_timer_init_default(
    &timer,
    &support,
    RCL_MS_TO_NS(timer_timeout),
    timer_callback));

  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_timer(&executor, &timer));

  msg.data = 0;
}

Expected behavior

Executes properly in the Setup()

Actual behavior

Got executes up to the line RCCHECK(rclc_support_init(&support, 0, NULL, &allocator)); then stops there...

Additional information

Compilation Error

Issue template

  • Hardware description: Teensy 4.1

  • RTOS: micro-ROS arduino

  • Version or commit hash: main

Steps to reproduce the issue

platform.ini file:

[env:teensy41]
platform = teensy
board = teensy41
board_microros_distro = galactic
board_microros_transport = serial
framework = arduino
lib_deps = 
	https://github.com/micro-ROS/micro_ros_platformio

Expected behavior

compile

Actual behavior

Error

Requirement already satisfied: markupsafe==2.0.1 in c:\users\v-mifass\.platformio\penv\lib\site-packages (2.0.1)
Configuring teensy41 with transport serial
Downloading micro-ROS dev dependencies
ament_cmake clone failed: 
fatal: Too many arguments.

Additional information

Handling String type Publisher messege

Issue template

I'm trying to publish String type message, but having some trouble doing it in the microROS version.

  • Hardware description: ESP32 Heltec LoRa v2
  • Installation type: microROS PlatformIO
  • Version or commit hash: Linux 20.04 with Foxy ROS2

Steps to reproduce the issue

platformIO.ini

[env:esp32doit-devkit-v1]
; [env: heltec_wifi_lora_32_V2]
platform = espressif32
board = esp32doit-devkit-v1
; board = heltec_wifi_lora_32_V2
board_microros_transport = wifi ;serial ;wifi ;wifi_nina
board_microros_distro = foxy
framework = arduino
monitor_speed = 115200
lib_deps =
    adafruit/Adafruit BusIO @ ^1.12.0
    sparkfun/SparkFun u-blox GNSS Arduino Library @ ^2.2.10
    https://github.com/micro-ROS/micro_ros_platformio # for microROS
    stevemarple/SoftWire @ ^2.0.9
    stevemarple/AsyncDelay @ ^1.1.2
    adafruit/RTClib @ ^2.0.3

main.cpp

#include <Arduino.h>
#include <micro_ros_platformio.h>

#include <rcl/rcl.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <micro_ros_utilities/type_utilities.h>
#include <micro_ros_utilities/string_utilities.h>

#include <std_msgs/msg/int32.h> //for integer messages
#include <std_msgs/msg/string.h>

#include "freertos/FreeRTOS.h"      // freeRTOS Libraries 
#include "freertos/task.h"          // freeRTOS Task Header
#include "esp_system.h"
#include "soc/rtc_wdt.h"   
#include <mySD.h>
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>

//publisher initialization
rcl_publisher_t publisher;
rcl_publisher_t publisher2;
std_msgs__msg__Int32 msg;
std_msgs__msg__String msg_gps;


//rclc initialization...
rclc_executor_t executor;
rclc_support_t support;
rcl_allocator_t allocator;
rcl_node_t node;
rcl_timer_t timer;

#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}

// Error handle loop
void error_loop() {
  while(1) {
    delay(100);
  }
}

//This is the function where the message data is set and the msg are actually published. RCLCPP_INFO macro ensures every published msg is printed to the console
void timer_callback(rcl_timer_t * timer, int64_t last_call_time) {
  RCLC_UNUSED(last_call_time);
  if (timer != NULL) {
    RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));

    msg.data+=1;
  }
}

void setup() {
  // ----------- Configure serial transport
  Serial.begin(115200);
  // set_microros_serial_transports(Serial);

  //***** For Router WiFi....
  IPAddress agent_ip(---, ---, --, --);
  size_t agent_port = 8888;
  char ssid[] = "----------";
  char psk[]= "----------";

  set_microros_wifi_transports(ssid, psk, agent_ip, agent_port);

  //=========================ROS2 stuff setup..............===================
  allocator = rcl_get_default_allocator();

  //create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&node, "micro_ros_platformio_node", "", &support));

  // create publisher
  RCCHECK(rclc_publisher_init_default(
    &publisher,
    &node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32),
    "micro_ros_platformio_node_publisher"));

  // create publisher2
  RCCHECK(rclc_publisher_init_default(
    &publisher2,
    &node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg_gps, String),
    "micro_ros_platformio_node_publisher_lat"));

  // micro_ros_utilities_create_message_memory(
  //   ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg_gps, String),
  //   &msg_gps,
  //   (micro_ros_utilities_memory_conf_t) {}
  // );


  // create timer,
  const unsigned int timer_timeout = 1000;
  RCCHECK(rclc_timer_init_default(
    &timer,
    &support,
    RCL_MS_TO_NS(timer_timeout),
    timer_callback));

  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_timer(&executor, &timer));

  msg.data = 0;
}

void loop() {
  delay(100);
  RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)));
}

Error message: pio run

src/main.cpp: In function 'void setup()':
.pio/libdeps/esp32doit-devkit-v1/micro_ros_platformio/libmicroros/include/rosidl_runtime_c/message_type_support_struct.h:78:5: error: 'rosidl_typesupport_c__get_message_type_support_handle__std_msgs__msg_gps__String' was not declared in this scope
     rosidl_typesupport_c, PkgName, MsgSubfolder, MsgName)()
     ^~~~~~~~~~~~~~~~~~~~
src/main.cpp:39:43: note: in definition of macro 'RCCHECK'
 #define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
                                           ^~
.pio/libdeps/esp32doit-devkit-v1/micro_ros_platformio/libmicroros/include/rosidl_typesupport_interface/macros.h:27:3: note: in expansion of macro 'ROSIDL_TYPESUPPORT_INTERFACE__SYMBOL_NAME'
   ROSIDL_TYPESUPPORT_INTERFACE__SYMBOL_NAME( \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/micro_ros_platformio/libmicroros/include/rosidl_runtime_c/message_type_support_struct.h:77:3: note: in expansion of macro 'ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME'
   ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME( \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.cpp:277:5: note: in expansion of macro 'ROSIDL_GET_MSG_TYPE_SUPPORT'
     ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg_gps, String),
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/micro_ros_platformio/libmicroros/include/rosidl_runtime_c/message_type_support_struct.h:78:5: note: suggested alternative: 'rosidl_typesupport_c__get_message_type_support_handle__std_msgs__msg__String'
     rosidl_typesupport_c, PkgName, MsgSubfolder, MsgName)()
     ^~~~~~~~~~~~~~~~~~~~
src/main.cpp:39:43: note: in definition of macro 'RCCHECK'
 #define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
                                           ^~
.pio/libdeps/esp32doit-devkit-v1/micro_ros_platformio/libmicroros/include/rosidl_typesupport_interface/macros.h:27:3: note: in expansion of macro 'ROSIDL_TYPESUPPORT_INTERFACE__SYMBOL_NAME'
   ROSIDL_TYPESUPPORT_INTERFACE__SYMBOL_NAME( \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/micro_ros_platformio/libmicroros/include/rosidl_runtime_c/message_type_support_struct.h:77:3: note: in expansion of macro 'ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME'
   ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME( \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.cpp:277:5: note: in expansion of macro 'ROSIDL_GET_MSG_TYPE_SUPPORT'
     ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg_gps, String),
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
*** [.pio/build/esp32doit-devkit-v1/src/main.cpp.o] Error 1

Expected behavior

Publishing String type messege

Actual behavior

Additional information

ament_cmake clone failed: fatal: Too many arguments.

Issue template

Having trouble building the micro-ros

Downloading micro-ROS dev dependencies
ament_cmake clone failed: 
fatal: Too many arguments.

usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --progress            force progress reporting
    --reject-shallow      don't clone shallow repository
    -n, --no-checkout     don't create a checkout
    --bare                create a bare repository
    --mirror              create a mirror repository (implies bare)
    -l, --local           to clone from a local repository
    --no-hardlinks        don't use local hardlinks, always copy
    -s, --shared          setup as shared repository
    --recurse-submodules[=<pathspec>]
                          initialize submodules in the clone
    --recursive ...       alias of --recurse-submodules
    -j, --jobs <n>        number of submodules cloned in parallel
    --template <template-directory>
                          directory from which templates will be used
    --reference <repo>    reference repository
    --reference-if-able <repo>
                          reference repository
    --dissociate          use --reference only while cloning
    -o, --origin <name>   use <name> instead of 'origin' to track upstream
    -b, --branch <branch>
                          checkout <branch> instead of the remote's HEAD
    -u, --upload-pack <path>
                          path to git-upload-pack on the remote
    --depth <depth>       create a shallow clone of that depth
    --shallow-since <time>
                          create a shallow clone since a specific time
    --shallow-exclude <revision>
                          deepen history of shallow clone, excluding rev
    --single-branch       clone only one branch, HEAD or --branch
    --no-tags             don't clone any tags, and make later fetches not to follow them
    --shallow-submodules  any cloned submodules will be shallow
    --separate-git-dir <gitdir>
                          separate git dir from working tree
    -c, --config <key=value>
                          set config inside the new repository
    --server-option <server-specific>
                          option to transmit
    -4, --ipv4            use IPv4 addresses only
    -6, --ipv6            use IPv6 addresses only
    --filter <args>       object filtering
    --also-filter-submodules
                          apply partial clone filters to submodules
    --remote-submodules   any cloned submodules will use their remote-tracking branch
    --sparse              initialize sparse-checkout file to include only files at root


========================================================================================== [FAILED] Took 4.28 seconds ==========================================================================================

  • Hardware description: Teensy 4.1, developing on windows 11

config file

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
board_microros_distro = humble
board_microros_transport = serial
lib_deps = 
    https://github.com/micro-ROS/micro_ros_platformio

Steps to reproduce the issue

Click on the build button in VS code

How do I include rclcpp (and dependencies) into the libmicro_ros_platformio.a library?

I understand that the use of rclcpp (i.e, c++) should be done carefully, because of the higher resource requirements it will impose on the MCU. But I'm using an ESP32, and only plan to run 1 rclcpp::Node instance on it, with 1-2 services, and perhaps 1 diagnostic messages publisher. I presume that should be manageable on an ESP32.

However, after adding a few of the package dependencies to the extra_packages.repos file, I'm getting a few compilation errors. Could you suggest what changes I should make to get this to build correctly? A functional version of both platformio.ini and extra_packages.repos would be greatly appreciated!

Issue template

  • Hardware description: ESP32
  • RTOS: arduino
  • Installation type: git clone github.com:micro-ROS/micro_ros_platformio
  • Version or commit hash: -b fix/source_ros

Steps to reproduce the issue

I added the following to extra_packages.repos:

repositories:
  rclcpp:                             <======== Ultimately, rclcpp is all I want (The items below were some of its dependencies)
    type: git
    url: https://github.com/ros2/rclcpp.git
    version: galactic
  libstatistics_collector:
    type: git
    url: https://github.com/ros-tooling/libstatistics_collector.git
    version: galactic
  rcpputils:
    type: git
    url: https://github.com/ros2/rcpputils.git
    version: galactic

But I get several errors, as so:

In file included from /home/safdar/.platformio/packages/[email protected]/xtensa-esp32-elf/include/dirent.h:6:0,
                 from /home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:58:
/home/safdar/.platformio/packages/[email protected]/xtensa-esp32-elf/include/sys/dirent.h:10:2: error: #error "<dirent.h> not supported"
 #error "<dirent.h> not supported"
  ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp: In function 'rcpputils::fs::path rcpputils::fs::current_path()':
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:352:12: error: 'PATH_MAX' was not declared in this scope
   char cwd[PATH_MAX];
            ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:353:25: error: 'cwd' was not declared in this scope
   if (nullptr == getcwd(cwd, PATH_MAX)) {
                         ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:360:15: error: 'cwd' was not declared in this scope
   return path(cwd);
               ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp: In function 'bool rcpputils::fs::remove(const rcpputils::fs::path&)':
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:399:10: error: '::remove' has not been declared
   return ::remove(p.string().c_str()) == 0;
          ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:399:10: note: suggested alternatives:
In file included from /home/safdar/.platformio/packages/[email protected]/xtensa-esp32-elf/include/c++/5.2.0/algorithm:62:0,
                 from /home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:43:
/home/safdar/.platformio/packages/[email protected]/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:893:5: note:   'std::remove'
     remove(_ForwardIterator __first, _ForwardIterator __last,
     ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:385:6: note:   'rcpputils::fs::remove'
 bool remove(const path & p)
      ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp: In function 'bool rcpputils::fs::remove_all(const rcpputils::fs::path&)':
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:432:3: error: 'DIR' was not declared in this scope
   DIR * dir = opendir(p.string().c_str());
   ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:432:9: error: 'dir' was not declared in this scope
   DIR * dir = opendir(p.string().c_str());
         ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:432:41: error: 'opendir' was not declared in this scope
   DIR * dir = opendir(p.string().c_str());
                                         ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:434:40: error: 'readdir' was not declared in this scope
   while ((directory_entry = readdir(dir)) != nullptr) {
                                        ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:436:31: error: invalid use of incomplete type 'struct rcpputils::fs::remove_all(const rcpputils::fs::path&)::dirent'
     if (strcmp(directory_entry->d_name, ".") != 0 && strcmp(directory_entry->d_name, "..") != 0) {
                               ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:433:10: note: forward declaration of 'struct rcpputils::fs::remove_all(const rcpputils::fs::path&)::dirent'
   struct dirent * directory_entry;
          ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:436:76: error: invalid use of incomplete type 'struct rcpputils::fs::remove_all(const rcpputils::fs::path&)::dirent'
     if (strcmp(directory_entry->d_name, ".") != 0 && strcmp(directory_entry->d_name, "..") != 0) {
                                                                            ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:433:10: note: forward declaration of 'struct rcpputils::fs::remove_all(const rcpputils::fs::path&)::dirent'
   struct dirent * directory_entry;
          ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:437:63: error: invalid use of incomplete type 'struct rcpputils::fs::remove_all(const rcpputils::fs::path&)::dirent'
       auto sub_path = rcpputils::fs::path(p) / directory_entry->d_name;
                                                               ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:433:10: note: forward declaration of 'struct rcpputils::fs::remove_all(const rcpputils::fs::path&)::dirent'
   struct dirent * directory_entry;
          ^
/home/safdar/code/repositories/esp32/.pio/libdeps/pio_arduino_microros_esp32dev_wifi/micro_ros_platformio/build/mcu/src/rcpputils/src/filesystem_helper.cpp:447:15: error: 'closedir' was not declared in this scope
   closedir(dir);
               ^
make[2]: *** [CMakeFiles/rcpputils.dir/build.make:76: CMakeFiles/rcpputils.dir/src/filesystem_helper.cpp.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/rcpputils.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< rcpputils [1.88s, exited with code 2]

I presume this has something to do with the compiler being used, or perhaps the wrong compiler flags.

Here's my platformio.ini:

[env]
monitor_speed = 115200
upload_speed = 921600

[env:pio_arduino_microros_esp32dev_wifi]
platform = espressif32
framework = arduino
board = esp32dev
board_microros_distro = galactic
board_microros_transport = wifi
board_microros_user_meta = colcon.meta
src_filter = +<arduino.cpp>
lib_deps =
    https://github.com/micro-ROS/micro_ros_platformio#fix/ros_source

What should I add to platformio.ini and extra_packages.repos in order to get rclcpp compiled and linked into libmicro_ros_platformio.a?

Many thanks in advance.

Recent upload gives "alternative suggestion: try using serial"

  • Hardware description: ESP32 Heltech LoRa V2
  • RTOS: Linux
  • Installation type: microROS platformIO with Arduino framework
  • Version or commit hash: Foxy

Steps to reproduce the issue

void setup() {
  // ----------- Configure serial transport
  Serial.begin(115200);
  set_microros_serial_transports(Serial);
}

Expected behavior

Runs in serial

Actual behavior

A yellow message suggesting me to run it as WiFi

Additional information

I find it weird as the compilation to the board seems to be "lagging behind"?

When I set to utilize serial, the compilation gives a yellow suggestion saying something like alternative suggestion: try using WiFi.
And when I switched to utilize WiFi, the yellow message gives the alternative suggestion saying to try using Serial...?

Code works about a month ago and I never touched it until now.

including custom message is not found/compiled by micro_ros

  • Hardware description: ESP32 (wemos D1 R32)
  • RTOS: ?
  • Installation type: PlatformIO
  • Version or commit hash: humble

Steps to reproduce the issue

  • cd my_ws/src
  • ros2 pkg create --build-type ament_cmake custom_messages
  • cd custom_messages
  • mkdir msg
  • add the file Position2D.msg and add the following content:
float32 x
float32 y
  • copied most of the content from here to my CMakeLists.txt and package.xml
  • changed the name of the msg file in my CMakeLists file to match my msg file
  • colcon build (no errors)
  • copied my package directory and files to my platformio project in (my_project)/extra_packages/
    image
  • platformio run --target clean
Processing wemos_d1_uno32 (platform: espressif32; board: wemos_d1_uno32; framework: arduino)
--------------------------------------------------------------------------------------------------------
Removing .pio/build/wemos_d1_uno32
Done cleaning
===================================== [SUCCESS] Took 0.31 seconds =====================================
 *  Terminal will be reused by tasks, press any key to close it.
  • platformio run
Processing wemos_d1_uno32 (platform: espressif32; board: wemos_d1_uno32; framework: arduino)
--------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_uno32.html
PLATFORM: Espressif 32 (5.2.0) > WEMOS D1 R32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20005.220925 (2.0.5) 
 - tool-esptoolpy @ 1.40201.0 (4.2.1) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/home/martijn/.platformio/penv/bin/python -m pip install pyyaml
Requirement already satisfied: pyyaml in /home/martijn/.platformio/penv/lib/python3.10/site-packages (6.0)
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/home/martijn/.platformio/penv/bin/python -m pip install markupsafe==2.0.1
Requirement already satisfied: markupsafe==2.0.1 in /home/martijn/.platformio/penv/lib/python3.10/site-packages (2.0.1)
Configuring wemos_d1_uno32 with transport wifi
micro-ROS already built
Found 37 compatible libraries
Scanning dependencies...
Dependency Graph
|-- micro_ros_platformio @ 0.0.1+sha.22cf9b6
|   |-- WiFi @ 2.0.0
|-- MotorDriverD1-R32 @ 1.0.1+sha.724921a
|-- MicrosTimer @ 1.0.1+sha.ccad1d0
|-- MilisTimer @ 1.0.1+sha.f345b4b
|-- PreMo-Virtual Path Following @ 2.1.0+sha.59ee022
|-- Wire @ 2.0.0
Building in release mode
Compiling .pio/build/wemos_d1_uno32/src/ROS.cpp.o
Compiling .pio/build/wemos_d1_uno32/src/functions.cpp.o
Compiling .pio/build/wemos_d1_uno32/src/motors.cpp.o
Compiling .pio/build/wemos_d1_uno32/src/main.cpp.o
Building .pio/build/wemos_d1_uno32/bootloader.bin
Generating partitions .pio/build/wemos_d1_uno32/partitions.bin
esptool.py v4.2.1
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Compiling .pio/build/wemos_d1_uno32/libc03/WiFi/WiFi.cpp.o
Compiling .pio/build/wemos_d1_uno32/libc03/WiFi/WiFiAP.cpp.o
Compiling .pio/build/wemos_d1_uno32/libc03/WiFi/WiFiClient.cpp.o
Compiling .pio/build/wemos_d1_uno32/libc03/WiFi/WiFiGeneric.cpp.o
Compiling .pio/build/wemos_d1_uno32/libc03/WiFi/WiFiMulti.cpp.o
Compiling .pio/build/wemos_d1_uno32/libc03/WiFi/WiFiSTA.cpp.o
Compiling .pio/build/wemos_d1_uno32/libc03/WiFi/WiFiScan.cpp.o
Compiling .pio/build/wemos_d1_uno32/libc03/WiFi/WiFiServer.cpp.o
Compiling .pio/build/wemos_d1_uno32/libc03/WiFi/WiFiUdp.cpp.o
Compiling .pio/build/wemos_d1_uno32/lib984/micro_ros_platformio/platform_code/arduino/clock_gettime.cpp.o
Compiling .pio/build/wemos_d1_uno32/lib984/micro_ros_platformio/platform_code/arduino/wifi/micro_ros_transport.cpp.o
Compiling .pio/build/wemos_d1_uno32/lib7b1/MotorDriverD1-R32/MotorDriver.cpp.o
Compiling .pio/build/wemos_d1_uno32/libfe5/MicrosTimer/MicrosTimer.cpp.o
Compiling .pio/build/wemos_d1_uno32/libebc/MilisTimer/MillisTimer.cpp.o
Archiving .pio/build/wemos_d1_uno32/libc03/libWiFi.a
Indexing .pio/build/wemos_d1_uno32/libc03/libWiFi.a
Compiling .pio/build/wemos_d1_uno32/libb30/PreMo-Virtual Path Following/CatmullRom.cpp.o
Compiling .pio/build/wemos_d1_uno32/libb30/PreMo-Virtual Path Following/DeadReckoner.cpp.o
Archiving .pio/build/wemos_d1_uno32/lib7b1/libMotorDriverD1-R32.a
Archiving .pio/build/wemos_d1_uno32/lib984/libmicro_ros_platformio.a
Indexing .pio/build/wemos_d1_uno32/lib7b1/libMotorDriverD1-R32.a
Compiling .pio/build/wemos_d1_uno32/libb30/PreMo-Virtual Path Following/EncoderManager.cpp.o
Archiving .pio/build/wemos_d1_uno32/libfe5/libMicrosTimer.a
Indexing .pio/build/wemos_d1_uno32/lib984/libmicro_ros_platformio.a
Indexing .pio/build/wemos_d1_uno32/libfe5/libMicrosTimer.a
Compiling .pio/build/wemos_d1_uno32/libb30/PreMo-Virtual Path Following/MotorManager.cpp.o
Compiling .pio/build/wemos_d1_uno32/libb30/PreMo-Virtual Path Following/PID_v1.cpp.o
Compiling .pio/build/wemos_d1_uno32/libb30/PreMo-Virtual Path Following/PreMo.cpp.o
Archiving .pio/build/wemos_d1_uno32/libebc/libMilisTimer.a
Indexing .pio/build/wemos_d1_uno32/libebc/libMilisTimer.a
Compiling .pio/build/wemos_d1_uno32/libb30/PreMo-Virtual Path Following/PurePursuit.cpp.o
Compiling .pio/build/wemos_d1_uno32/lib0a1/Wire/Wire.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/Esp.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/FirmwareMSC.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/HWCDC.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/HardwareSerial.cpp.o
Archiving .pio/build/wemos_d1_uno32/libb30/libPreMo-Virtual Path Following.a
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/IPAddress.cpp.o
Indexing .pio/build/wemos_d1_uno32/libb30/libPreMo-Virtual Path Following.a
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/IPv6Address.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/MD5Builder.cpp.o
Archiving .pio/build/wemos_d1_uno32/lib0a1/libWire.a
Indexing .pio/build/wemos_d1_uno32/lib0a1/libWire.a
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/Print.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/StreamString.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/USB.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/USBCDC.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/USBMSC.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/WString.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/base64.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/cbuf.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-adc.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-bt.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-cpu.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-dac.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-gpio.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-i2c-slave.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-i2c.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-ledc.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-matrix.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-misc.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-psram.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-rgb-led.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-rmt.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-sigmadelta.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-spi.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-time.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-timer.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-tinyusb.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-touch.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/esp32-hal-uart.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/firmware_msc_fat.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/libb64/cdecode.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/libb64/cencode.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/main.cpp.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/stdlib_noniso.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/wemos_d1_uno32/FrameworkArduino/wiring_shift.c.o
Archiving .pio/build/wemos_d1_uno32/libFrameworkArduino.a
Indexing .pio/build/wemos_d1_uno32/libFrameworkArduino.a
Linking .pio/build/wemos_d1_uno32/firmware.elf
Retrieving maximum program size .pio/build/wemos_d1_uno32/firmware.elf
Checking size .pio/build/wemos_d1_uno32/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  18.0% (used 58864 bytes from 327680 bytes)
Flash: [======    ]  59.1% (used 774165 bytes from 1310720 bytes)
Building .pio/build/wemos_d1_uno32/firmware.bin
esptool.py v4.2.1
Creating esp32 image...
Merged 25 ELF sections
Successfully created esp32 image.
===================================== [SUCCESS] Took 18.02 seconds =====================================
  • added #include <custom_messages/msg/Position2D.h> did a platformio run and it fails:
fatal error: custom_messages/msg/Position.h: No such file or directory
 #include <custom_messages/msg/Position2D.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Expected behavior

like described [here](@Acuadros95 in #42 (comment)_) by @Acuadros95

Actual behavior

fatal error: custom_messages/msg/Position2D.h: No such file or directory
 #include <custom_messages/msg/Position2D.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Additional Information

Also tried renaming the Position2D.msg to Position.msg and rebuild/recompile everything without luck.

highlight differences to micro_ros_arduino

It's not clear to me what the differences are between this project and micro_ros_arduino and when I would use one versus the other. I think adding a note highlighting the differences would help others looking at the two projects.

For example

[env:seeed_xiao]
platform = atmelsam
board = seeed_xiao
framework = arduino

lib_deps =
    https://github.com/micro-ROS/micro_ros_arduino#v2.0.5-humble

build_flags =
    -L ./.pio/libdeps/seeed_xiao/micro_ros_arduino/src/cortex-m0plus/
    -l microros
    -D micro_ros_xiao.json

works fine in platformIO. When and why would I use this project instead?

esp32c3 not work well on wifi connection

Work well on Serial , but a little error on Wifi ESP32 Pio

#include <Arduino.h>
#include <micro_ros_platformio.h>

#include <rcl/rcl.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>

#include <std_msgs/msg/int32.h>

#if !defined(MICRO_ROS_TRANSPORT_ARDUINO_SERIAL)
#error This example is only avaliable for Arduino framework with serial transport.
#endif

#if defined(MICRO_ROS_TRANSPORT_ARDUINO_WIFI)
#include <WiFi.h>
#endif

rcl_publisher_t publisher;
std_msgs__msg__Int32 msg;

rclc_executor_t executor;
rclc_support_t support;
rcl_allocator_t allocator;
rcl_node_t node;
rcl_timer_t timer;

#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}

// Error handle loop
void error_loop() {
  while(1) {
    delay(100);
  }
}

void timer_callback(rcl_timer_t * timer, int64_t last_call_time) {
  RCLC_UNUSED(last_call_time);
  if (timer != NULL) {
    RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
    msg.data++;
  }
}

void setup() {
  set_microros_wifi_transports("WiFI", "PASSWD", "AgentSERVER", 8888);

  // Configure serial transport
  Serial.begin(115200);
  set_microros_serial_transports(Serial);
  delay(2000);

  allocator = rcl_get_default_allocator();

  //create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&node, "micro_ros_platformio_node", "", &support));

  // create publisher
  RCCHECK(rclc_publisher_init_default(
    &publisher,
    &node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32),
    "micro_ros_platformio_node_publisher"));

  // create timer,
  const unsigned int timer_timeout = 1000;
  RCCHECK(rclc_timer_init_default(
    &timer,
    &support,
    RCL_MS_TO_NS(timer_timeout),
    timer_callback));

  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_timer(&executor, &timer));

  msg.data = 0;
}

void loop() {
  delay(100);
  RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)));
}

platformio.ini

[env:seeed_xiao_esp32c3]
platform = espressif32
board = seeed_xiao_esp32c3
framework = arduino
board_microros_transport = wifi
lib_deps = 
	https://github.com/micro-ROS/micro_ros_platformio

ERROR output

warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
src/main.cpp:46:79: error: conversion from 'const char [14]' to 'IPAddress' is ambiguous
In file included from /home/w0x7ce/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:170,
                 from src/main.cpp:1:
/home/w0x7ce/.platformio/packages/framework-arduinoespressif32/cores/esp32/IPAddress.h:51:5: note: candidate: 'IPAddress::IPAddress(const uint8_t*)' <near match>
     IPAddress(const uint8_t *address);
     ^~~~~~~~~
/home/w0x7ce/.platformio/packages/framework-arduinoespressif32/cores/esp32/IPAddress.h:51:5: note:   conversion of argument 1 would be ill-formed:
src/main.cpp:46:58: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]
   set_microros_wifi_transports("SEEED-MKT", "depot0518", "192.168.6.198", 8888);
                                                          ^~~~~~~~~~~~~~~
In file included from /home/w0x7ce/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:170,
                 from src/main.cpp:1:
/home/w0x7ce/.platformio/packages/framework-arduinoespressif32/cores/esp32/IPAddress.h:50:5: note: candidate: 'IPAddress::IPAddress(uint32_t)' <near match>
     IPAddress(uint32_t address);
     ^~~~~~~~~
/home/w0x7ce/.platformio/packages/framework-arduinoespressif32/cores/esp32/IPAddress.h:50:5: note:   conversion of argument 1 would be ill-formed:
src/main.cpp:46:58: error: invalid conversion from 'const char*' to 'uint32_t' {aka 'long unsigned int'} [-fpermissive]
   set_microros_wifi_transports("SEEED-MKT", "depot0518", "192.168.6.198", 8888);
                                                          ^~~~~~~~~~~~~~~
In file included from .pio/libdeps/seeed_xiao_esp32c3/micro_ros_platformio/platform_code/micro_ros_platformio.h:34,
                 from src/main.cpp:2:
.pio/libdeps/seeed_xiao_esp32c3/micro_ros_platformio/platform_code/arduino/wifi/micro_ros_transport.h:9:20: note:   initializing argument 3 of 'void set_microros_wifi_transports(char*, char*, IPAddress, uint16_t)'
 static inline void set_microros_wifi_transports(char * ssid, char * pass, IPAddress agent_ip, uint16_t agent_port){
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.cpp:50:3: error: 'set_microros_serial_transports' was not declared in this scope
   set_microros_serial_transports(Serial);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.cpp:50:3: note: suggested alternative: 'set_microros_wifi_transports'
   set_microros_serial_transports(Serial);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   set_microros_wifi_transports
*** [.pio/build/seeed_xiao_esp32c3/src/main.cpp.o] Error 1

Micro-ros undefined references

I am trying to build micro_ros_platformio for a Teensy4.1 but I get a lot of warnings from "ar" at the end of the build but no fatal error. Here is a picture of those warning.

CleanShot 2022-10-03 at 19 18 00@2x

Further in the build of the code itself (the code that depends on micro_ros), it fails due to a bunch of undefined references that correspond with the file that are mentionned by the "ar" command.

Steps to reproduce the issue

Expected behavior

Build without errors (it compiles without all the aforementioned warnings on another machine running Ubuntu)

Actual behavior

Throws some warnings and complains later in the build that there are undefined references

Additional information

If it compiles without the warning, there will be an error at the end relating to the random library but this is due to other unrelated stuff.

wifi_nina build error

  • Hardware description: ESP32 DEVKITV1
  • Installation type: Micro_ros_platformIO
  • Version or commit hash: Foxy

Steps to reproduce the issue

Steps from the main github page: https://github.com/micro-ROS/micro_ros_platformio

pio lib install
pio run
pio run --target upload

platformio.ini:

[env:esp32doit-devkit-v1]
; [env: heltec_wifi_lora_32_V2]
platform = espressif32
board = esp32doit-devkit-v1 ;heltec_wifi_lora_32_V2
board_microros_transport = wifi_nina ;serial ;wifi ;wifi_nina
board_microros_distro = foxy
framework = arduino
monitor_speed = 115200
lib_deps =
    https://github.com/micro-ROS/micro_ros_platformio # for microROS
    arduino-libraries/WiFiNINA@^1.8.13 # for wifi_nina

main.cpp:


#include <Arduino.h>
#include <micro_ros_platformio.h>

#include <rcl/rcl.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>

#include <std_msgs/msg/int32.h>


// #if !defined(MICRO_ROS_TRANSPORT_ARDUINO_SERIAL)
// #error This example is only avaliable for Arduino framework with serial transport.
// #endif

rcl_publisher_t publisher;
std_msgs__msg__Int32 msg;

rclc_executor_t executor;
rclc_support_t support;
rcl_allocator_t allocator;
rcl_node_t node;
rcl_timer_t timer;

#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}

// Error handle loop
void error_loop() {
  while(1) {
    delay(100);
  }
}

void timer_callback(rcl_timer_t * timer, int64_t last_call_time) {
  RCLC_UNUSED(last_call_time);
  if (timer != NULL) {
    RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
    msg.data+=2;
  }
}

void setup() {
  // ----------- Configure serial transport
  Serial.begin(115200);
  // set_microros_serial_transports(Serial);

  IPAddress agent_ip(111, 111, 1, 11);
  size_t agent_port = 8888;

  char ssid[] = "123456789";
  char psk[]= "123456789";

  set_microros_wifi_transports(ssid, psk, agent_ip, agent_port);


  
  
  delay(2000);
  Serial.println("Initialized...");

  allocator = rcl_get_default_allocator();

  //create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&node, "micro_ros_platformio_node", "", &support));

  // create publisher
  RCCHECK(rclc_publisher_init_default(
    &publisher,
    &node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32),
    "micro_ros_platformio_node_publisher"));

  // create timer,
  const unsigned int timer_timeout = 1000;
  RCCHECK(rclc_timer_init_default(
    &timer,
    &support,
    RCL_MS_TO_NS(timer_timeout),
    timer_callback));

  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_timer(&executor, &timer));

  msg.data = 0;
}

void loop() {
  delay(100);
  RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)));
}

Expected behavior

Builds and runs...

Actual behavior

genozen@genozen:~/Desktop/platformIO_projects/microROS_ESP32_test$ pio run
Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (5.0.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20003.220626 (2.0.3) 
 - tool-esptoolpy @ 1.30300.0 (3.3.0) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/home/genozen/.platformio/penv/bin/python -m pip install pyyaml
Requirement already satisfied: pyyaml in /home/genozen/.platformio/penv/lib/python3.8/site-packages (6.0)
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/home/genozen/.platformio/penv/bin/python -m pip install markupsafe==2.0.1
Requirement already satisfied: markupsafe==2.0.1 in /home/genozen/.platformio/penv/lib/python3.8/site-packages (2.0.1)
Configuring esp32doit-devkit-v1 with transport wifi_nina
micro-ROS already built
Found 35 compatible libraries
Scanning dependencies...
Dependency Graph
|-- micro_ros_platformio @ 0.0.1+sha.2ebb324
|   |-- WiFiNINA @ 1.8.13
|   |   |-- SPI @ 2.0.0
|   |-- SPI @ 2.0.0
|-- WiFiNINA @ 1.8.13
|   |-- SPI @ 2.0.0
Building in release mode
Compiling .pio/build/esp32doit-devkit-v1/src/main.cpp.o
Compiling .pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFi.cpp.o
Compiling .pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFiClient.cpp.o
Compiling .pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFiServer.cpp.o
Compiling .pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFiStorage.cpp.o
Compiling .pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFiUdp.cpp.o
Compiling .pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/utility/nano_rp2040_support.cpp.o
Compiling .pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/utility/server_drv.cpp.o
Compiling .pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/utility/spi_drv.cpp.o
In file included from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFiStorage.h:23,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFi.h:38,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFiNINA.h:23,
                 from .pio/libdeps/esp32doit-devkit-v1/micro_ros_platformio/platform_code/arduino/wifi_nina/micro_ros_transport.h:2,
                 from .pio/libdeps/esp32doit-devkit-v1/micro_ros_platformio/platform_code/micro_ros_platformio.h:34,
                 from src/main.cpp:3:
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);
            ^~~~~~~~~
*** [.pio/build/esp32doit-devkit-v1/src/main.cpp.o] Error 1
In file included from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFi.cpp:21:
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);
            ^~~~~~~~~
*** [.pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFi.cpp.o] Error 1
In file included from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFiClient.cpp:30:
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);
            ^~~~~~~~~
In file included from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFiStorage.h:23,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFiStorage.cpp:20:
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);
            ^~~~~~~~~
In file included from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFiStorage.h:23,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFi.h:38,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFiServer.cpp:28:
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);
            ^~~~~~~~~
*** [.pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFiStorage.cpp.o] Error 1
*** [.pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFiClient.cpp.o] Error 1
*** [.pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFiServer.cpp.o] Error 1
In file included from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFiUdp.cpp:29:
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);
            ^~~~~~~~~
*** [.pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/WiFiUdp.cpp.o] Error 1
In file included from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFiStorage.h:23,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/WiFi.h:38,
                 from .pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp:25:
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/wifi_drv.h:293:12: error: 'PinStatus' does not name a type
     static PinStatus digitalRead(uint8_t pin);
            ^~~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp: In static member function 'static void SpiDrv::begin()':
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp:94:24: error: 'PINS_COUNT' was not declared in this scope
       if (SLAVERESET > PINS_COUNT) {
                        ^~~~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp:94:24: note: suggested alternative: 'ICOUNT'
       if (SLAVERESET > PINS_COUNT) {
                        ^~~~~~~~~~
                        ICOUNT
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp:103:15: error: 'NINA_GPIO0' was not declared in this scope
       pinMode(NINA_GPIO0, OUTPUT);
               ^~~~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp:103:15: note: suggested alternative: 'NINA_GPIOIRQ'
       pinMode(NINA_GPIO0, OUTPUT);
               ^~~~~~~~~~
               NINA_GPIOIRQ
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp: In static member function 'static int SpiDrv::available()':
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp:66:25: error: 'NINA_GPIO0' was not declared in this scope
 #define NINA_GPIOIRQ    NINA_GPIO0
                         ^~~~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp:597:25: note: in expansion of macro 'NINA_GPIOIRQ'
     return (digitalRead(NINA_GPIOIRQ) != LOW);
                         ^~~~~~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp:66:25: note: suggested alternative: 'NINA_GPIOIRQ'
 #define NINA_GPIOIRQ    NINA_GPIO0
                         ^~~~~~~~~~
.pio/libdeps/esp32doit-devkit-v1/WiFiNINA/src/utility/spi_drv.cpp:597:25: note: in expansion of macro 'NINA_GPIOIRQ'
     return (digitalRead(NINA_GPIOIRQ) != LOW);
                         ^~~~~~~~~~~~
*** [.pio/build/esp32doit-devkit-v1/lib0b8/WiFiNINA/utility/spi_drv.cpp.o] Error 1

Additional information

Sometimes there's Colcon build: error as well...
Also, USB permission sometimes denies and requires using the sudo chown command

"VisualStudioVersion is not set, please run within a Visual Studio Command Prompt."

I am trying to install the micro_ros_platformio library but colcon build fails.
Platformio version: 6.1.4
Visual Studio Code version: 1.7.1.0
OS: Windows 10

platfomrio.ini :

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:dueUSB]
platform = atmelsam
board = dueUSB
framework = arduino

lib_deps =
    https://github.com/micro-ROS/micro_ros_platformio
	jandrassy/EthernetENC@^2.0.2

monitor_speed = 115200

Building the project results in the following output:



Processing dueUSB (platform: atmelsam; board: dueUSB; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/dueUSB.html
PLATFORM: Atmel SAM (8.1.0) > Arduino Due (USB Native Port)
HARDWARE: AT91SAM3X8E 84MHz, 96KB RAM, 512KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink, stlink)
PACKAGES:
 - framework-arduino-sam @ 1.6.12
 - framework-cmsis @ 1.40500.0 (4.5.0)
 - framework-cmsis-atmel @ 1.2.2
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
C:\Users\spiro\.platformio\penv\Scripts\python.exe -m pip install pyyaml
Requirement already satisfied: pyyaml in c:\users\spiro\.platformio\penv\lib\site-packages (6.0)

[notice] A new release of pip available: 22.1.2 -> 22.2.2
[notice] To update, run: python.exe -m pip install --upgrade pip
Installing markupsafe==2.0.1 with pip at PlatformIO environment
C:\Users\spiro\.platformio\penv\Scripts\python.exe -m pip install markupsafe==2.0.1
Requirement already satisfied: markupsafe==2.0.1 in c:\users\spiro\.platformio\penv\lib\site-packages (2.0.1)

[notice] A new release of pip available: 22.1.2 -> 22.2.2
[notice] To update, run: python.exe -m pip install --upgrade pip
Configuring dueUSB with transport serial
Downloading micro-ROS dev dependencies
         - Downloaded ament_cmake
         - Downloaded ament_lint
         - Downloaded ament_package
         - Downloaded googletest
         - Downloaded ament_cmake_ros
         - Downloaded ament_index
Building micro-ROS dev dependencies
Build dev micro-ROS environment failed: 
 --- stderr: gtest_vendor

Traceback (most recent call last):

  File "C:\Users\spiro\.platformio\penv\lib\site-packages\colcon_core\executor\__init__.py", line 91, in __call__

    rc = await self.task(*args, **kwargs)

  File "C:\Users\spiro\.platformio\penv\lib\site-packages\colcon_core\task\__init__.py", line 93, in __call__

    return await task_method(*args, **kwargs)

  File "C:\Users\spiro\.platformio\penv\lib\site-packages\colcon_ros\task\cmake\build.py", line 35, in build

    rc = await extension.build(

  File "C:\Users\spiro\.platformio\penv\lib\site-packages\colcon_cmake\task\cmake\build.py", line 87, in build

    rc = await self._reconfigure(args, env)

  File "C:\Users\spiro\.platformio\penv\lib\site-packages\colcon_cmake\task\cmake\build.py", line 153, in _reconfigure

    raise RuntimeError(

RuntimeError: VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.

---

Failed   <<< gtest_vendor [0.89s, exited with code 1]

VisualStudioVersion is not set, please run within a Visual Studio Command Prompt.

I have tried the exact same process in Ubuntu 20 and didn't get any errors.

adding native_ethernet to portenta H7

Hi,
I used this repo on a Portenta H7, in oder to use native_ethernet i had to replace:
platform_code/arduino/native_ethernet/micro_ros_transport.cpp
#5 #include <NativeEthernetUdp.h> with <EthernetUdp.h>
and
platform_code/arduino/native_ethernet/micro_ros_transport.h
#1 #include <NativeEthernet.h> with #include <EthernetUdp.h>

I would create a pull request, but i don't know how to embed it into the existing system.

porting issue addtwoints service

Using teensy 4.1 with platformio in VSCode on Ubuntu 22.04

I have followed the tutorial:
https://micro.ros.org/docs/tutorials/core/teensy_with_arduino/

Now I'm trying to expand this for the "micro-ros_addtwoints_servcie".
However I'm having issue understanding how to port this over. I do understand this example comes from the pure "arduino" microROS side and there are a few differences. But what I lack is the understanding how this could be ported over.

Currently it already hangs at the point where I
#include <example_interfaces/srv/add_two_ints.h>

Please help me understand how I can port this over.
Once I have a working example I will update the github repo, and add this add_two_ints so others can also benefit.

Thanks

Compiling error

Issue template

I'm am trying to compile the example but i am getting an error while building. I installed all packages.
Thanks for help and the great project :)

  • Hardware description: arduino uno
  • Version or commit hash: humble

Steps to reproduce the issue

in src/main.cpp is the example code. I initialized the project with Platform IO
Versions
git version 2.34.1
cmake version 3.22.1
Python 3.10.6

platformio.ini

[env:uno]
platform = atmelavr
board = uno
framework = arduino
board_microros_transport = serial
lib_deps = 
	waspinator/AccelStepper@^1.61
	https://github.com/micro-ROS/micro_ros_platformio

Expected behavior

Compiling :)

Actual behavior

Error:

Building micro-ROS library
Build mcu micro-ROS environment failed: 
--- stderr: microcdr
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING
    THIRDPARTY


CMake Warning (dev) at /usr/share/cmake-3.22/Modules/GNUInstallDirs.cmake:239 (message):
  Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
  target architecture is known.  Please enable at least one language before
  including GNUInstallDirs.
Call Stack (most recent call first):
  CMakeLists.txt:84 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

avr-gcc: error: device-specs/specs-OARD_MCU: No such file or directory
avr-gcc: error: device-specs/specs-OARD_MCU: No such file or directory
gmake[5]: *** [CMakeFiles/microcdr.dir/build.make:76: CMakeFiles/microcdr.dir/src/c/common.c.obj] Error 1
gmake[5]: *** Waiting for unfinished jobs....
gmake[5]: *** [CMakeFiles/microcdr.dir/build.make:90: CMakeFiles/microcdr.dir/src/c/types/basic.c.obj] Error 1
avr-gcc: error: device-specs/specs-OARD_MCU: No such file or directory
avr-gcc: error: device-specs/specs-OARD_MCU: No such file or directory
gmake[5]: *** [CMakeFiles/microcdr.dir/build.make:118: CMakeFiles/microcdr.dir/src/c/types/array.c.obj] Error 1
gmake[5]: *** [CMakeFiles/microcdr.dir/build.make:104: CMakeFiles/microcdr.dir/src/c/types/string.c.obj] Error 1
avr-gcc: error: device-specs/specs-OARD_MCU: No such file or directory
gmake[5]: *** [CMakeFiles/microcdr.dir/build.make:132: CMakeFiles/microcdr.dir/src/c/types/sequence.c.obj] Error 1
gmake[4]: *** [CMakeFiles/Makefile2:83: CMakeFiles/microcdr.dir/all] Error 2
gmake[3]: *** [Makefile:136: all] Error 2
gmake[2]: *** [CMakeFiles/ucdr.dir/build.make:86: ucdr-prefix/src/ucdr-stamp/ucdr-build] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/ucdr.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
---
Failed   <<< microcdr [1.56s, exited with code 2]

Start:

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (4.0.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/usr/bin/python3 -m pip install pyyaml
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyyaml in /home/neb/.local/lib/python3.10/site-packages (6.0)
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/usr/bin/python3 -m pip install markupsafe==2.0.1
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: markupsafe==2.0.1 in /home/neb/.local/lib/python3.10/site-packages (2.0.1)
Configuring uno with transport serial

Using more than 4 timers ends up in an error loop.

Hello,
Recently I tried to use multiple publishers controlled by multiple timers, but it appears that using more than 4 timers causes an error and the program ends up in an error loop. I would also like to mention that according to Teensy 4.0 documentation (https://www.pjrc.com/store/teensy40.htmla), it has 4 Interval Timers. Is there any way to use more than 4 micro-ros timers in my setup?

  • Hardware description: teensy 4.0
  • RTOS: Teensy with Arduino
  • Installation type: micro_ros_platformio
  • Version or commit hash: galactic

cocon.meta:

 "cmake-args": [
                "-DRMW_UXRCE_MAX_NODES=2",
                "-DRMW_UXRCE_MAX_PUBLISHERS=6",
                "-DRMW_UXRCE_MAX_SUBSCRIPTIONS=6",
                "-DRMW_UXRCE_MAX_SERVICES=1",
                "-DRMW_UXRCE_MAX_CLIENTS=1",
                "-DRMW_UXRCE_MAX_HISTORY=2",
                "-DRMW_UXRCE_TRANSPORT=custom"
            ]
´´´

multiple service not working

Hello, I am new to micro ros.

I recently ran into a problem creating a node that provides multiple services.
One service works fine, but when I try to create 2 or more services I get an error.
Precisely the second "rclc_service_init_default" function returns "RMW_RET_ERROR".
I would be grateful if you could point out if there is something I am using incorrectly.

Issue template

  • Hardware description: ESP32 Dev Board
  • Version or commit hash: foxy

Source Coad

#include <Arduino.h>

#include <micro_ros_platformio.h>

#include <rcl/rcl.h>
#include <rclc/executor.h>
#include <rclc/rclc.h>

#include <rmw_microros/rmw_microros.h>

// service message
#include <std_srvs/srv/trigger.h>

#define RCCHECK(fn)                                          \
  {                                                          \
    rcl_ret_t temp_rc = fn;                                  \
    if ((temp_rc != RCL_RET_OK)) {                           \
      error_loop(temp_rc, __FILE__, __FUNCTION__, __LINE__); \
    }                                                        \
  }

#define RCSOFTCHECK(fn)            \
  {                                \
    rcl_ret_t temp_rc = fn;        \
    if ((temp_rc != RCL_RET_OK)) { \
    }                              \
  }

#define ERRCHECK(fn)                                         \
  {                                                          \
    bool temp_rc = fn;                                       \
    if ((temp_rc != true)) {                                 \
      error_loop(temp_rc, __FILE__, __FUNCTION__, __LINE__); \
    }                                                        \
  }

static rcl_allocator_t s_allocator;
static rclc_support_t s_support;
static rclc_executor_t s_executor;

static rcl_node_t s_node;

static rcl_service_t test_h;
static std_srvs__srv__Trigger_Request test_req;
static std_srvs__srv__Trigger_Response test_res;

static rcl_service_t test2_h;
static std_srvs__srv__Trigger_Request test2_req;
static std_srvs__srv__Trigger_Response test2_res;

static void error_loop(rcl_ret_t error, const char *file_name_, const char *function_name_, int line_cnt_) {
  pinMode(4, OUTPUT);
  char *buff;
  asprintf(&buff, "ERRORTYPE: %d, FILENAME: %s, FUNCTION: %s, LINENO: %d", error, file_name_, function_name_, line_cnt_);
  while (1) {
    Serial.println(buff);
    digitalWrite(4, HIGH);
    delay(100);
    digitalWrite(4, LOW);
    delay(100);
  }
}

static void service_callback(const void *req, void *res) {
  std_srvs__srv__Trigger_Request *req_ = (std_srvs__srv__Trigger_Request *)req;
  std_srvs__srv__Trigger_Response *res_ = (std_srvs__srv__Trigger_Response *)res;

  digitalWrite(4, LOW);
  delay(100);
  digitalWrite(4, HIGH);
  res_->success = true;
}

typedef enum {
  WAITING_AGENT,
  AGENT_AVAILABLE,
  AGENT_CONNECTED,
  AGENT_DISCONNECTED
} state_t;
static state_t s_state;

void setup() {
  Serial.begin(115200);
  set_microros_serial_transports(Serial);
  delay(2000);

  pinMode(4, OUTPUT);

  s_allocator = rcl_get_default_allocator();
  RCCHECK(rclc_support_init(&s_support, 0, NULL, &s_allocator));

  RCCHECK(rclc_node_init_default(&s_node, "mechaship_mcu_driver", "", &s_support));

  RCCHECK(rclc_service_init_default(&test_h, &s_node, ROSIDL_GET_SRV_TYPE_SUPPORT(std_srvs, srv, Trigger), "/test1"));
  RCCHECK(rclc_service_init_default(&test2_h, &s_node, ROSIDL_GET_SRV_TYPE_SUPPORT(std_srvs, srv, Trigger), "/test2"));

  // excutor
  RCCHECK(rclc_executor_init(&s_executor, &s_support.context, 2, &s_allocator));

  RCCHECK(rclc_executor_add_service(&s_executor, &test_h,
                                    &test_req, &test_res,
                                    service_callback));
  RCCHECK(rclc_executor_add_service(&s_executor, &test2_h,
                                    &test2_req, &test2_res,
                                    service_callback));
}

void loop() {
  delay(100);
  RCSOFTCHECK(rclc_executor_spin_some(&s_executor, RCL_MS_TO_NS(100)));
}

Expected behavior

I want to see two services "/test" and "/test2" in rqt service caller.

Actual behavior

The error occurs on line 95.
line 95:

  RCCHECK(rclc_service_init_default(&test2_h, &s_node, ROSIDL_GET_SRV_TYPE_SUPPORT(std_srvs, srv, Trigger), "/test2"));

error log:

ERRORTYPE: 1, FILENAME: src/main.cpp, FUNCTION: setup, LINENO: 95

Additional information

Adding custom ROS messages for microROS platformIO

I'm trying to follow the tutorial from microROS custom messages: [https://micro.ros.org/docs/tutorials/advanced/create_new_type/]

Is there a similar way to do this custom messages in the platformIO version?

Running the example code on Ubuntu 20.04

Hi,
I trying to port my projects from arduino ide to platformio.
For this i tried creating a new portenta project in platformio and pasting the main.cpp and platformio.ini from your example code.
this leaves me with the following error:
Did i miss a step?

username@pc:~/Documents/PlatformIO/Projects/220706-095925-portenta_h7_m7$ pio run
Processing portenta_h7_m7 (platform: ststm32; board: portenta_h7_m7; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/portenta_h7_m7.html
PLATFORM: ST STM32 (15.4.1) > Arduino Portenta H7 (M7 core)
HARDWARE: STM32H747XIH6 480MHz, 511.35KB RAM, 768KB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-arduino-mbed @ 3.1.1 
 - tool-dfuutil @ 1.11.0 
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/home/sebastian/.platformio/penv/bin/python -m pip install pyyaml
Requirement already satisfied: pyyaml in /home/sebastian/.platformio/penv/lib/python3.8/site-packages (6.0)
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/home/sebastian/.platformio/penv/bin/python -m pip install markupsafe==2.0.1
Requirement already satisfied: markupsafe==2.0.1 in /home/sebastian/.platformio/penv/lib/python3.8/site-packages (2.0.1)
Configuring portenta_h7_m7 with transport native_ethernet
micro-ROS already built
Found 38 compatible libraries
Scanning dependencies...
Dependency Graph
|-- micro_ros_platformio @ 0.0.1+sha.285dd94
Building in release mode
Compiling .pio/build/portenta_h7_m7/src/main.cpp.o
src/main.cpp:1:10: fatal error: micro_ros_arduino.h: No such file or directory

***************************************************************************
* Looking for micro_ros_arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:micro_ros_arduino.h"
* Web  > https://registry.platformio.org/search?q=header:micro_ros_arduino.h
*
***************************************************************************

 #include <micro_ros_arduino.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/portenta_h7_m7/lib62b/micro_ros_platformio/platform_code/arduino/native_ethernet/micro_ros_transport.cpp.o
Archiving .pio/build/portenta_h7_m7/libFrameworkArduino.a
*** [.pio/build/portenta_h7_m7/src/main.cpp.o] Error 1
Indexing .pio/build/portenta_h7_m7/libFrameworkArduino.a
In file included from .pio/libdeps/portenta_h7_m7/micro_ros_platformio/platform_code/micro_ros_platformio.h:34:0,
                 from .pio/libdeps/portenta_h7_m7/micro_ros_platformio/platform_code/arduino/native_ethernet/micro_ros_transport.cpp:3:
.pio/libdeps/portenta_h7_m7/micro_ros_platformio/platform_code/arduino/native_ethernet/micro_ros_transport.h:1:10: fatal error: Ethernet.h: No such file or directory

******************************************************************
* Looking for Ethernet.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Ethernet.h"
* Web  > https://registry.platformio.org/search?q=header:Ethernet.h
*
******************************************************************

 #include <Ethernet.h>
          ^~~~~~~~~~~~
compilation terminated.
*** [.pio/build/portenta_h7_m7/lib62b/micro_ros_platformio/platform_code/arduino/native_ethernet/micro_ros_transport.cpp.o] Error 1
================================================================================================================================================= [FAILED] Took 3.28 seconds

ESP32 setup hangs at rclc_support_init_with_options()

Issue template

  • Hardware description: ESP32 (Wemos d1 R32)
  • RTOS: ?? not shure...
  • Installation type: platformio
  • Version or commit hash: humble

Steps to reproduce the issue

Hi there,

After successfully implemented Micro ROS on my Teensy 4.1 I gave it a try on a ESP32 but for some reason it it hangs on rclc_support_init_with_options() after setting my domain ID.

here is my code:

#include <Arduino.h>
#include <micro_ros_platformio.h>

#include <rcl/rcl.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>

#include <std_msgs/msg/int32.h>
#include <std_msgs/msg/float32_multi_array.h>
#include <std_msgs/msg/bool.h>

#define ROS_DOMAIN_ID 10
#define WIFI_SSID "someSSID"
#define WIFI_PASS "somePW"

rclc_executor_t         executor;
rclc_support_t          support;
rcl_allocator_t         allocator;
rcl_node_t              node;
rcl_timer_t             timer;

rcl_publisher_t                     publisher;
std_msgs__msg__Float32MultiArray    msg_out_act_position;

rcl_subscription_t                  subscriber_position;
std_msgs__msg__Bool                 msg_in_new_position;

#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop(temp_rc);}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}

void error_loop(rcl_ret_t returnCode){
    Serial.print("Error in ROS with return code: ");
    Serial.println(returnCode);
    while(1) {
        digitalWrite(LED_PIN, !digitalRead(LED_PIN));
        delay(500);
    }
}

void subscription_cb_new_position(const void * msgIn) {
    Serial.print("Got a ros 'msg_in_new_position' message!");
}

void setup() {
    Serial.begin(115200);
    while (!Serial);

    IPAddress agent_ip(172, 10, 10, 182);
    size_t agent_port = 8888;

    char SSID[] = WIFI_SSID;
    char PASS[] = WIFI_PASS;

    set_microros_wifi_transports(SSID, PASS, agent_ip, agent_port);
    Serial.println("01: Initialized Wifi");

    delay(1000);

    allocator = rcl_get_default_allocator();
    Serial.println("02: Initialized ROS allocator");

    rcl_init_options_t init_options = rcl_get_zero_initialized_init_options();
    Serial.println("03: Initialized ROS init options");
    RCCHECK(rcl_init_options_init(&init_options, allocator));
    Serial.println("04: processed ROS init options");
    RCCHECK(rcl_init_options_set_domain_id(&init_options, 10));
    Serial.println("05: set ROS domain ID");
    RCCHECK(rclc_support_init_with_options(&support, 0, NULL, &init_options, &allocator));
    Serial.println("06: Initialize ROS support with options");

    rcl_ret_t returnNode = rclc_node_init_default(&node, "dixy_transporter", "", &support);
    if(returnNode != 0) {
        error_loop(returnNode);
    }
    Serial.println("07: Initialized ROS returnNode");

    // create publisher "act_position"
    RCCHECK(
        rclc_publisher_init_best_effort(
            &publisher,
            &node,
            ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Float32MultiArray),
            "act_position"
        )
    );
    Serial.println("08: Initialized ROS publisher");

    // create subscriber "new_position"
    RCCHECK(
        rclc_subscription_init_best_effort(
            &subscriber_position,
            &node,
            ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Float32MultiArray),
            "new_position"
        )
    );
    Serial.println("09: Initialized ROS subscriber_position");

    // create executor
    RCCHECK(
        rclc_executor_init(
            &executor, 
            &support.context, 
            1, 
            &allocator
        )
    );
    Serial.println("10: Initialized ROS executor");

    RCCHECK(
        rclc_executor_add_subscription(
            &executor, 
            &subscriber_position, 
            &msg_in_new_position, 
            &subscription_cb_new_position, 
            ON_NEW_DATA
        )
    );
    Serial.println("11: Initialized ROS subscribers with the executor");
    Serial.println("-----------------end setup--------------------");
}
//*
  • I skipped the loop because this is not relevant at the moment

Any idea what is going wrong here, almost the same code is running without issues on my teensy 4.1 using native_ethernet

Expected behavior

Continue after rclc_support_init_with_options

Actual behavior

This is the serial out put:

01: Initialized Wifi
02: Initialized ROS allocator
03: Initialized ROS init options
04: processed ROS init options
05: set ROS domain ID
Error in ROS with return code: 1

Additional information

My platformio.ini:

[env:wemos_d1_uno32]
platform = espressif32
board = wemos_d1_uno32
framework = arduino
board_microros_transport = wifi
monitor_speed = 115200
lib_deps =
    https://github.com/micro-ROS/micro_ros_platformio

I wanted to post this on ROS answers but is seems to be impossible to login there....

Thanks, MartijnD

increasing subscribers and publishers on portenta H7

Hi, i want to use 12 publishers/topics on the Portenta H7,
I tried changing: ./Projects/project_name/.pio/libdeps/portenta_h7_m7/micro_ros_platformio/libmicroros/include/rmw_microxrcedds_c/config.h
#define RMW_UXRCE_MAX_PUBLISHERS 10, changed to 12
but the topic i use for testing just stops working when the elevenths publisher is instantiated.
is there another variable? I dont think the portenta really minds having more than 10 topics...

MicroROS ESP32 Over-the-air upload

Just wondering if the microROS platformIO version supports over the air upload like this one: https://randomnerdtutorials.com/esp32-over-the-air-ota-programming/#:~:text=Upload%20a%20new%20sketch%20over%2Dthe%2Dair%20to%20the%20ESP32,code%20should%20be%20successfully%20uploaded.

or anyway to upload the microROS to multiple ESP32 at once?

sensor_msgs/Range support structure fails checks when compiling

Issue template

Hardware description: Teensy 4.1
Installation type: Ubuntu 22.04.1, ROS2 (humble)
Version or commit hash: ROS-humble
Platformio Core 6.1.4·Home 3.4.3 withing VS-Code 1.72.2

Steps to reproduce the issue

Take Source code below, attempt to compile
Create project in platformio
set-up your platformio.ini as the below code-sample
use proper build workflow: (a) clean, and delete .pio folder, b) pio lib install, c) pio run,

Expected behavior

Compile without error

Actual behavior

Causes an error:

src/main.cpp: In function 'void setup()':
.pio/libdeps/teensy41/micro_ros_platformio/libmicroros/include/rosidl_runtime_c/message_type_support_struct.h:78:59: error: 'rosidl_typesupport_c__get_message_type_support_handle__sesnsor_msgs__msg__Range' was not declared in this scope
     rosidl_typesupport_c, PkgName, MsgSubfolder, MsgName)()
                                                           ^
src/main.cpp:107:43: note: in definition of macro 'RCCHECK'
 #define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
                                           ^
src/main.cpp:330:64: note: in expansion of macro 'ROSIDL_GET_MSG_TYPE_SUPPORT'
   RCCHECK(rclc_publisher_init_default(&publisher_range, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(sesnsor_msgs, msg, Range), "micro_ros_platformio_node_publisher_range"));

This is in line causing the error
RCCHECK(rclc_publisher_init_default(&publisher_range, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(sesnsor_msgs, msg, Range), "micro_ros_platformio_node_publisher_range"));

Additional information

directory tree of .pio clearly shows the presence of sensor_msgs and the supporting structure

.pio
├── bin
└── libdeps
    └── teensy41
        └── micro_ros_platformio
            ├── libmicroros
            │   ├── include
            │   │   ├── sensor_msgs
            │   │   │   ├── msg
            │   │   │   │   ├── battery_state.h
            │   │   │   │   ├── camera_info.h
            │   │   │   │   ├── channel_float32.h
            │   │   │   │   ├── compressed_image.h
            │   │   │   │   ├── detail
            │   │   │   │   │   ├── battery_state__functions.c
            │   │   │   │   │   ├── battery_state__functions.h
            │   │   │   │   │   ├── ...
            │   │   │   │   │   ├── range__functions.c
            │   │   │   │   │   ├── range__functions.h
            │   │   │   │   │   ├── range__rosidl_typesupport_introspection_c.h
            │   │   │   │   │   ├── range__rosidl_typesupport_microxrcedds_c.h
            │   │   │   │   │   ├── range__struct.h
            │   │   │   │   │   ├── range__type_support.c
            │   │   │   │   │   ├── range__type_support.h
            │   │   │   │   │   ├── region_of_interest__functions.c
            │   │   │   │   │   ├── region_of_interest__functions.h
            │   │   │   │   │   ├── ...
            │   │   │   │   ├── fluid_pressure.h
            │   │   │   │   ├── ...
            │   │   │   │   ├── range.h
            │   │   │   │   ├── region_of_interest.h
            │   │   │   │   ├── ...
            │   │   │   └── srv
            │   │   │       ├── detail

platfomio.ini


[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
board_microros_transport = serial
monitor_port = /dev/ttyUSB0
board_microros_distro = humble

board_microros_user_meta = custom.meta

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

Source code

#include <Arduino.h>
#include <Wire.h>
#include <micro_ros_platformio.h>
#include <example_interfaces/srv/add_two_ints.h>
#include <example_interfaces/srv/set_bool.h>
#include <teensy_interfaces/srv/neo_pixel_control.h>
#include <stdio.h>
#include <global.h>
#include <config.h>
#include <setup.h>
#include <rcl/error_handling.h>
#include <rcl/rcl.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <std_msgs/msg/int32.h>
#include <std_msgs/msg/int64.h>
#include <std_msgs/msg/bool.h>
#include <sensor_msgs/msg/range.h>
#include <WS2812Serial.h>

#if !defined(MICRO_ROS_TRANSPORT_ARDUINO_SERIAL)
#error This example is only avaliable for Arduino framework with serial transport.
#endif

volatile int TFMiniVal = 0;
volatile int TFMiniStrength = 0;
int TFMini_FloorDistance = 30;
int TFMini_FloorDistanceTolerance = 12;

// ============================================================================
// INSTANCES, OBJECTS
// ============================================================================
// publisher and subscriber common
rcl_node_t node;
rclc_support_t support;
rcl_allocator_t allocator;
rclc_executor_t executor;
rcl_timer_t timer;
unsigned int num_handles = 7;   // 1 subscribers, 2 publishers, 4 services

// service addTwoInts
// rcl_service_t service_addTwoInts;

// services
rcl_service_t service_FrontLights;
rcl_service_t service_RearLights;
rcl_service_t service_OdriveFans;
rcl_service_t service_NeoPixel;

rcl_wait_set_t wait_set;

// msg_pub publisher
rcl_publisher_t publisher;
std_msgs__msg__Int32 msg_pub;

// msg_pub_range publisher
rcl_publisher_t publisher_range;
sensor_msgs__msg__Range msg_pub_range;

// subscriber
rcl_subscription_t subscriber;
std_msgs__msg__Int32 msg_sub;

// example_interfaces__srv__AddTwoInts_Response res;
// example_interfaces__srv__AddTwoInts_Request req;

example_interfaces__srv__SetBool_Request  req_FrontLights;
example_interfaces__srv__SetBool_Response res_FrontLights;

example_interfaces__srv__SetBool_Request  req_RearLights;
example_interfaces__srv__SetBool_Response res_RearLights;

example_interfaces__srv__SetBool_Request  req_OdriveFans;
example_interfaces__srv__SetBool_Response res_OdriveFans;

teensy_interfaces__srv__NeoPixelControl_Request  req_NeoPixel;
teensy_interfaces__srv__NeoPixelControl_Response res_NeoPixel;

// Left NeoPixel
byte dwgMem_NeoPixel_L[numNeoPixel_L*3];         //  3 bytes per LED
DMAMEM byte dispMem_NeoPixel_L[numNeoPixel_L*12]; // 12 bytes per LED
WS2812Serial objNeoPixel_L(numNeoPixel_L, dispMem_NeoPixel_L, dwgMem_NeoPixel_L, pinNeoPixel_L, WS2812_GRB);

// Right NeoPixel
byte dwgMem_NeoPixel_R[numNeoPixel_R*3];         //  3 bytes per LED
DMAMEM byte dispMem_NeoPixel_R[numNeoPixel_R*12]; // 12 bytes per LED
WS2812Serial objNeoPixel_R(numNeoPixel_R, dispMem_NeoPixel_R, dwgMem_NeoPixel_R, pinNeoPixel_R, WS2812_GRB);

// ============================================================================
// DEFINES
// ============================================================================
// I/O - Definitions
#define LED_PIN 13

// cleartext substitutions
// debug
#ifndef DebugMonitor
#define DebugMonitor Serial6
#endif

#define debug(x) DebugMonitor.print(x)
#define debugln(x) DebugMonitor.println(x)

// ============================================================================
// FUNCTION PROTOTYPES
// ============================================================================
#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
#define RCSOFTCHECK(fn) {rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}
// --------------------------------------------------------
// NeoPixel.colorWipe
void colorWipe(int, int, WS2812Serial);

// TFMini-Plus
void readTFMiniPlus(void);

// Error handle loop
void error_loop() {
  while(1) {
    digitalWrite(LED_PIN, !digitalRead(LED_PIN));
    delay(500);
  }
}
// --------------------------------------------------------
// timer callback (currently just increments msg_pub.data)
void timer_callback(rcl_timer_t * timer, int64_t last_call_time) {
  RCLC_UNUSED(last_call_time);
  if (timer != NULL) {
    // increments msg_pub.data and publishes on the topic
    RCSOFTCHECK(rcl_publish(&publisher, &msg_pub, NULL));
    msg_pub.data++;

    // publishes the latest value from TFMini-Plus
    msg_pub_range.range = TFMiniVal;
    msg_pub_range.min_range = 0;
    msg_pub_range.max_range = 1000;
    msg_pub_range.radiation_type = sensor_msgs__msg__Range__INFRARED;
    msg_pub_range.field_of_view = 0.04;
    msg_pub_range.header.frame_id.data = "TFMini-Plus"; 

    RCSOFTCHECK(rcl_publish(&publisher, &msg_pub_range, NULL));
  }
}
// --------------------------------------------------------
// subscriber callback
void subscription_callback(const void * msgin) {  
  const std_msgs__msg__Int32 * msg = (const std_msgs__msg__Int32 *)msgin;
  digitalWrite(LED_PIN, (msg->data == 0) ? LOW : HIGH);  
}
// --------------------------------------------------------
// srv.addTwoInts callback
// void service_addTwoInts_callback(const void * req, void * res) {
//   example_interfaces__srv__AddTwoInts_Request * req_in = (example_interfaces__srv__AddTwoInts_Request *) req;
//   example_interfaces__srv__AddTwoInts_Response * res_in = (example_interfaces__srv__AddTwoInts_Response *) res;

//   //printf("Service request value: %d + %d.\n", (int) req_in->a, (int) req_in->b);

//   res_in->sum = req_in->a + req_in->b;
// }
// --------------------------------------------------------
// srv.FrontLights callback
void service_FrontLights_callback(const void * req_FrontLights, void * res_FrontLights) {
  bool previousState = digitalRead(FRONT_LIGHT);
  example_interfaces__srv__SetBool_Request * req_in = (example_interfaces__srv__SetBool_Request *) req_FrontLights;
  example_interfaces__srv__SetBool_Response * res_in = (example_interfaces__srv__SetBool_Response *) res_FrontLights;
  
  digitalWrite(FRONT_LIGHT, (req_in->data == 0) ? LOW:HIGH);

  if (previousState != digitalRead(FRONT_LIGHT)) {
    res_in->success = true;
    res_in->message.data = const_cast<char*>("Front Lights succeeded to update");
  }
  else {
    res_in->success = false;
    res_in->message.data = const_cast<char*>("Front Lights FAILED to update");
  }
}
// --------------------------------------------------------
// srv.RearLights callback
void service_RearLights_callback(const void * req_RearLights, void * res_RearLights) {
  bool previousState = digitalRead(REAR_LIGHT);
  example_interfaces__srv__SetBool_Request * req_in = (example_interfaces__srv__SetBool_Request *) req_RearLights;
  example_interfaces__srv__SetBool_Response * res_in = (example_interfaces__srv__SetBool_Response *) res_RearLights;
  
  digitalWrite(REAR_LIGHT, (req_in->data == 0) ? LOW:HIGH);

  if (previousState != digitalRead(REAR_LIGHT)) {
    res_in->success = true;
    res_in->message.data = const_cast<char*>("Rear Lights succeeded to update");
  }
  else {
    res_in->success = false;
    res_in->message.data = const_cast<char*>("Rear Lights FAILED to update");
  }
}
// --------------------------------------------------------
// srv.OdriveFans callback
void service_OdriveFans_callback(const void * req_OdriveFans, void * res_OdriveFans) {
  bool previousState = digitalRead(ODRIVE_FAN);
  example_interfaces__srv__SetBool_Request * req_in = (example_interfaces__srv__SetBool_Request *) req_OdriveFans;
  example_interfaces__srv__SetBool_Response * res_in = (example_interfaces__srv__SetBool_Response *) res_OdriveFans;
  
  digitalWrite(ODRIVE_FAN, (req_in->data == 0) ? LOW:HIGH);

  if (previousState != digitalRead(ODRIVE_FAN)) {
    res_in->success = true;
    res_in->message.data = const_cast<char*>("Odrive Fans succeeded to update");
  }
  else {
    res_in->success = false;
    res_in->message.data = const_cast<char*>("Odrive Fans FAILED to update");
  }
}
// --------------------------------------------------------
// srv.NeoPixel callback
void service_NeoPixel_callback(const void * req_NeoPixel, void * res_NeoPixel) {
  teensy_interfaces__srv__NeoPixelControl_Request * req_in = (teensy_interfaces__srv__NeoPixelControl_Request *) req_NeoPixel;
  teensy_interfaces__srv__NeoPixelControl_Response * res_in = (teensy_interfaces__srv__NeoPixelControl_Response *) res_NeoPixel;
  
  switch(req_in->status) {
    case 1:
      colorWipe(ORANGE, 10, objNeoPixel_L);
      colorWipe(ORANGE, 10, objNeoPixel_R);
      break;
    case 2:
      colorWipe(RED, 10, objNeoPixel_L);
      colorWipe(RED, 10, objNeoPixel_R);
      break;
    case 3:
      colorWipe(GREEN, 10, objNeoPixel_L);
      colorWipe(GREEN, 10, objNeoPixel_R);
      break;
    case 4:
      colorWipe(BLUE, 10, objNeoPixel_L);
      colorWipe(BLUE, 10, objNeoPixel_R);
      break;
    case 5:
      colorWipe(YELLOW, 10, objNeoPixel_L);
      colorWipe(YELLOW, 10, objNeoPixel_R);
      break;
    case 6:
      colorWipe(PINK, 10, objNeoPixel_L);
      colorWipe(PINK, 10, objNeoPixel_R);
      break;
    case 7:
      colorWipe(ORANGE, 10, objNeoPixel_L);
      colorWipe(ORANGE, 10, objNeoPixel_R);
      break;
    case 8:
      colorWipe(WHT, 10, objNeoPixel_L);
      colorWipe(WHT, 10, objNeoPixel_R);
      break;
    default:
      colorWipe(BLANK, 10, objNeoPixel_L);
      colorWipe(BLANK, 10, objNeoPixel_R);
      break;
  }
  res_in->success = true;
  res_in->message.data = const_cast<char*>("Neopixel changed");
  
  // res_in->success = true;
  // res_in->message.data = const_cast<char*>("Neopixel blanked");
}

// ============================================================================
// SETUP
// ============================================================================
void setup() {
  set_microros_serial_transports(Serial);

  // Debug
  DebugMonitor.begin(115200);
  
  // I/O setup
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, HIGH); 

  pinMode(FRONT_LIGHT, OUTPUT); digitalWrite(FRONT_LIGHT, LOW);
  pinMode(REAR_LIGHT, OUTPUT);  digitalWrite(REAR_LIGHT, LOW);
  pinMode(ODRIVE_FAN, OUTPUT);  digitalWrite(ODRIVE_FAN, LOW);

  // Neopixel
  objNeoPixel_L.begin();
  objNeoPixel_R.begin();

  // TFMini Plus
  TFMiniPlus.begin(115200);  // HW Serial for TFmini
  delay (200);            // Give a little time for things to start
  // Set TFMini Plus to Standard Output mode
  TFMiniPlus.write(0x42);
  TFMiniPlus.write(0x57);
  TFMiniPlus.write(0x02);
  TFMiniPlus.write(0x00);
  TFMiniPlus.write(0x00);
  TFMiniPlus.write(0x00);
  TFMiniPlus.write(0x01);
  TFMiniPlus.write(0x06);

  delay(1000);
  colorWipe(ORANGE, 10, objNeoPixel_L);
  colorWipe(ORANGE, 10, objNeoPixel_R);

  allocator = rcl_get_default_allocator();

  // create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&node, "uros_platformio_node", "", &support));

  // create service addTwoInts
  // RCCHECK(rclc_service_init_default(&service_addTwoInts, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, AddTwoInts), "/addtwoints"));

  // create service FrontLights
  RCCHECK(rclc_service_init_default(&service_FrontLights, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, SetBool), "/frontlights"));

  // create service RearLights
  RCCHECK(rclc_service_init_default(&service_RearLights, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, SetBool), "/rearlights"));

  // create service OdriveFans
  RCCHECK(rclc_service_init_default(&service_OdriveFans, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, SetBool), "/odrivefans"));

  // create service NeoPixel
  RCCHECK(rclc_service_init_default(&service_NeoPixel, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(teensy_interfaces, srv, NeoPixelControl), "/neopixel"));
    
  // create msg_pub publisher
  RCCHECK(rclc_publisher_init_default(&publisher, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "micro_ros_platformio_node_publisher"));

  // create msg_pub_range publisher
  // RCCHECK(rclc_publisher_init_default(&publisher_range, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "micro_ros_platformio_node_publisher_range"));
  RCCHECK(rclc_publisher_init_default(&publisher_range, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(sesnsor_msgs, msg, Range), "micro_ros_platformio_node_publisher_range"));

  // create subscriber
  RCCHECK(rclc_subscription_init_default(&subscriber, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "micro_ros_platformio_node_subscriber"));

  // create timer,
  const unsigned int timer_timeout = 1000;
  RCCHECK(rclc_timer_init_default(&timer, &support, RCL_MS_TO_NS(timer_timeout), timer_callback));

  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, num_handles, &allocator));  
  // RCCHECK(rclc_executor_add_service(&executor, &service_addTwoInts, &req, &res, service_addTwoInts_callback));
  RCCHECK(rclc_executor_add_service(&executor, &service_FrontLights, &req_FrontLights, &res_FrontLights, service_FrontLights_callback));
  RCCHECK(rclc_executor_add_service(&executor, &service_RearLights, &req_RearLights, &res_RearLights, service_RearLights_callback));
  RCCHECK(rclc_executor_add_service(&executor, &service_OdriveFans, &req_OdriveFans, &res_OdriveFans, service_OdriveFans_callback));
  RCCHECK(rclc_executor_add_service(&executor, &service_NeoPixel, &req_NeoPixel, &res_NeoPixel, service_NeoPixel_callback));
  RCCHECK(rclc_executor_add_subscription(&executor, &subscriber, &msg_sub, &subscription_callback, ON_NEW_DATA));   
  RCCHECK(rclc_executor_add_timer(&executor, &timer));

  msg_pub.data = 0;
} // end setup

// ============================================================================
// MAIN LOOP
// ============================================================================
void loop() {
  // variable declarations
  uint32_t t = millis();

  if (bFirstScan) {
    bFirstScan = false;
    debugln("First Scan");
  }  

  // ------------------------------------------------------
  // Service Routine[0]: DEBUG
  #if SR00_DEBUG_EN == 1
  if ((t-tTime[0]) >= (1000 / DEBUG_PULSE))
  {
    debugln(msg_pub.data);
    tTime[0] = t;
  }
  #endif

  #if SR01_TFMINI_EN == 1
  if ((t-tTime[1]) >= (1000 / TFM_PULSE))
  {
    readTFMiniPlus();
    debug("Distance: "); debugln(TFMiniVal);
    debug("Strength: "); debugln(TFMiniStrength);
    debugln("--------------------");
    tTime[1] = t;
  }
  #endif




  // EXECUTOR HANDLE SPIN
  if ((t-tTime[10]) >= (1000 / SPIN_PULSE))
  {
    RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)));
    tTime[10] = t;
  }  
}

// --------------------------------------------------------
// FUNCTIONS
// --------------------------------------------------------
// colorWipe
void colorWipe(int color, int wait, WS2812Serial refObject) {
  for (int i=0; i < refObject.numPixels(); i++) {
    refObject.setPixel(i, color);
    refObject.show();
    delayMicroseconds(wait);
  }
}
// ----------------------------------------------------------------------------
void readTFMiniPlus(){
// Data Format for Benewake TFmini
// ===============================
// 9 bytes total per message:
// 1) 0x59
// 2) 0x59
// 3) Dist_L (low 8bit)
// 4) Dist_H (high 8bit)
// 5) Strength_L (low 8bit)
// 6) Strength_H (high 8bit)
// 7) Reserved bytes
// 8) Original signal quality degree
// 9) Checksum parity bit (low 8bit), Checksum = Byte1 + Byte2 +…+Byte8. This is only a low 8bit though
while(TFMiniPlus.available()>=9) // When at least 9 bytes of data available (expected number of bytes for 1 signal), then read
{
  // debugln("Check2");
  if((0x59 == TFMiniPlus.read()) && (0x59 == TFMiniPlus.read())) // byte 1 and byte 2
  {
    unsigned int t1 = TFMiniPlus.read(); // byte 3 = Dist_L
    unsigned int t2 = TFMiniPlus.read(); // byte 4 = Dist_H
    t2 <<= 8;
    t2 += t1;
    TFMiniVal = t2*10;
    t1 = TFMiniPlus.read(); // byte 5 = Strength_L
    t2 = TFMiniPlus.read(); // byte 6 = Strength_H
    t2 <<= 8;
    t2 += t1;
    TFMiniStrength = t2;
    for(int i=0; i<3; i++)TFMiniPlus.read(); // byte 7, 8, 9 are ignored
  }
}
}

undefined reference to `rosidl_typesupport_c...

I get an "undefined reference to" error when attempting to compile the source code below.

undefined reference to `rosidl_typesupport_c__get_service_type_support_handle__example_interfaces__srv__AddTwoInts'

Ubuntu 22.04.1 with ROS2 Humble install (desktop)
Visual Studio Code Version: 1.71.2
PlatformIO Core 6.1.4·Home 3.4.3
Platform Teensy 4.1 and micro_ROS

To the source code. This is my attempt of porting the micro-ros_addtwoints_service example from micro_ros_arduino repo.
As far as I can tell, I have all libraries properly installed and my include paths defined.

The problem seems to come from the library difference. In the example #include <micro_ros_arduino.h> was used and due to porting it to the teensy and platformio it has been changed to #include <micro_ros_platformio.h>.
However, digging deeper into the library I can't see where the problem is.

Source code:

//#include <micro_ros_arduino.h>
#include <Arduino.h>
#include <micro_ros_platformio.h>
#include <example_interfaces/srv/add_two_ints.h>
#include <stdio.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <std_msgs/msg/int64.h>

rcl_node_t node;
rclc_support_t support;
rcl_allocator_t allocator;
rclc_executor_t executor;

rcl_service_t service;
rcl_wait_set_t wait_set;

example_interfaces__srv__AddTwoInts_Response res;
example_interfaces__srv__AddTwoInts_Request req;

#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){while(1){};}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}

void service_callback(const void * req, void * res){
  example_interfaces__srv__AddTwoInts_Request * req_in = (example_interfaces__srv__AddTwoInts_Request *) req;
  example_interfaces__srv__AddTwoInts_Response * res_in = (example_interfaces__srv__AddTwoInts_Response *) res;

  //printf("Service request value: %d + %d.\n", (int) req_in->a, (int) req_in->b);

  res_in->sum = req_in->a + req_in->b;
}

void setup() {
  //set_microros_transports();
  Serial.begin(115200);
  set_microros_serial_transports(Serial);
  delay(1000); 

  allocator = rcl_get_default_allocator();

  // create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&node, "add_twoints_client_rclc", "", &support));

  // create service
  RCCHECK(rclc_service_init_default(&service, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, AddTwoInts), "/addtwoints"));

  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_service(&executor, &service, &req, &res, service_callback));
}


void loop() {
  delay(100);
  RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)));
}

Below is the entire compiler output I'm getting. The transports is properly selected to be Serial and configuration is matching the intended platformio.ini, which can also be found further below.

~/Documents/gitclones/AutoBot_uros$ pio run
Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.17.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES: 
 - framework-arduinoteensy @ 1.157.220801 (1.57) 
 - tool-teensy @ 1.157.0 (1.57) 
 - toolchain-gccarmnoneeabi @ 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/usr/bin/python3 -m pip install pyyaml
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (5.4.1)
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/usr/bin/python3 -m pip install markupsafe==2.0.1
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: markupsafe==2.0.1 in /usr/lib/python3/dist-packages (2.0.1)
Configuring teensy41 with transport serial
micro-ROS already built
Found 93 compatible libraries
Scanning dependencies...
Dependency Graph
|-- micro_ros_platformio @ 0.0.1+sha.22cf9b6
Building in release mode
Linking .pio/build/teensy41/firmware.elf
.pio/build/teensy41/src/main.cpp.o: In function `setup':
main.cpp:(.text.setup+0x9a): undefined reference to `rosidl_typesupport_c__get_service_type_support_handle__example_interfaces__srv__AddTwoInts'
collect2: error: ld returned 1 exit status
*** [.pio/build/teensy41/firmware.elf] Error 1
========================================================== [FAILED] Took 3.82 seconds ==========================================================

And here now the platformio.ini

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
board_microros_transport = serial

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

Lots of compilation errors when invoking "pio run" for the [env:esp32dev_wifi] pio environment

Issue template

Several compilation errors when compiling for the [env:esp32dev_wifi] environment.
How do I resolve these?

  • Hardware description: esp32
  • RTOS: arduino
  • Installation type: micro_ros_platformio
  • Version or commit hash: master

Steps to reproduce the issue

  • $ git clone [email protected]:safdark/micro_ros_platformio_ci.git ./ci
    (This is a copy of the ci/ folder from the original repository, with only the esp32dev_wifi environment present in the platformio.ini file, for simplicity)

  • $ cd ci

  • $ pio lib install

Library Storage: /home/safdar/code/repositories/myproject_firmware/entrypoints/ci/.pio/libdeps/esp32dev_wifi
Library Manager: Installing git+https://github.com/micro-ROS/micro_ros_platformio
git version 2.25.1
Cloning into '/home/safdar/.platformio/.cache/tmp/pkg-installing-fvshhh20'...
remote: Enumerating objects: 64, done.
remote: Counting objects: 100% (64/64), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 64 (delta 10), reused 42 (delta 5), pack-reused 0
Unpacking objects: 100% (64/64), 123.23 KiB | 882.00 KiB/s, done.
Library Manager: micro_ros_platformio @ 0.0.1+sha.c20916a has been installed!

  • $ pio run

Expected behavior

Should compile succesfully since I haven't changed anything in the original ci/ folder.

Actual behavior

Output:

$ pio run

Processing esp32dev_wifi (platform: espressif32; board: esp32dev; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.5.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 3.10006.210326 (1.0.6) 
 - tool-esptoolpy 1.30100.210531 (3.1.0) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/home/safdar/.platformio/penv/bin/python -m pip install pyyaml
Requirement already satisfied: pyyaml in /home/safdar/.platformio/penv/lib/python3.8/site-packages (6.0)
WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
You should consider upgrading via the '/home/safdar/.platformio/penv/bin/python -m pip install --upgrade pip' command.
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/home/safdar/.platformio/penv/bin/python -m pip install markupsafe==2.0.1
Requirement already satisfied: markupsafe==2.0.1 in /home/safdar/.platformio/penv/lib/python3.8/site-packages (2.0.1)
WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available.
You should consider upgrading via the '/home/safdar/.platformio/penv/bin/python -m pip install --upgrade pip' command.
Configuring esp32dev with transport wifi
Downloading micro-ROS dev dependencies
	 - Downloaded ament_cmake
	 - Downloaded ament_lint
	 - Downloaded ament_package
	 - Downloaded googletest
	 - Downloaded ament_cmake_ros
	 - Downloaded ament_index
Building micro-ROS dev dependencies
Downloading micro-ROS library
	 - Downloaded microcdr
	 - Downloaded microxrcedds_client
	 - Downloaded rcl_yaml_param_parser (ignored)
	 - Downloaded rcl_lifecycle
	 - Downloaded rcl_action
	 - Downloaded rcl
	 - Downloaded rclc
	 - Downloaded rclc_examples (ignored)
	 - Downloaded rclc_parameter
	 - Downloaded rclc_lifecycle
	 - Downloaded micro_ros_utilities
	 - Downloaded rcutils
	 - Downloaded micro_ros_msgs
	 - Downloaded rmw_microxrcedds
	 - Downloaded rosidl_typesupport_c
	 - Downloaded rosidl_typesupport_cpp (ignored)
	 - Downloaded rosidl_typesupport_microxrcedds_c
	 - Downloaded rosidl_typesupport_microxrcedds_cpp (ignored)
	 - Downloaded rosidl_typesupport_microxrcedds_cpp_tests
	 - Downloaded rosidl_typesupport_microxrcedds_test_msg
	 - Downloaded rosidl_typesupport_microxrcedds_c_tests
	 - Downloaded rosidl_typesupport_introspection_c
	 - Downloaded rosidl_generator_c
	 - Downloaded rosidl_runtime_cpp (ignored)
	 - Downloaded rosidl_cmake
	 - Downloaded rosidl_runtime_c
	 - Downloaded rosidl_parser
	 - Downloaded rosidl_typesupport_introspection_cpp (ignored)
	 - Downloaded rosidl_adapter
	 - Downloaded rosidl_cli
	 - Downloaded rosidl_typesupport_interface
	 - Downloaded rosidl_generator_cpp (ignored)
	 - Downloaded rmw
	 - Downloaded rmw_implementation_cmake
	 - Downloaded statistics_msgs
	 - Downloaded composition_interfaces
	 - Downloaded rcl_interfaces
	 - Downloaded rosgraph_msgs
	 - Downloaded action_msgs
	 - Downloaded builtin_interfaces
	 - Downloaded test_msgs
	 - Downloaded lifecycle_msgs
	 - Downloaded rosidl_default_generators
	 - Downloaded rosidl_default_runtime
	 - Downloaded unique_identifier_msgs
	 - Downloaded actionlib_msgs
	 - Downloaded stereo_msgs
	 - Downloaded diagnostic_msgs
	 - Downloaded sensor_msgs
	 - Downloaded std_msgs
	 - Downloaded visualization_msgs
	 - Downloaded shape_msgs
	 - Downloaded sensor_msgs_py
	 - Downloaded std_srvs
	 - Downloaded trajectory_msgs
	 - Downloaded nav_msgs
	 - Downloaded common_interfaces
	 - Downloaded geometry_msgs
	 - Downloaded test_interface_files
	 - Downloaded test_rmw_implementation
	 - Downloaded rmw_implementation
	 - Downloaded rcl_logging_spdlog (ignored)
	 - Downloaded rcl_logging_interface
	 - Downloaded rcl_logging_log4cxx (ignored)
	 - Downloaded rcl_logging_noop
	 - Downloaded tracetools_read
	 - Downloaded tracetools
	 - Downloaded tracetools_trace
	 - Downloaded tracetools_test
	 - Downloaded tracetools_launch
	 - Downloaded ros2trace
Checking extra packages
	 - Downloaded control_msgs
	 - Adding my_custom_message
Building micro-ROS library
Build mcu micro-ROS environment failed: 

...
...
...   <<<<<< Several CMake Warning messages >>>>>>
...
...

CMake Error at /opt/ros/galactic/share/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c-extras.cmake:5 (find_package):
  Could not find a configuration file for package "fastcdr" that is
  compatible with requested version "".

  The following configuration files were considered but not accepted:

    /opt/ros/galactic/lib/cmake/fastcdr/fastcdr-config.cmake, version: 1.0.20 (64bit)
    /usr/local/lib/cmake/fastcdr/fastcdr-config.cmake, version: 1.0.23 (64bit)

Call Stack (most recent call first):
  /opt/ros/galactic/share/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_cConfig.cmake:41 (include)
  /home/safdar/code/repositories/myproject_firmware/entrypoints/ci/.pio/libdeps/esp32dev_wifi/micro_ros_platformio/build/mcu/install/share/rosidl_typesupport_c/cmake/rosidl_typesupport_c-extras.cmake:13 (find_package)
  /home/safdar/code/repositories/myproject_firmware/entrypoints/ci/.pio/libdeps/esp32dev_wifi/micro_ros_platformio/build/mcu/install/share/rosidl_typesupport_c/cmake/rosidl_typesupport_cConfig.cmake:41 (include)
  /home/safdar/code/repositories/myproject_firmware/entrypoints/ci/.pio/libdeps/esp32dev_wifi/micro_ros_platformio/build/mcu/install/share/rosidl_default_generators/cmake/rosidl_default_generators-extras.cmake:21 (find_package)
  /home/safdar/code/repositories/myproject_firmware/entrypoints/ci/.pio/libdeps/esp32dev_wifi/micro_ros_platformio/build/mcu/install/share/rosidl_default_generators/cmake/rosidl_default_generatorsConfig.cmake:41 (include)
  CMakeLists.txt:14 (find_package)

---
Failed   <<< lifecycle_msgs [0.61s, exited with code 1]

============================================================================================================================== [FAILED] Took 59.21 seconds ==============================================================================================================================

Additional information

  • I have tried this both with and without sourcing the environment for ROS2.
  • I upgraded colcon to version 0.8.2.
$ colcon version-check
colcon-argcomplete 0.3.3: up-to-date
colcon-bash 0.4.2: up-to-date
colcon-cd 0.1.1: up-to-date
colcon-cmake 0.2.26: up-to-date
colcon-core 0.7.1: newer version available (0.8.2)
colcon-defaults 0.2.6: up-to-date
colcon-devtools 0.2.3: up-to-date
colcon-library-path 0.2.1: up-to-date
colcon-metadata 0.2.5: up-to-date
colcon-notification 0.2.13: up-to-date
colcon-output 0.2.12: up-to-date
colcon-package-information 0.3.3: up-to-date
colcon-package-selection 0.2.10: up-to-date
colcon-parallel-executor 0.2.4: up-to-date
colcon-pkg-config 0.1.0: up-to-date
colcon-powershell 0.3.7: up-to-date
colcon-python-setup-py 0.2.7: up-to-date
colcon-recursive-crawl 0.2.1: up-to-date
colcon-ros 0.3.22: newer version available (0.3.23)
colcon-test-result 0.3.8: up-to-date
colcon-zsh 0.4.0: up-to-date

Environment:

$ env | grep ROS
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_LOCALHOST_ONLY=0
ROS_DISTRO=galactic

PIO version:

$ pio --version
PlatformIO Core, version 5.2.5

[Windows10] Failed to build microros library due to invalid directory

  • Hardware description: ESP32, Windows10
  • Version or commit hash: 87baf5e

Steps to reproduce the issue

  1. clone 4ef4b18
  2. open examples/ESP32 project with Platformio
  3. try building

OR

  1. Create new ESP32 platformio project
  2. Add lines below to platformio.ini
microros_transport = serial
microros_distro = galactic
lib_deps =
    https://github.com/micro-ROS/micro_ros_platformio 
  1. Try building

Expected behavior

code compiles with microros library

Actual behavior

Warning! Ignore unknown configuration option `microros_transport` in section [env:esp32dev]
Warning! Ignore unknown configuration option `microros_distro` in section [env:esp32dev]
Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.5.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
All required Python pip packages are installed
Configuring esp32dev with transport serial
micro-ROS dev already downloaded
Building micro-ROS dev dependencies
The system cannot find the path specified.
micro-ROS already downloaded
Building micro-ROS library
'.' is not recognized as an internal or external command,
operable program or batch file.
NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\\Zinc\\HomeProjects\\micro_ros_platformio\\examples\\ESP32\\.pio\\libdeps\\esp32dev\\micro_ros_platformio/build/aux':
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 181:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Zinc\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Zinc\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Zinc\.platformio\platforms\espressif32\builder\main.py", line 233:
    target_elf = env.BuildProgram()
  File "C:\Users\Zinc\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 62:
    env.ProcessProjectDeps()
  File "C:\Users\Zinc\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 141:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "C:\Users\Zinc\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1104:
    project.install_dependencies()
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 922:
    if _is_builtin(spec):
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 914:
    for lb in self.env.GetLibBuilders():
  File "C:\Users\Zinc\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 1035:
    lb = LibBuilderFactory.new(env, lib_dir)
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 61:
    obj = getattr(sys.modules[__name__], clsname)(env, path, verbose=verbose)
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 149:
    self.process_extra_options()
  File "C:\Users\Zinc\.platformio\penv\lib\site-packages\platformio\builder\tools\piolib.py", line 292:
    self.env.SConscript(
  File "C:\Users\Zinc\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Zinc\.platformio\packages\tool-scons\scons-local-4.3.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Zinc\HomeProjects\micro_ros_platformio\examples\ESP32\.pio\libdeps\esp32dev\micro_ros_platformio\extra_script.py", line 74:
    builder.run('{}/metas/{}'.format(main_path, selected_board_meta), cmake_toolchain.path, microros_user_meta)
  File "C:\Users\Zinc\HomeProjects\micro_ros_platformio\examples\ESP32\.pio\libdeps\esp32dev\micro_ros_platformio\microros_utils\library_builder.py", line 153:
    self.package_mcu_library()
  File "C:\Users\Zinc\HomeProjects\micro_ros_platformio\examples\ESP32\.pio\libdeps\esp32dev\micro_ros_platformio\microros_utils\library_builder.py", line 220:
    os.makedirs(self.build_folder + "/aux", exist_ok=True)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3312.0_x64__qbz5n2kfra8p0\lib\os.py", line 225:
    mkdir(name, mode)

Additional information

rclc single node failing to init secondary service

Hardware description: Teensy 4.1
Installation type: Ubuntu 22.04.1, ROS2 (humble)
Version or commit hash: ROS-humble
Platformio Core 6.1.4·Home 3.4.3 withing VS-Code 1.72.2

Steps to reproduce the issue

Take Source code below, check how service AddTwoInts was "duplicated" and adjusted for Service "SetBool"
Create project in platformio
set-up your platformio.ini as the below code-sample
use proper build workflow: (a) clean, or delete .pio folder, b) pio lib install, c) pio run, d) pio run

Expected behavior
Compile without error and actually work on target, creating two individual services under single node

Actual behavior
Compiles just fine, but once loaded into target, the initialization of second service (setBool) will cause the error_loop to be called.
This is in line
RCCHECK(rclc_service_init_default(&service_setBool, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, SetBool), "/setbool"));

Additional Information
Each service works by itself. Removing (commenting) one or the other results in proper function.
There must be something wrong with the RCCHECK? Tracking it back, it returns error code
RCL_RET_OK

I found the definition in file types.h:

/// Success return code.
#define RCL_RET_OK RMW_RET_OK
/// Unspecified error return code.
#define RCL_RET_ERROR RMW_RET_ERROR
/// Timeout occurred return code.
#define RCL_RET_TIMEOUT RMW_RET_TIMEOUT
/// Failed to allocate memory return code.
#define RCL_RET_BAD_ALLOC RMW_RET_BAD_ALLOC
/// Invalid argument return code.
#define RCL_RET_INVALID_ARGUMENT RMW_RET_INVALID_ARGUMENT
/// Unsupported return code.
#define RCL_RET_UNSUPPORTED RMW_RET_UNSUPPORTED

Hovering with the mouse over the individual #defines, the tooltip revealed the "1" seen in my debug output resolves to

RMW_RET_ERROR

with the comment above:

/// Unspecified error return code.

platfomio.ini

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
board_microros_transport = serial
monitor_port = /dev/ttyUSB0
board_microros_distro = humble

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

Source code

#include <Arduino.h>
#include <Wire.h>
#include <micro_ros_platformio.h>
#include <example_interfaces/srv/add_two_ints.h>
#include <example_interfaces/srv/set_bool.h>
#include <stdio.h>
#include <rcl/error_handling.h>
#include <rcl/rcl.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <std_msgs/msg/int32.h>
#include <std_msgs/msg/int64.h>
#include <std_msgs/msg/bool.h>

#if !defined(MICRO_ROS_TRANSPORT_ARDUINO_SERIAL)
#error This example is only avaliable for Arduino framework with serial transport.
#endif

// ============================================================================
// INSTANCES, OBJECTS
// ============================================================================
// publisher and subscriber common
rcl_node_t node;
rclc_support_t support;
rcl_allocator_t allocator;
rclc_executor_t executor;
rcl_timer_t timer;
unsigned int num_handles = 4;   // 1 subscriber, 1 publisher, 2 service

// service addTwoInts
rcl_service_t service_addTwoInts;

// service setBool
rcl_service_t service_setBool;

rcl_wait_set_t wait_set;

//publisher
rcl_publisher_t publisher;
std_msgs__msg__Int32 msg_pub;

// subscriber
rcl_subscription_t subscriber;
std_msgs__msg__Int32 msg_sub;

example_interfaces__srv__AddTwoInts_Response res;
example_interfaces__srv__AddTwoInts_Request req;

example_interfaces__srv__SetBool_Response res_setBool;
example_interfaces__srv__SetBool_Request req_setBool;


// ============================================================================
// DEFINES
// ============================================================================
// I/O - Definitions
#define LED_PIN 13

// ============================================================================
// FUNCTION PROTOTYPES
// ============================================================================
#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){error_loop();}}
#define RCSOFTCHECK(fn) {rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}

// Error handle loop
void error_loop() {
  while(1) {
    digitalWrite(LED_PIN, !digitalRead(LED_PIN));
    delay(500);
  }
}
// --------------------------------------------------------
// timer callback (currently just increments msg_pub.data)
void timer_callback(rcl_timer_t * timer, int64_t last_call_time) {
  RCLC_UNUSED(last_call_time);
  if (timer != NULL) {
    RCSOFTCHECK(rcl_publish(&publisher, &msg_pub, NULL));
    msg_pub.data++;
  }
}
// --------------------------------------------------------
// subscriber callback
void subscription_callback(const void * msgin) {  
  const std_msgs__msg__Int32 * msg = (const std_msgs__msg__Int32 *)msgin;
  digitalWrite(LED_PIN, (msg->data == 0) ? LOW : HIGH);  
}
// --------------------------------------------------------
// srv.addTwoInts callback
void service_addTwoInts_callback(const void * req, void * res) {
  example_interfaces__srv__AddTwoInts_Request * req_in = (example_interfaces__srv__AddTwoInts_Request *) req;
  example_interfaces__srv__AddTwoInts_Response * res_in = (example_interfaces__srv__AddTwoInts_Response *) res;

  //printf("Service request value: %d + %d.\n", (int) req_in->a, (int) req_in->b);

  res_in->sum = req_in->a + req_in->b;
}
// --------------------------------------------------------
// srv.setBool callback
void service_setBool_callback(const void * req_setBool, void * res_setBool) {
  bool previousState = digitalRead(LED_PIN);
  example_interfaces__srv__SetBool_Request * req_in = (example_interfaces__srv__SetBool_Request *) req_setBool;
  example_interfaces__srv__SetBool_Response * res_in = (example_interfaces__srv__SetBool_Response *) res_setBool;
  
  digitalWrite(LED_PIN, (req_in->data == 0) ? LOW:HIGH);

  if (previousState != digitalRead(LED_PIN)) {
    res_in->success = true;
  }
  else {
    res_in->success = false;
  }
}

// ============================================================================
// SETUP
// ============================================================================
void setup() {
  set_microros_serial_transports(Serial);

  // I/O setup
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, HIGH);

  delay(1000); 

  allocator = rcl_get_default_allocator();

  // create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&node, "uros_platformio_node", "", &support));

  // create service addTwoInts
  RCCHECK(rclc_service_init_default(&service_addTwoInts, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, AddTwoInts), "/addtwoints"));

  // create service setBool
  RCCHECK(rclc_service_init_default(&service_setBool, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, SetBool), "/setbool"));
    
  // create publisher
  RCCHECK(rclc_publisher_init_default(&publisher, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "micro_ros_platformio_node_publisher"));

  // create subscriber
  RCCHECK(rclc_subscription_init_default(&subscriber, &node, ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32), "micro_ros_platformio_node_subscriber"));

  // create timer,
  const unsigned int timer_timeout = 1000;
  RCCHECK(rclc_timer_init_default(&timer, &support, RCL_MS_TO_NS(timer_timeout), timer_callback));

  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, num_handles, &allocator));  
  RCCHECK(rclc_executor_add_service(&executor, &service_addTwoInts, &req, &res, service_addTwoInts_callback));
  RCCHECK(rclc_executor_add_service(&executor, &service_setBool, &req_setBool, &res_setBool, service_setBool_callback));
  RCCHECK(rclc_executor_add_subscription(&executor, &subscriber, &msg_sub, &subscription_callback, ON_NEW_DATA));   
  RCCHECK(rclc_executor_add_timer(&executor, &timer));

  msg_pub.data = 0;
}

// ============================================================================
// MAIN LOOP
// ============================================================================
void loop() {
  delay(100);
  RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)));
}

unable to include extra_packages

Issue template

  • Hardware description: Teensy 4.1
  • Installation type: Ubuntu 22.04.1, ROS2 (humble)
  • Version or commit hash: ROS-humble
  • Platformio Core 6.1.4·Home 3.4.3 withing VS-Code 1.72.2

Steps to reproduce the issue

  1. Take Arduino -> Examples -> INCOMPATIBLE -> micro_ros_arduino -> "micro-ros_addtwoints_service"
  2. Create project in platformio
  3. set-up your platformio.ini as the below code-sample
  4. make sure the #include section matches source code below. There is also a separate code-snippet
  5. in setup, make sure to add the transport protocol. Line should look like this "set_microros_serial_transports(Serial);"
  6. copy the "example_interfaces" directory from Arduino library into "extra_packages" folder. (compare dir-structure below)
  7. use proper build workflow: (a) clean, or delete .pio folder, b) pio lib install, c) pio run, d) pio run

Expected behavior

Compile without error

Actual behavior

fails at step 7 c) with compiler error, see below for details

Additional information

Folder to copy into "extra_packages"

/Arduino/libraries/micro_ros_arduino-2.0.5-humble/src/example_interfaces

Compiler error

undefined reference to rosidl_typesupport_c__get_service_type_support_handle__example_interfaces__srv__AddTwoInts'`

platfomio.ini

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
board_microros_transport = serial
monitor_port = /dev/ttyUSB0
board_microros_distro = humble

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

Include section

#include <Arduino.h>
#include <Wire.h>
#include <micro_ros_platformio.h>
#include <example_interfaces/srv/add_two_ints.h>
#include <stdio.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <std_msgs/msg/int64.h>

Source code

#include <Arduino.h>
#include <micro_ros_platformio.h>
#include <example_interfaces/srv/add_two_ints.h>
#include <stdio.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <std_msgs/msg/int64.h>

rcl_node_t node;
rclc_support_t support;
rcl_allocator_t allocator;
rclc_executor_t executor;

rcl_service_t service;
rcl_wait_set_t wait_set;

example_interfaces__srv__AddTwoInts_Response res;
example_interfaces__srv__AddTwoInts_Request req;

#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){while(1){};}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}

void service_callback(const void * req, void * res){
  example_interfaces__srv__AddTwoInts_Request * req_in = (example_interfaces__srv__AddTwoInts_Request *) req;
  example_interfaces__srv__AddTwoInts_Response * res_in = (example_interfaces__srv__AddTwoInts_Response *) res;

  //printf("Service request value: %d + %d.\n", (int) req_in->a, (int) req_in->b);

  res_in->sum = req_in->a + req_in->b;
}

void setup() {
  set_microros_serial_transports(Serial);  
  Serial.begin(115200);
  delay(1000); 

  allocator = rcl_get_default_allocator();

  // create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&node, "add_twoints_client_rclc", "", &support));

  // create service
  RCCHECK(rclc_service_init_default(&service, &node, ROSIDL_GET_SRV_TYPE_SUPPORT(example_interfaces, srv, AddTwoInts), "/addtwoints"));

  // create executor
  RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_service(&executor, &service, &req, &res, service_callback));
}


void loop() {
  delay(100);
  RCSOFTCHECK(rclc_executor_spin_some(&executor, RCL_MS_TO_NS(100)));
}

Directory structure

extra_packages$ tree -L 3
.
└── example_interfaces
    ├── action
    │   ├── detail
    │   └── fibonacci.h
    ├── msg
    │   ├── bool.h
    │   ├── byte.h
    │   ├── byte_multi_array.h
    │   ├── char.h
    │   ├── detail
    │   ├── empty.h
    │   ├── float32.h
    │   ├── float32_multi_array.h
    │   ├── float64.h
    │   ├── float64_multi_array.h
    │   ├── int16.h
    │   ├── int16_multi_array.h
    │   ├── int32.h
    │   ├── int32_multi_array.h
    │   ├── int64.h
    │   ├── int64_multi_array.h
    │   ├── int8.h
    │   ├── int8_multi_array.h
    │   ├── multi_array_dimension.h
    │   ├── multi_array_layout.h
    │   ├── rosidl_generator_c__visibility_control.h
    │   ├── rosidl_typesupport_introspection_c__visibility_control.h
    │   ├── rosidl_typesupport_microxrcedds_c__visibility_control.h
    │   ├── string.h
    │   ├── u_int16.h
    │   ├── u_int16_multi_array.h
    │   ├── u_int32.h
    │   ├── u_int32_multi_array.h
    │   ├── u_int64.h
    │   ├── u_int64_multi_array.h
    │   ├── u_int8.h
    │   ├── u_int8_multi_array.h
    │   └── w_string.h
    └── srv
        ├── add_two_ints.h
        ├── detail
        ├── set_bool.h
        └── trigger.h

7 directories, 36 files

Ethernet support for ESP32

  • Hardware description: Olimex ESP32-GATEWAY

I'm currently trying to implement support of Ethernet for the ESP32 with microROS, however, the ESP-IDF API looks really complicated, so I tried to use https://github.com/espressif/arduino-esp32/tree/master/libraries/Ethernet in conjunction with this project.

However, it isn't working as expected:

E (1014) esp.emac: emac_esp32_init(349): reset timeout
E (1015) esp_eth: esp_eth_driver_install(214): init mac failed
[  1018][E][ETH.cpp:323] begin(): esp_eth_driver_install failed
[  4079][E][WiFiUdp.cpp:183] endPacket(): could not send data: 118

Do you have any tips or ideas on how to implement Ethernet support for the ESP32 into microROS?

compiling issue

Issue compiling in Visual Studio Code with PlatformIO.
Created blank project, added the config in platfomio.ini and copied the example, then followed the instructions below on how to set everything up.

(Initially I tried doing all this in Window$ until I realized it won't work. So I switched into Ubuntu 22.04, which has ROS2 already installed.

Here is the error trace. It first downloaded heaps of packages and then it suddenly failed.

administrator@dev01:~/Documents/gitclones/AutoBot_uros$ pio run
Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.17.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES: 
 - framework-arduinoteensy @ 1.157.220801 (1.57) 
 - tool-teensy @ 1.157.0 (1.57) 
 - toolchain-gccarmnoneeabi @ 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/usr/bin/python3 -m pip install pyyaml
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (5.4.1)
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/usr/bin/python3 -m pip install markupsafe==2.0.1
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: markupsafe==2.0.1 in /usr/lib/python3/dist-packages (2.0.1)
Configuring teensy41 with transport serial
Downloading micro-ROS dev dependencies
         - Downloaded ament_cmake
         - Downloaded ament_lint
         - Downloaded ament_package
         - Downloaded googletest
         - Downloaded ament_cmake_ros
         - Downloaded ament_index
Building micro-ROS dev dependencies
Downloading micro-ROS library
         - Downloaded microcdr
         - Downloaded microxrcedds_client
         - Downloaded rcl_action
         - Downloaded rcl
         - Downloaded rcl_lifecycle
         - Downloaded rcl_yaml_param_parser (ignored)
         - Downloaded rclc
         - Downloaded rclc_parameter
         - Downloaded rclc_examples (ignored)
         - Downloaded rclc_lifecycle
         - Downloaded micro_ros_utilities
         - Downloaded rcutils
         - Downloaded micro_ros_msgs
         - Downloaded rmw_microxrcedds
         - Downloaded rosidl_typesupport_cpp (ignored)
         - Downloaded rosidl_typesupport_c
         - Downloaded rosidl_typesupport_microxrcedds_cpp (ignored)
         - Downloaded rosidl_typesupport_microxrcedds_test_msg
         - Downloaded rosidl_typesupport_microxrcedds_c_tests
         - Downloaded rosidl_typesupport_microxrcedds_cpp_tests
         - Downloaded rosidl_typesupport_microxrcedds_c
         - Downloaded rosidl_runtime_c
         - Downloaded rosidl_generator_cpp (ignored)
         - Downloaded rosidl_typesupport_introspection_c
         - Downloaded rosidl_typesupport_introspection_tests
         - Downloaded rosidl_typesupport_introspection_cpp (ignored)
         - Downloaded rosidl_parser
         - Downloaded rosidl_cmake
         - Downloaded rosidl_runtime_cpp (ignored)
         - Downloaded rosidl_generator_c
         - Downloaded rosidl_adapter
         - Downloaded rosidl_typesupport_interface
         - Downloaded rosidl_cli
         - Downloaded rmw
         - Downloaded rmw_implementation_cmake
         - Downloaded builtin_interfaces
         - Downloaded rcl_interfaces
         - Downloaded test_msgs
         - Downloaded statistics_msgs
         - Downloaded composition_interfaces
         - Downloaded lifecycle_msgs
         - Downloaded rosgraph_msgs
         - Downloaded action_msgs
         - Downloaded rosidl_default_generators
         - Downloaded rosidl_default_runtime
         - Downloaded unique_identifier_msgs
         - Downloaded visualization_msgs
         - Downloaded stereo_msgs
         - Downloaded actionlib_msgs
         - Downloaded nav_msgs
         - Downloaded diagnostic_msgs
         - Downloaded sensor_msgs_py
         - Downloaded trajectory_msgs
         - Downloaded geometry_msgs
         - Downloaded std_srvs
         - Downloaded std_msgs
         - Downloaded sensor_msgs
         - Downloaded common_interfaces
         - Downloaded shape_msgs
         - Downloaded test_interface_files
         - Downloaded rmw_implementation
         - Downloaded test_rmw_implementation
         - Downloaded rcl_logging_interface
         - Downloaded rcl_logging_noop
         - Downloaded rcl_logging_spdlog (ignored)
         - Downloaded tracetools
         - Downloaded tracetools_test
         - Downloaded test_tracetools_launch
         - Downloaded test_tracetools
         - Downloaded tracetools_launch
         - Downloaded ros2trace
         - Downloaded tracetools_read
         - Downloaded tracetools_trace
         - Extra packages folder not found, skipping...
Building micro-ROS library
AssertionError: :
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/main.py", line 188:
    env.SConscript("$BUILD_SCRIPT")
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/administrator/.platformio/platforms/teensy/builder/main.py", line 162:
    target_elf = env.BuildProgram()
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
    return self.method(*nargs, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piobuild.py", line 61:
    env.ProcessProjectDeps()
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
    return self.method(*nargs, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piobuild.py", line 137:
    plb = env.ConfigureProjectLibBuilder()
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
    return self.method(*nargs, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piolib.py", line 1176:
    project.install_dependencies()
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piolib.py", line 965:
    if _is_builtin(spec):
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piolib.py", line 957:
    for lb in self.env.GetLibBuilders():
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
    return self.method(*nargs, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piolib.py", line 1089:
    lb = LibBuilderFactory.new(env, lib_dir)
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piolib.py", line 60:
    obj = globals()[clsname](env, path, verbose=verbose)
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piolib.py", line 154:
    self.process_extra_options()
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piolib.py", line 302:
    self.env.SConscript(
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/administrator/Documents/gitclones/AutoBot_uros/.pio/libdeps/teensy41/micro_ros_platformio@src-0343cbc825a368aff84aef9d951ed072/extra_script.py", line 64:
    global_env.AddCustomTarget("clean_microros", None, clean_microros_callback, title="Clean Micro-ROS", description="Clean Micro-ROS build environment")
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
    return self.method(*nargs, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piotarget.py", line 87:
    return env.AddTarget(group="Custom", *args, **kwargs)
  File "/home/administrator/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
    return self.method(*nargs, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/platformio/builder/tools/piotarget.py", line 72:
    assert name not in env["__PIO_TARGETS"]`

After upgrading to the latest PIO (v6.0.1), the build of ament packages (ament_lint, ament_cppcheck) seems to fail with an AttributeError ('install_layout')

Issue template

  • Hardware description: Ubuntu 20.04, ESP32
  • RTOS: arduino
  • Installation type: pio lib install; pio run
  • Version or commit hash: main

Steps to reproduce the issue

Step 1: Upgrade system to the latest PIO version:

> pio upgrade

Step 2: Copy the contents of the micro_ros_publisher example.

Step 3: Other tool versions:

  • Espressif: v4.3
  • Python: 3.8.0
  • ROS: galactic

Step 4: With the following platformio.ini (mostly unchanged from the example, except for the addition of platform/board properties):

[env]
monitor_speed = 115200
upload_speed = 921600

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
board_microros_transport = serial
lib_deps =
    https://github.com/micro-ROS/micro_ros_platformio

Run:

> pio run --target clean_microros
> pio lib install
> pio run

Expected behavior

pio run should build the packages successfully.

Actual behavior

Build fails with the following output:

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (4.3.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20003.0 (2.0.3) 
 - tool-esptoolpy @ 1.30300.0 (3.3.0) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Installing pyyaml with pip at PlatformIO environment
/home/safdar/.platformio/penv/bin/python -m pip install pyyaml
Requirement already satisfied: pyyaml in /home/safdar/.platformio/penv/lib/python3.8/site-packages (6.0)
Installing markupsafe==2.0.1 with pip at PlatformIO environment
/home/safdar/.platformio/penv/bin/python -m pip install markupsafe==2.0.1
Requirement already satisfied: markupsafe==2.0.1 in /home/safdar/.platformio/penv/lib/python3.8/site-packages (2.0.1)
Configuring esp32dev with transport wifi
Downloading micro-ROS dev dependencies
         - Downloaded ament_cmake
         - Downloaded ament_lint
         - Downloaded ament_package
         - Downloaded googletest
         - Downloaded ament_cmake_ros
         - Downloaded ament_index
Building micro-ROS dev dependencies
Build dev micro-ROS environment failed: 
 --- stderr: gtest_vendor
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING


---
--- stderr: gmock_vendor
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING


---
--- stderr: ament_lint
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    setup(
  File "/home/safdar/.platformio/penv/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/home/safdar/anaconda3/envs/ros2/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/safdar/anaconda3/envs/ros2/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/safdar/anaconda3/envs/ros2/lib/python3.8/distutils/dist.py", line 984, in run_command
    cmd_obj.ensure_finalized()
  File "/home/safdar/anaconda3/envs/ros2/lib/python3.8/distutils/cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "/home/safdar/.platformio/penv/lib/python3.8/site-packages/setuptools/command/develop.py", line 56, in finalize_options
    easy_install.finalize_options(self)
  File "/home/safdar/.platformio/penv/lib/python3.8/site-packages/setuptools/command/easy_install.py", line 311, in finalize_options
    self.set_undefined_options(
  File "/home/safdar/anaconda3/envs/ros2/lib/python3.8/distutils/cmd.py", line 287, in set_undefined_options
    src_cmd_obj.ensure_finalized()
  File "/home/safdar/anaconda3/envs/ros2/lib/python3.8/distutils/cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "/home/safdar/.platformio/penv/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 17, in finalize_options
    self.set_undefined_options('install',('install_layout','install_layout'))
  File "/home/safdar/anaconda3/envs/ros2/lib/python3.8/distutils/cmd.py", line 290, in set_undefined_options
    setattr(self, dst_option, getattr(src_cmd_obj, src_option))
  File "/home/safdar/anaconda3/envs/ros2/lib/python3.8/distutils/cmd.py", line 103, in __getattr__
    raise AttributeError(attr)
AttributeError: install_layout
---
Failed   <<< ament_lint [1.50s, exited with code 1]

This could also return an error for a different ament package, like ament_cppcheck.

Additional information

As far as I remember, the only change I made since a previous successful compilation is that I upgraded platformio to version 6.0. I can't think of any other system change that I've made, since the last time this successfully compiled.

Could not find ROS middleware implementation

Issue template

  • Hardware description: Ubuntu 20.04, teensy 4.1
  • RTOS: Arduino
  • Installation type: VS-Code + PlatformIO (extension for VS-Code)
  • Version or commit hash: galactic

Steps to reproduce the issue

Step 1: Copy the contents of the micro_ros_publisher example.
Step 2: platform.ini

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino

board_microros_distro = galactic
board_microros_transport = serial
board_microros_user_meta = colcon.meta

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

Step3: pio lib install
Step4: pio run

Expected behavior

Build the packages

Actual behavior

Build fails with the following output:

--- stderr: rmw_implementation
CMake Error at /home/scch1092/example/.pio/libdeps/teensy41/micro_ros_platformio/build/mcu/install/share/rmw_implementation_cmake/cmake/get_default_rmw_implementation.cmake:60 (message):
  Could not find ROS middleware implementation 'rmw_fastrtps_cpp'.  Choose
  one of the following: rmw_microxrcedds
Call Stack (most recent call first):
  CMakeLists.txt:22 (get_default_rmw_implementation)


---
Failed   <<< rmw_implementation [0.44s, exited with code 1]

Additional information

$ env | grep ROS

ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_LOCALHOST_ONLY=0
ROS_DISTRO=galactic
$ env | grep RMW

RMW_IMPLEMENTATION=rmw_fastrtps_cpp
env | grep AMENT_PREFIX_PATH

AMENT_PREFIX_PATH=/home/scch1092/ros2_ws/install/micro_ros_agent:/home/scch1092/ros2_ws/install/micro_ros_msgs:/opt/ros/galactic

Initializing parameter server fails

Issue template

Thank you for supporting platformio! I have problems to use the parameter-feature on galactic and with micro_ros_platformio. Therefore I reproduced the issue with this example.
The command rclc_parameter_server_init_default fails like the resources are not configured well. Did someone stumble across the same problem?

  • Hardware description: Teensy 4.1
  • Version or commit hash: ROS2 Galactic
    • repo: micro_ros_platformio
    • repo: micro_ros_setup:
      • branch: galactic
      • tag: 2.1.0
      • commit: aed3ad405c1a68ad6374ee1247bee68f87d7c65e
      • agent compiled as described in teensy_with_arduino

Steps to reproduce the issue

  1. Install agent
  2. Setup platformio project
src/main.ino

#include <micro_ros_platformio.h>

#include <rcl/rcl.h>
#include <rcl/error_handling.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>
#include <rclc_parameter/rclc_parameter.h>

#include <std_msgs/msg/int32.h>

#include <stdio.h>
#include <unistd.h>



#define RCCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){Log.printf("Failed status on line %d: %d. Aborting.\n",__LINE__,(int)temp_rc); return 1;}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){Log.printf("Failed status on line %d: %d. Continuing.\n",__LINE__,(int)temp_rc);}}


#define Log Serial2

rcl_publisher_t publisher;
rclc_parameter_server_t param_server;
rcl_timer_t timer;
bool publish = true;
std_msgs__msg__Int32 msg;


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

	if (publish)
	{
		RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
		Log.printf("Sent: %d\n", msg.data);

		msg.data++;
	}
}

void on_parameter_changed(Parameter * param)
{
	if (strcmp(param->name.data, "publish_toogle") == 0 && param->value.type == RCLC_PARAMETER_BOOL)
	{
		publish = param->value.bool_value;
		Log.printf("Publish %s\n", (publish) ? "ON" : "OFF");
	}
	else if (strcmp(param->name.data, "publish_rate_ms") == 0 && param->value.type == RCLC_PARAMETER_INT)
	{
		int64_t old;
		RCSOFTCHECK(rcl_timer_exchange_period(&timer, RCL_MS_TO_NS(param->value.integer_value), &old));
		Log.printf("Publish rate %ld ms\n", param->value.integer_value);
	}
}

int main()
{
    Log.begin(9600);

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


	rcl_allocator_t allocator = rcl_get_default_allocator();
	rclc_support_t support;

	// create init_options
	RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

	// create node
	rcl_node_t node;
	RCCHECK(rclc_node_init_default(&node, "micro_ros_node", "", &support));

	// create publisher
	RCCHECK(rclc_publisher_init_default(
		&publisher,
		&node,
		ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32),
		"micro_ros_pub"));

  	// Create parameter service
    RCCHECK(rclc_parameter_server_init_default(&param_server, &node));

	// create timer,
	RCCHECK(rclc_timer_init_default(
		&timer,
		&support,
		RCL_MS_TO_NS(1000),
		timer_callback));

	// create executor
	rclc_executor_t executor = rclc_executor_get_zero_initialized_executor();
	RCCHECK(rclc_executor_init(&executor, &support.context, RCLC_PARAMETER_EXECUTOR_HANDLES_NUMBER + 1, &allocator));
	RCCHECK(rclc_executor_add_parameter_server(&executor, &param_server, on_parameter_changed));
	RCCHECK(rclc_executor_add_timer(&executor, &timer));

	// Add parameters
    RCCHECK(rclc_add_parameter(&param_server, "publish_toogle", RCLC_PARAMETER_BOOL));
    RCCHECK(rclc_add_parameter(&param_server, "publish_rate_ms", RCLC_PARAMETER_INT));

    //rclc_parameter_set_bool(&param_server, "publish_toogle", true);
    //rclc_parameter_set_int(&param_server, "publish_rate_ms", 1000);

	Log.println("before spin");
  	RCCHECK(rclc_executor_spin(&executor));
	Log.println("after spin");

	RCCHECK(rcl_publisher_fini(&publisher, &node));
	RCCHECK(rcl_node_fini(&node));
}

platformio.ini

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
upload_protocol = teensy-cli
board_microros_transport = serial
board_microros_distro = galactic
board_microros_user_meta = project_colcon.meta
lib_deps = https://github.com/micro-ROS/micro_ros_platformio

project_colcon.meta

{
    "names": {
        "rmw_microxrcedds": {
            "cmake-args": [
                "-DRMW_UXRCE_MAX_NODES=1",
                "-DRMW_UXRCE_MAX_PUBLISHERS=20",
                "-DRMW_UXRCE_MAX_SUBSCRIPTIONS=20",
                "-DRMW_UXRCE_MAX_SERVICES=10",
                "-DRMW_UXRCE_MAX_CLIENTS=1",
                "-DRMW_UXRCE_MAX_HISTORY=2",
                "-DRMW_UXRCE_TRANSPORT=custom"
            ]
        }
    }
}

  1. Compile & flash teensy
  2. Setup and Start microros agent

Expected behavior

Executer spins, counter is published and parameters are available by calling ros2 param list.

Actual behavior

Output: Failed status on line 84: 1. Aborting. which is:

// Create parameter service
RCCHECK(rclc_parameter_server_init_default(&param_server, &node));

Esp32 micro ros transport wifi

Issue template

I am trying to connect my esp32 over wifi with the micro ros agent. It runs in a docker container. My machine is a Ubuntu 22.04.

  • Hardware description: esp32-wroom-32 (Az Delivery)
  • RTOS: no Rtos
  • Installation type: platform io
  • Version or commit hash: humble

Steps to reproduce the issue

My code is working with serial transport, i tried also with the example code form adruino and platform io adapted for wifi, nothing woked.

But here my code for the wifi:

IPAddress agent_ip(192, 168, 1, 100);
size_t agent_port = 8888;

char ssid[] = "ssid";
char psk[] = "pswd";
set_microros_wifi_transports(ssid, psk, agent_ip, agent_port);

My platform.ini:

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
board_microros_transport = wifi
monitor_filters = 
   direct
   esp32_exception_decoder
lib_deps = 
   waspinator/AccelStepper@^1.61
   https://github.com/micro-ROS/micro_ros_platformio

Micro ros agent in docker (it runs):
docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:humble udp4 --port 8888 -v6

Expected behavior

working (connecting to agent) :)

Actual behavior

No output on docker. I tried with serial print the program runs and I cloud print all the wifi credentials

Additional information

Esp is in wifi range and i tried some time before with esp idf and it worked also.
Thanks for help and super cool project thanks for making it possible!

RP2040

Issue template

  • Hardware description: RP2040
  • RTOS:
  • Installation type:
  • Version or commit hash: humble

Steps to reproduce the issue

Using https://github.com/Agroecology-Lab/linorobot2_hardware/blob/galactic/firmware/platformio.ini
Follow https://github.com/linorobot/linorobot2_hardware#3-install-platformio

Expected behavior

pio builds firmware

Actual behavior

--- stderr: ament_cmake_core
Traceback (most recent call last):
File "/home/ubuntu/linorobot2_hardware/calibration/.pio/libdeps/pico/micro_ros_platformio/build/dev/src/ament_cmake/ament_cmake_core/cmake/package_templates/templates_2_cmake.py", line 21, in
from ament_package.templates import get_environment_hook_template_path
ModuleNotFoundError: No module named 'ament_package'
CMake Error at ament_cmake_package_templates-extras.cmake:41 (message):

Additional information

https://github.com/micro-ROS/micro_ros_raspberrypi_pico_sdk
https://gist.github.com/Redstone-RM/0ca459c32ec5ead8700284ff56a136f7

rclc implementation problem pub / sub

Issue with the implementation of a publisher and subscriber in same program:
I have both parts working individually. Meaning if I delete everything related to the subscriber, I can run the publisher and if I delete everything related to the publisher, then I can run the subscriber.

This is achieved, following the "Teensy with Arduino" tutorial on micro.ros.org

Ubuntu 22.04.1 with ROS2 Humble install (desktop)
Visual Studio Code Version: 1.71.2
PlatformIO Core 6.1.4·Home 3.4.3
Platform Teensy 4.1 and micro_ROS

In the program below is an attempt to get both a subscriber and publisher working in the same program.
Expected behavior:
publish a number counting up continuously

Actual behavior:
After loading the program into the teensy, it immediately goes into the error routine and flashes the LED.

I'm not sure what I am missing.

#include <Arduino.h>
#include <Wire.h>
#include <micro_ros_platformio.h>

#include <rcl/rcl.h>
#include <rclc/rclc.h>
#include <rclc/executor.h>

#include <std_msgs/msg/int32.h>

#if !defined(MICRO_ROS_TRANSPORT_ARDUINO_SERIAL)
#error This example is only avaliable for Arduino framework with serial transport.
#endif

// debug
#ifndef DebugMonitor
#define DebugMonitor Serial6
#endif

#define debug(x) DebugMonitor.print(x)
#define debugln(x) DebugMonitor.println(x)

rcl_publisher_t publisher;
rcl_subscription_t subscriber;
std_msgs__msg__Int32 msg;

// publisher and subscriber common
rclc_support_t support;
rcl_allocator_t allocator;

//publisher
rclc_executor_t executor_pub;
rcl_node_t pub_node;

// subscriber
rclc_executor_t executor_sub;
rcl_node_t sub_node;

rcl_timer_t timer;

#define LED_PIN 13

#define RCCHECK(fn){rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){debugln("error: ");debugln(temp_rc);debugln(RCL_RET_OK);error_loop();}}
#define RCSOFTCHECK(fn) { rcl_ret_t temp_rc = fn; if((temp_rc != RCL_RET_OK)){}}



// Error handle loop
void error_loop() {
  while(1) {
    digitalWrite(LED_PIN, !digitalRead(LED_PIN));
    delay(100);
  }
}

void timer_callback(rcl_timer_t * timer, int64_t last_call_time) {
  RCLC_UNUSED(last_call_time);
  if (timer != NULL) {
    RCSOFTCHECK(rcl_publish(&publisher, &msg, NULL));
    msg.data++;
  }
}

void subscription_callback(const void * msgin)
{  
  const std_msgs__msg__Int32 * msg = (const std_msgs__msg__Int32 *)msgin;
  digitalWrite(LED_PIN, (msg->data == 0) ? LOW : HIGH);  
}

void setup() {
  // Configure serial transport
  Serial.begin(115200);
  set_microros_serial_transports(Serial);

  // Debug
  DebugMonitor.begin(115200);

  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, HIGH); 

  delay(2000);

  allocator = rcl_get_default_allocator();

  //create init_options
  RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));

  // create node
  RCCHECK(rclc_node_init_default(&pub_node, "uros_platformio_pub_node", "", &support));
  RCCHECK(rclc_node_init_default(&sub_node, "uros_platformio_sub_node", "", &support));

  // create publisher
  RCCHECK(rclc_publisher_init_default(
    &publisher,
    &pub_node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32),
    "micro_ros_platformio_node_publisher"));
  
  // create subscriber
  RCCHECK(rclc_subscription_init_default(
    &subscriber,
    &sub_node,
    ROSIDL_GET_MSG_TYPE_SUPPORT(std_msgs, msg, Int32),
    "micro_ros_arduino_subscriber"));

  // create timer,
  const unsigned int timer_timeout = 1000;
  RCCHECK(rclc_timer_init_default(
    &timer,
    &support,
    RCL_MS_TO_NS(timer_timeout),
    timer_callback));

  // create executor_pub
  RCCHECK(rclc_executor_init(&executor_pub, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_timer(&executor_pub, &timer));

  // create executor_sub
  RCCHECK(rclc_executor_init(&executor_sub, &support.context, 1, &allocator));
  RCCHECK(rclc_executor_add_subscription(&executor_sub, &subscriber, &msg, &subscription_callback, ON_NEW_DATA)); 
  

  msg.data = 0;
}

void loop() {
  delay(100);
  RCSOFTCHECK(rclc_executor_spin_some(&executor_pub, RCL_MS_TO_NS(100)));
  RCSOFTCHECK(rclc_executor_spin_some(&executor_sub, RCL_MS_TO_NS(100)));
  debugln("Scan");
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.