rosidl icon indicating copy to clipboard operation
rosidl copied to clipboard

Feature Request: Optional Attributes

Open Ryanf55 opened this issue 10 months ago • 11 comments

DDS supports the optional attribute in IDL 4.2 specification attribute section 8.3.1.3. In C++, now that we have C++17, we can use std::optional.

A prior dicussion is here: https://discourse.ros.org/t/optional-fields-in-message/991/16

Consider adding a @optional specifier to rosidl that translates to the DDS optional .

Amend the ROS 2 design documentation for Standardized Annotations to add optional: https://design.ros2.org/articles/idl_interface_definition.html

It's supported by:

Workarounds: Bounded array with a max length of 1, but the syntax is funky.

Ryanf55 avatar Feb 25 '25 17:02 Ryanf55