Skip to content

Use unsigned diagnostic translation indexes - #50

Open
Daniiiil1 wants to merge 1 commit into
micro-ROS:masterfrom
Daniiiil1:codex/unsigned-diagnostic-indexes
Open

Use unsigned diagnostic translation indexes#50
Daniiiil1 wants to merge 1 commit into
micro-ROS:masterfrom
Daniiiil1:codex/unsigned-diagnostic-indexes

Conversation

@Daniiiil1

Copy link
Copy Markdown

Fixes #33.

What changed

  • use uint16_t for hardware, updater, key/value lookup indexes in the bridge and updater API
  • parse lookup-table indexes with explicit uint16_t range validation instead of signed std::stoi
  • replace polynomial map-key comparisons with lexicographic tuple comparisons, avoiding overflow and collisions across the full 16-bit range
  • update examples and add boundary coverage for ID 65535
  • add the contributor entry required by CONTRIBUTING.md

Why

The ROS messages already encode these translation indexes as unsigned 16-bit values, but the bridge and updater retained signed types. Negative IDs are not valid indexes, and the mismatch could narrow or reinterpret values when moving between the updater, generated messages, and bridge. The polynomial comparator could also overflow for valid 16-bit IDs.

Validation

  • git diff --check
  • cppcheck --enable=warning,style,performance,portability --std=c++14 --suppress=missingIncludeSystem on the changed bridge C++ files
  • cppcheck --enable=warning,style,performance,portability --std=c99 --suppress=missingIncludeSystem on the changed updater C files

The local environment does not include ROS 2/colcon, so the ROS package build and gtests were not run locally. This PR remains a draft pending CI or a maintainer ROS workspace build.

Signed-off-by: Daniil Mordanov <153565951+Daniiiil1@users.noreply.github.com>
@Daniiiil1
Daniiiil1 marked this pull request as ready for review August 7, 2026 12:30
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.

Translation indexes should be unsigned

1 participant