Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build time generation of fixed-size strings #758

Draft
wants to merge 13 commits into
base: rolling
Choose a base branch
from

Conversation

MiguelCompany
Copy link
Contributor

This is part of a PoC towards achieving the goals of ros2/rclcpp#2201

  • On rosidl_runtime_cpp, a new class has been added that behaves as a bounded string but can be considered POD by the underlying middleware.
  • On rosidl_generator_cpp, processing of a new cdr_plain annotation has been introduced, so string members with that annotation will be generated using the new class.
  • On rosidl_adapter, strings can be annotated with this new annotation depending on the contents of a YAML file specified in the environment variable ROS2_TYPE_FIXED_SIZE_FILE.

@narol1024
Copy link

I migrated to the Humble version, but I encountered this error. I’m not sure if it’s an issue with my environment.

In file included from /root/ros_ws/build_arm/build/xbrain_shm_msgs/rosidl_typesupport_fastrtps_cpp/xbrain_shm_msgs/msg/detail/fixed_strings__rosidl_typesupport_fastrtps_cpp.hpp:25,
                 from /root/ros_ws/build_arm/build/xbrain_shm_msgs/rosidl_typesupport_fastrtps_cpp/xbrain_shm_msgs/msg/detail/dds_fastrtps/fixed_strings__type_support.cpp:4:
/cross_compile/arm/opt/ros/humble/include/fastcdr/fastcdr/Cdr.h: In instantiation of ‘eprosima::fastcdr::Cdr& eprosima::fastcdr::Cdr::serializeArray(const _T*, size_t) [with _T = rosidl_runtime_cpp::CDRCompatibleFixedCapacityString<16>; size_t = long unsigned int]’:
/cross_compile/arm/opt/ros/humble/include/fastcdr/fastcdr/Cdr.h:1257:30:   required from ‘eprosima::fastcdr::Cdr& eprosima::fastcdr::Cdr::serialize(const std::array<_Tp, _Nm>&) [with _T = rosidl_runtime_cpp::CDRCompatibleFixedCapacityString<16>; long unsigned int _Size = 10]’
/cross_compile/arm/opt/ros/humble/include/fastcdr/fastcdr/Cdr.h:502:36:   required from ‘eprosima::fastcdr::Cdr& eprosima::fastcdr::Cdr::operator<<(const std::array<_Tp, _Nm>&) [with _T = rosidl_runtime_cpp::CDRCompatibleFixedCapacityString<16>; long unsigned int _Size = 10]’
/root/ros_ws/build_arm/build/xbrain_shm_msgs/rosidl_typesupport_fastrtps_cpp/xbrain_shm_msgs/msg/detail/dds_fastrtps/fixed_strings__type_support.cpp:38:24:   required from here
/cross_compile/arm/opt/ros/humble/include/fastcdr/fastcdr/Cdr.h:1932:27: error: ‘const class rosidl_runtime_cpp::CDRCompatibleFixedCapacityString<16>’ has no member named ‘serialize’
 1932 |             type_t[count].serialize(*this);
      |             ~~~~~~~~~~~~~~^~~~~~~~~
/cross_compile/arm/opt/ros/humble/include/fastcdr/fastcdr/Cdr.h: In instantiation of ‘eprosima::fastcdr::Cdr& eprosima::fastcdr::Cdr::deserializeArray(_T*, size_t) [with _T = rosidl_runtime_cpp::CDRCompatibleFixedCapacityString<16>; size_t = long unsigned int]’:
/cross_compile/arm/opt/ros/humble/include/fastcdr/fastcdr/Cdr.h:2528:32:   required from ‘eprosima::fastcdr::Cdr& eprosima::fastcdr::Cdr::deserialize(std::array<_Tp, _Nm>&) [with _T = rosidl_runtime_cpp::CDRCompatibleFixedCapacityString<16>; long unsigned int _Size = 10]’
/cross_compile/arm/opt/ros/humble/include/fastcdr/fastcdr/Cdr.h:767:38:   required from ‘eprosima::fastcdr::Cdr& eprosima::fastcdr::Cdr::operator>>(std::array<_Tp, _Nm>&) [with _T = rosidl_runtime_cpp::CDRCompatibleFixedCapacityString<16>; long unsigned int _Size = 10]’
/root/ros_ws/build_arm/build/xbrain_shm_msgs/rosidl_typesupport_fastrtps_cpp/xbrain_shm_msgs/msg/detail/dds_fastrtps/fixed_strings__type_support.cpp:51:24:   required from here
/cross_compile/arm/opt/ros/humble/include/fastcdr/fastcdr/Cdr.h:3219:27: error: ‘class rosidl_runtime_cpp::CDRCompatibleFixedCapacityString<16>’ has no member named ‘deserialize’
 3219 |             type_t[count].deserialize(*this);
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~
gmake[2]: *** [CMakeFiles/xbrain_shm_msgs__rosidl_typesupport_fastrtps_cpp.dir/build.make:93: CMakeFiles/xbrain_shm_msgs__rosidl_typesupport_fastrtps_cpp.dir/rosidl_typesupport_fastrtps_cpp/xbrain_shm_msgs/msg/detail/dds_fastrtps/fixed_strings__type_support.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:291: CMakeFiles/xbrain_shm_msgs__rosidl_typesupport_fastrtps_cpp.dir/all] Error 2

@MiguelCompany
Copy link
Contributor Author

@narol1024 Bear in mind that this is a draft PR over rolling, so it might depend on changes in Fast CDR that are not present in Humble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants