You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we discussed this during the ROS waffle meeting and while we agree that this would be a useful feature, we also recognize that it will require a relatively large amount of work.
It would be great to get some support from the community.
Thanks. If I end up getting time allocated at work, I'll request being assigned, but otherwise anyone is welcome.
Would you accept a merge with opt-in support of @optional if I got it working only with the following:
FastDDS
rosidl_generator_cpp
We want this feature to integrate with a non-ROS-based software. The only incompatibility is the use of optional.
Getting this working on all RMW's and all languages is unlikely to be approved, but I could get a subset of the work approved.
Hey, I'm interested in taking a stab at adding optional support at least in rosidl_generator_cpp. One design question I have is should I add another class for Optional into rosidl_parser.defintion or simply check whether the member has the optional annotation and update places that use msg_type_to_cpp to something like member_to_cpp. Another is would the default for std::optional<int> be 0 or std::nullopt.
Hey, I'm interested in taking a stab at adding optional support at least in rosidl_generator_cpp. One design question I have is should I add another class for Optional into rosidl_parser.defintion or simply check whether the member has the optional annotation and update places that use msg_type_to_cpp to something like member_to_cpp. Another is would the default for std::optional<int> be 0 or std::nullopt.
Nice!
According to RTI, by default, optional members should be unset, so not default initialized. So, std::nullopt.
When updating the actual .msg, .srv, or .action files to support optional fields, would you prefer introducing a new optional keyword before the type, using a question mark after the type (e.g., char? for an optional char), or some other approach?
I think we should do @optional in ROSIDL (.msg/.srv/.action) like OMG IDL does. OMG IDL has other @annotations (e.g., @key, @default, @verbatim) which ROSIDL could potentially also support, so @optional would be more IDL-y.
I think we should do @optional in ROSIDL (.msg/.srv/.action) like OMG IDL does. OMG IDL has other @annotations (e.g., @key, @default, @verbatim) which ROSIDL could potentially also support, so @optional would be more IDL-y.
@christophebedard is there some generic rmw agnostic test set I can use for testing? Trying to determine if my serialization code actually works or is a lie.
Activity
alsora commentedon Mar 6, 2025
Hi, we discussed this during the ROS waffle meeting and while we agree that this would be a useful feature, we also recognize that it will require a relatively large amount of work.
It would be great to get some support from the community.
Ryanf55 commentedon Mar 7, 2025
Thanks. If I end up getting time allocated at work, I'll request being assigned, but otherwise anyone is welcome.
Would you accept a merge with opt-in support of
@optionalif I got it working only with the following:We want this feature to integrate with a non-ROS-based software. The only incompatibility is the use of optional.
Getting this working on all RMW's and all languages is unlikely to be approved, but I could get a subset of the work approved.
ros-discourse commentedon Mar 25, 2025
This issue has been mentioned on ROS Discourse. There might be relevant details there:
https://discourse.ros.org/t/challenges-with-ros2-on-commercial-robots/42784/8
InvincibleRMC commentedon Jul 29, 2025
Hey, I'm interested in taking a stab at adding optional support at least in
rosidl_generator_cpp. One design question I have is should I add another class forOptionalintorosidl_parser.defintionor simply check whether the member has the optional annotation and update places that usemsg_type_to_cppto something likemember_to_cpp. Another is would the default forstd::optional<int>be0orstd::nullopt.Ryanf55 commentedon Jul 29, 2025
Nice!
According to RTI, by default, optional members should be unset, so not default initialized. So,
std::nullopt.https://community.rti.com/static/documentation/connext-dds/current/doc/manuals/connext_dds_professional/extensible_types_guide/extensible_types/Optional_Members.htm
By default optional members are unset (dds::core::optional<T>::has_value() is false).InvincibleRMC commentedon Aug 1, 2025
When updating the actual
.msg,.srv, or.actionfiles to support optional fields, would you prefer introducing a newoptionalkeyword before the type, using a question mark after the type (e.g.,char?for an optionalchar), or some other approach?christophebedard commentedon Aug 1, 2025
I think we should do
@optionalin ROSIDL (.msg/.srv/.action) like OMG IDL does. OMG IDL has other@annotations(e.g.,@key,@default,@verbatim) which ROSIDL could potentially also support, so@optionalwould be more IDL-y.Ryanf55 commentedon Aug 1, 2025
Agree
InvincibleRMC commentedon Aug 1, 2025
@christophebedard is there some generic rmw agnostic test set I can use for testing? Trying to determine if my serialization code actually works or is a lie.
christophebedard commentedon Aug 1, 2025
Something like the tests from the packages in this repo? https://github.com/ros2/system_tests
MiguelCompany commentedon Oct 31, 2025
@InvincibleRMC There is also https://github.com/ros2/rmw_implementation/tree/rolling/test_rmw_implementation