ros2 / rcl_interfaces

A repository for messages and services used by the ROS client libraries
Apache License 2.0
40 stars 43 forks source link

Runtime Interface Reflection: type_description_interfaces_utils #155

Closed methylDragon closed 1 year ago

methylDragon commented 1 year ago

This PR is part of the runtime interface reflection subscription feature of REP-2011: https://github.com/ros2/ros2/issues/1374

Description

This PR adds a utilities library for manipulating and constructing the C structs generated by type_description_interfaces, including:

I also pre-generate the type_description_interfaces sources and headers to create a new package (type_description_interfaces_static) to remove a dependency cycle downstream. (That's why there are so many lines.)

I haven't implemented tests yet, so some memory management issues/segfaults are expected. I'm working on it, but I am wary of spending too much time getting 100% coverage because we're trying to meet the deadline for feature freeze...

I've implemented a bunch of tests and I'm fairly confident that most of the core functionalities work as expected now, so I'm going to mark the PR as ready to review.

Asan runs green too!

clear && \
colcon build --packages-select type_description_interfaces_utils \
  --build-base=build-asan --install-base=install-asan \
  --cmake-args -DOSRF_TESTING_TOOLS_CPP_DISABLE_MEMORY_TOOLS=ON \
               -DINSTALL_EXAMPLES=OFF -DSECURITY=ON --no-warn-unused-cli \
               -DCMAKE_BUILD_TYPE=Debug \
  --mixin asan-gcc && \
colcon test --build-base=build-asan --install-base=install-asan \
  --event-handlers sanitizer_report+ --packages-select type_description_interfaces_utils

There are some less important tests waiting to be written (printing), and some tests that are already implicitly covered by other tests (but are not explicit yet.)

TODO

Open Questions

methylDragon commented 1 year ago

Closing this in favor of https://github.com/ros2/rosidl/pull/728