Linaro / step

Secure data pipeline proof of concept module for Zephyr RTOS
Apache License 2.0
11 stars 4 forks source link

samples: ros2: add step to ros2 #22

Closed uLipe closed 2 years ago

uLipe commented 2 years ago

sample streaming sensor data.

Signed-off-by: Felipe felipe.neves@linaro.org

uLipe commented 2 years ago

Just waiting microros module to be updated, with latest addtions from ROS2 to resume this one.

uLipe commented 2 years ago

The build is now unbroken, I just need to push the orientation values through the ros2 topic

uLipe commented 2 years ago

@microbuilder PTAL

uLipe commented 2 years ago

The header namespace issue affects also the ros client library which was patched to be compatible to zephyr, so I'm pointing this PR back to WIP until this change reaches to the microROS module.

uLipe commented 2 years ago

@microbuilder PTAL

CI for this sample it is broken yet, it depends on some work on micro ROS module.

microbuilder commented 2 years ago

I was only able to test this ssh'ing into a Linux box. ROS2 doesn't seem to be compatible out of the box with MacOS and the python3 version it ships with (126 Monterey here on an M1).

Can you perhaps add a note saying that this has only been test on Linux (Ubuntu 22 in my case), and potentially Windows if you have a copy and have tested on that? And that it may have issues with MacOS?

This sample has been tested on the following distros:

- Ubuntu 22.04
- Other???

It may work on other operating systems and distros, but ROS2 appears
to have problems with MacOS (Monterey, etc.) and the system version
of Python3. Further testing is required on these operating systems.
uLipe commented 2 years ago

Added DNM until new publish API gets merged

uLipe commented 2 years ago

@microbuilder you would test this again? Thanks

microbuilder commented 2 years ago
$ git fetch linaro     # My remote name here is linaro due to west.yaml
$ git gpr linaro 22    # Local alias to checkout PR 22 from linaro
$ git submodule update --init --recursive 
$ pip3 install catkin_pkg lark-parser empy colcon-common-extensions
$ west build -p always -b b_u585i_iot02a samples/ros2_to_step_bridge

Still fails with:

---
Finished <<< ament_cpplint [2.60s]
Starting >>> ament_lint_auto
Starting >>> ament_cmake_pytest
Starting >>> ament_cmake_google_benchmark
Starting >>> ament_cmake_nose
--- stderr: ament_cmake_gtest
Error in sitecustomize; set PYTHONVERBOSE for traceback:
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
  File "/Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/micro_ros_dev/install/ament_cmake_core/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py", line 17, in <module>
    import argparse
  File "/opt/homebrew/lib/python3.10/site-packages/argparse.py", line 93, in <module>
    import re as _re
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
CMake Error at /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/micro_ros_dev/install/ament_cmake_core/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):

  execute_process(/opt/homebrew/Frameworks/Python.framework/Versions/3.10/bin/python3.10
  /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/micro_ros_dev/install/ament_cmake_core/share/ament_cmake_core/cmake/package_templates/templates_2_cmake.py
  /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/micro_ros_dev/build/ament_cmake_gtest/ament_cmake_package_templates/templates.cmake)
  returned error code 1
Call Stack (most recent call first):
  /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/micro_ros_dev/install/ament_cmake_core/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:41 (include)
  CMakeLists.txt:5 (find_package)

---
Failed   <<< ament_cmake_gtest [0.52s, exited with code 1]
Aborted  <<< ament_pclint [1.55s]
Aborted  <<< domain_coordinator [1.54s]
Aborted  <<< ament_index_python [1.29s]
Aborted  <<< ament_cmake_lint_cmake [0.52s]
Aborted  <<< ament_lint_auto [0.47s]
Aborted  <<< ament_cmake_pytest [0.46s]
Aborted  <<< ament_clang_tidy [1.72s]
Aborted  <<< ament_cmake_google_benchmark [0.47s]
Aborted  <<< ament_cmake_nose [0.46s]
microbuilder commented 2 years ago
$ git fetch linaro     # My remote name here is linaro due to west.yaml
$ git gpr linaro 22    # Local alias to checkout PR 22 from linaro
$ git submodule update --init --recursive 
$ pip3 install catkin_pkg lark-parser empy colcon-common-extensions
$ west build -p always -b b_u585i_iot02a samples/ros2_to_step_bridge

I also tried recloning the submodules with the below:

$ git submodule sync
$ git submodule deinit -f .
$ git submodule update --init --recursive

... but same failure/error/

Then this, which pulls some changes in:

$ git submodule update --remote --merge
Updating 1a5f55e..2cfb902
Fast-forward
 modules/libmicroros/libmicroros.mk                                       |  3 ++-
 modules/libmicroros/microros_transports/serial-usb/microros_transports.c |  6 +++---
 modules/libmicroros/microros_transports/serial/microros_transports.c     |  4 ++--
 modules/libmicroros/microros_transports/udp/microros_transports.c        | 11 +++++++----
 modules/libmicroros/zephyr_toolchain.cmake.in                            |  4 ++--
 src/main.c                                                               |  4 ++--
 6 files changed, 18 insertions(+), 14 deletions(-)
Submodule path 'samples/ros2_to_step_bridge/micro_ros_zephyr_module': merged in '2cfb9028967ef575c50d596e5e5ba5e0d5a80886'

And different error, but same warning about AttributeError: module 'enum' has no attribute 'IntFlag':

. /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/utils.sh; \
        cp /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/colcon.meta /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/configured_colcon.meta; \
        ZEPHYR_CONF_FILE=/Users/kevintownsend/Linaro/zephyr/modules/lib/step/build/zephyr/.config; \
        update_meta_from_zephyr_config "CONFIG_MICROROS_NODES" "rmw_microxrcedds" "RMW_UXRCE_MAX_NODES"; \
        update_meta_from_zephyr_config "CONFIG_MICROROS_PUBLISHERS" "rmw_microxrcedds" "RMW_UXRCE_MAX_PUBLISHERS"; \
        update_meta_from_zephyr_config "CONFIG_MICROROS_SUBSCRIBERS" "rmw_microxrcedds" "RMW_UXRCE_MAX_SUBSCRIPTIONS"; \
        update_meta_from_zephyr_config "CONFIG_MICROROS_CLIENTS" "rmw_microxrcedds" "RMW_UXRCE_MAX_CLIENTS"; \
        update_meta_from_zephyr_config "CONFIG_MICROROS_SERVERS" "rmw_microxrcedds" "RMW_UXRCE_MAX_SERVICES"; \
        update_meta_from_zephyr_config "CONFIG_MICROROS_RMW_HISTORIC" "rmw_microxrcedds" "RMW_UXRCE_MAX_HISTORY"; \
        update_meta_from_zephyr_config "CONFIG_MICROROS_XRCE_DDS_HISTORIC" "rmw_microxrcedds" "RMW_UXRCE_STREAM_HISTORY"; \
        update_meta_from_zephyr_config "CONFIG_MICROROS_XRCE_DDS_MTU" "microxrcedds_client" "UCLIENT_CUSTOM_TRANSPORT_MTU"; \
        update_meta "microxrcedds_client" "UCLIENT_PROFILE_SERIAL=OFF"; \
        update_meta "microxrcedds_client" "UCLIENT_PROFILE_UDP=OFF"; \
        update_meta "microxrcedds_client" "UCLIENT_PROFILE_TCP=OFF"; \
        update_meta "microxrcedds_client" "UCLIENT_PROFILE_CUSTOM_TRANSPORT=ON"; \
        update_meta "microxrcedds_client" "UCLIENT_PROFILE_STREAM_FRAMING=ON"; \
        update_meta "rmw_microxrcedds" "RMW_UXRCE_TRANSPORT=custom";
