Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

ROS2: Normalize byte as uint8 instead of int8 #49

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

achim-k
Copy link
Contributor

@achim-k achim-k commented Apr 23, 2024

Changelog

Description

In ROS2, byte fields should be treated as uint8 types:

Type name C++ Python DDS type
byte uint8_t builtins.bytes* octet

Prior to this change we were treating byte fields as int8 which causes errors when parsing a byte field with a default value (e.g. 255) which is out of the range of a int8.

@achim-k achim-k requested review from jtbandes and snosenzo April 23, 2024 22:00
@jtbandes jtbandes changed the title ROS2: Noramlize byte as uint8 instead of int8 ROS2: Normalize byte as uint8 instead of int8 Apr 23, 2024
Copy link
Member

@jtbandes jtbandes left a comment

Choose a reason for hiding this comment

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

Seems fine.

Is it correct to normalize char to uint8? Is char really meant to be platform-dependent? 😭 (iirc @snosenzo dealt with this in IDL/CDR support?)

@jtbandes
Copy link
Member

Actually just noticed this differs from how we handle the IDL primitives: https://github.com/foxglove/omgidl/blob/fa6ff16507b9737aa896a4e7a8b5cf14cfd02a24/packages/omgidl-parser/src/primitiveTypes.ts#L11-L12

Is that correct?

@snosenzo
Copy link
Contributor

Actually just noticed this differs from how we handle the IDL primitives: https://github.com/foxglove/omgidl/blob/fa6ff16507b9737aa896a4e7a8b5cf14cfd02a24/packages/omgidl-parser/src/primitiveTypes.ts#L11-L12

@jtbandes I honestly think when I wrote that I was looking at what this repo was doing. So I think if we change it here we should probably also change it there

@achim-k achim-k merged commit 3f13e0c into main Apr 24, 2024
2 checks passed
@achim-k achim-k deleted the achim/normalize-byte-uint8 branch April 24, 2024 18:13
@achim-k achim-k mentioned this pull request Apr 24, 2024
achim-k added a commit that referenced this pull request Apr 24, 2024
### Changelog
v5.0.4 Release

### Description
Changes since v5.0.3

- #49
- #48
- #47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants