Skip to content

Conversation

@InvincibleRMC
Copy link
Contributor

No description provided.

Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
Signed-off-by: Michael Carlstrom <[email protected]>
@sloretz
Copy link
Contributor

sloretz commented Dec 6, 2024

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Dec 6, 2024

update

✅ Branch has been successfully updated

@sloretz
Copy link
Contributor

sloretz commented Dec 6, 2024

Pulls: #840
Gist: https://gist.githubusercontent.com/sloretz/bf62523da89b9771d5003277d97ee692/raw/c529bf3fe304c49d309abcaf327f7ea50f1637e8/ros2.repos
BUILD args: --packages-above-and-dependencies rosidl_generator_tests rosidl_generator_type_description
TEST args: --packages-above rosidl_generator_tests rosidl_generator_type_description
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14912

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@InvincibleRMC
Copy link
Contributor Author

@sloretz can the CI be re-run since the windows bug has been fixed?

@sloretz
Copy link
Contributor

sloretz commented Dec 10, 2024

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Dec 10, 2024

update

☑️ Nothing to do

  • #commits-behind > 0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]
  • queue-position = -1 [📌 update requirement]

@sloretz
Copy link
Contributor

sloretz commented Dec 13, 2024

Pulls: #840
Gist: https://gist.githubusercontent.com/sloretz/05aa8bfba79337af4b85c39a4e1b0e78/raw/c529bf3fe304c49d309abcaf327f7ea50f1637e8/ros2.repos
BUILD args: --packages-above-and-dependencies rosidl_generator_tests rosidl_generator_type_description
TEST args: --packages-above rosidl_generator_tests rosidl_generator_type_description
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14957

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

Signed-off-by: Michael Carlstrom <[email protected]>
@sloretz
Copy link
Contributor

sloretz commented Dec 14, 2024

Pulls: #840
Gist: https://gist.githubusercontent.com/sloretz/13781260df9fccdc88ea2c6d6203814d/raw/c529bf3fe304c49d309abcaf327f7ea50f1637e8/ros2.repos
BUILD args: --packages-above-and-dependencies rosidl_generator_tests rosidl_generator_type_description
TEST args: --packages-above rosidl_generator_tests rosidl_generator_type_description
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14958

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status Edit: Infra issue, rerun: Build Status

@InvincibleRMC
Copy link
Contributor Author

@sloretz is this good to merge in?

if isinstance(value_type, definition.BasicType):
value_type_name = FIELD_VALUE_TYPE_NAMES[value_type.typename]
elif isinstance(value_type, definition.AbstractGenericString):
elif isinstance(value_type, FIELD_VALUE_STRING_TYPES):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will point out that this is not quite the same thing as what it is replacing. In particular, while FIELD_VALUE_STRING_TYPES covers all of the currently defined AbstractGenericString types, it does not account for any types that might be derived in the future, or in user code. While I think those are unlikely, they are not impossible.

Can you explain a bit more why you did this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this value is used to index into FIELD_VALUE_TYPE_NAMES. It has the more specific sub classes. If you wanted to add future string types you would need to update FIELD_VALUE_STRING_TYPES as well as FIELD_VALUE_TYPE_NAMES.

FIELD_VALUE_TYPE_NAMES: Final = {
    None: 'FIELD_TYPE_NOT_SET',
    'nested_type': 'FIELD_TYPE_NESTED_TYPE',
    'int8': 'FIELD_TYPE_INT8',
    'uint8': 'FIELD_TYPE_UINT8',
    'int16': 'FIELD_TYPE_INT16',
    'uint16': 'FIELD_TYPE_UINT16',
    'int32': 'FIELD_TYPE_INT32',
    'uint32': 'FIELD_TYPE_UINT32',
    'int64': 'FIELD_TYPE_INT64',
    'uint64': 'FIELD_TYPE_UINT64',
    'float': 'FIELD_TYPE_FLOAT',
    'double': 'FIELD_TYPE_DOUBLE',
    'long': 'LONG_DOUBLE',
    'char': 'FIELD_TYPE_CHAR',
    'wchar': 'FIELD_TYPE_WCHAR',
    'boolean': 'FIELD_TYPE_BOOLEAN',
    'octet': 'FIELD_TYPE_BYTE',
    definition.UnboundedString: 'FIELD_TYPE_STRING',
    definition.UnboundedWString: 'FIELD_TYPE_WSTRING',
    # NOTE: rosidl_parser does not define fixed string types
    definition.BoundedString: 'FIELD_TYPE_BOUNDED_STRING',
    definition.BoundedWString: 'FIELD_TYPE_BOUNDED_WSTRING',
}

Comment on lines +470 to +472
annotation_value = member.get_annotation_value('default')
if isinstance(annotation_value, dict):
default_value = str(annotation_value['value'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again this isn't quite the same thing as what it is replacing. Down below, if member.has_annotation('default') is true, we'll always get the value and then try to convert to string. Here we only do it in certain circumstances, which are valid, but may not be all of the circumstances. Can you explain a bit more about this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

member.get_annotation_value('default') can return Union[str, int, float, bool, Dict[str, Union[str, int, float, bool]], None]. The only type that can be indexed into with ['value'] is the dictionary. So I added the isinstance(annotation_value, dict) check.

Signed-off-by: Michael Carlstrom <[email protected]>
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