rm -f /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/zephyr_toolchain.cmake; \
        cat /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/zephyr_toolchain.cmake.in | \
                sed "s/@CMAKE_C_COMPILER@/\/Users\/kevintownsend\/zephyr-sdk-0.15.0\/arm-zephyr-eabi\/bin\/arm-zephyr-eabi-gcc/g" | \
                sed "s/@CMAKE_CXX_COMPILER@/\/Users\/kevintownsend\/zephyr-sdk-0.15.0\/arm-zephyr-eabi\/bin\/arm-zephyr-eabi-g++/g" | \
                sed "s/@CMAKE_SYSROOT@/\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/samples\/ros2_to_step_bridge\/micro_ros_zephyr_module\/modules\/libmicroros/g" | \
                sed "s/@CFLAGS@/-c -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/include\/posix -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/build\/zephyr\/include\/generated -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/build\/zephyr\/include\/generated -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/soc\/arm\/st_stm32\/stm32u5 -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/lib\/libc\/newlib\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/lib\/util\/fnmatch\/. -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/drivers -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/soc\/arm\/st_stm32\/common -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/subsys\/usb\/device -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/cmsis\/CMSIS\/Core\/Include -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/modules\/hal_nxp\/usb\/. -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/modules\/hal_nxp\/. -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/st\/sensor\/stmemsc\/hts221_STdC\/driver\/ -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/st\/sensor\/stmemsc\/iis2mdc_STdC\/driver\/ -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/st\/sensor\/stmemsc\/ism330dhcx_STdC\/driver\/ -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/stm32\/stm32cube\/stm32u5xx\/soc -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/stm32\/stm32cube\/stm32u5xx\/drivers\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/stm32\/stm32cube\/stm32u5xx\/drivers\/include\/Legacy -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/stm32\/stm32cube\/common_ll\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/zscilib\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/include -DKERNEL -D__ZEPHYR__=1 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -DSTM32U585xx -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DHSE_VALUE=8000000 -fno-strict-aliasing -Os -imacros \/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/build\/zephyr\/include\/generated\/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=\/Users\/kevintownsend\/zephyr-sdk-0.15.0\/arm-zephyr-eabi\/arm-zephyr-eabi -imacros \/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/include\/zephyr\/toolchain\/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wformat -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/samples\/ros2_to_step_bridge=CMAKE_SOURCE_DIR -fmacro-prefix-map=\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr=ZEPHYR_BASE -fmacro-prefix-map=\/Users\/kevintownsend\/Linaro\/zephyr=WEST_TOPDIR -ffunction-sections -fdata-sections /g" | \
                sed "s/@CXXFLAGS@/-c -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/include\/posix -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/build\/zephyr\/include\/generated -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/build\/zephyr\/include\/generated -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/soc\/arm\/st_stm32\/stm32u5 -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/lib\/libc\/newlib\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/lib\/util\/fnmatch\/. -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/drivers -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/soc\/arm\/st_stm32\/common -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/subsys\/usb\/device -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/cmsis\/CMSIS\/Core\/Include -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/modules\/hal_nxp\/usb\/. -I\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/modules\/hal_nxp\/. -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/st\/sensor\/stmemsc\/hts221_STdC\/driver\/ -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/st\/sensor\/stmemsc\/iis2mdc_STdC\/driver\/ -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/st\/sensor\/stmemsc\/ism330dhcx_STdC\/driver\/ -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/stm32\/stm32cube\/stm32u5xx\/soc -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/stm32\/stm32cube\/stm32u5xx\/drivers\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/stm32\/stm32cube\/stm32u5xx\/drivers\/include\/Legacy -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/hal\/stm32\/stm32cube\/common_ll\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/zscilib\/include -I\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/include -DKERNEL -D__ZEPHYR__=1 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -DSTM32U585xx -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DHSE_VALUE=8000000 -fno-strict-aliasing -Os -fcheck-new -fno-exceptions -fno-rtti -imacros \/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/build\/zephyr\/include\/generated\/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=\/Users\/kevintownsend\/zephyr-sdk-0.15.0\/arm-zephyr-eabi\/arm-zephyr-eabi -imacros \/Users\/kevintownsend\/Linaro\/zephyr\/zephyr\/include\/zephyr\/toolchain\/zephyr_stdint.h -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=\/Users\/kevintownsend\/Linaro\/zephyr\/modules\/lib\/step\/samples\/ros2_to_step_bridge=CMAKE_SOURCE_DIR -fmacro-prefix-map=\/Users\/kevintownsend\/Linaro\/zephyr\/zephyr=ZEPHYR_BASE -fmacro-prefix-map=\/Users\/kevintownsend\/Linaro\/zephyr=WEST_TOPDIR -ffunction-sections -fdata-sections /g" \
                > /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/zephyr_toolchain.cmake
cd /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/micro_ros_src; \
        . ../micro_ros_dev/install/local_setup.sh; \
        colcon build \
                --merge-install \
                --packages-ignore-regex=.*_cpp \
                --metas /Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/configured_colcon.meta \
                --cmake-args \
                "--no-warn-unused-cli" \
                -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=OFF \
                -DTHIRDPARTY=ON \
                -DBUILD_SHARED_LIBS=OFF \
                -DBUILD_TESTING=OFF \
                -DCMAKE_BUILD_TYPE=Release \
                -DCMAKE_TOOLCHAIN_FILE=/Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/zephyr_toolchain.cmake \
                -DCMAKE_VERBOSE_MAKEFILE=OFF; \

Error in sitecustomize; set PYTHONVERBOSE for traceback:
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
  File "/opt/homebrew/bin/colcon", line 3, in <module>
    import re
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
make: *** [/Users/kevintownsend/Linaro/zephyr/modules/lib/step/samples/ros2_to_step_bridge/micro_ros_zephyr_module/modules/libmicroros/micro_ros_src/install] Error 1
[86/272] Building C object zephyr/arch/arch/arm/...keFiles/arch__arm__core__aarch32.dir/fatal.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake --build /Users/kevintownsend/Linaro/zephyr/modules/lib/step/build
uLipe commented 2 years ago

I see you are building for macOS I forgot to mention in the readme that ros2 are coupled to a particular ubuntu / debian LTS and humble is coupled to 22.04

Would you able to try this in Ubuntu environnement?

I'll update the readme with this information.

microbuilder commented 2 years ago

I see you are building for macOS I forgot to mention in the readme that ros2 are coupled to a particular ubuntu / debian LTS and humble is coupled to 22.04

Would you able to try this in Ubuntu environnement?

I'll update the readme with this information.

NP, I have an Ubuntu 22.04 VM I use as well, I'll test on that.

uLipe commented 2 years ago

It seems the problem is related to build this on the ARM based laptops, Will add this restriction on the README.

uLipe commented 2 years ago

@microbuilder PTAL now we have CI to help us to attest build of this sample.

uLipe commented 2 years ago

@microbuilder just waiting for the CI to merge it.