Skip to content

Upper-case the enumerators of enum parameters - #448

Merged
christophfroehlich merged 2 commits into
ros-tooling:mainfrom
nobleo:feature/uppercase-enumerators
Nov 30, 2026
Merged

christophfroehlich merged 2 commits into
ros-tooling:mainfrom
nobleo:feature/uppercase-enumerators

Conversation

@Timple

@Timple Timple commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

@jjohnnystwsss

Copy link
Copy Markdown
Contributor

Thanks for picking this up! The case check covers the fast/FAST collision I was worried about, and keeping the parameter string as written means existing lower-case configs keep working.

One small suggestion: windows.h also defines ABSOLUTE and RELATIVE (in wingdi.h) and IGNORE (in winbase.h). absolute/relative seem like likely values for a robot parameter, e.g. a position mode, so it might be worth adding those three to CPP_MACRO_NAMES.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the enum-generation update.

No open issues 🎉

What changed in this PR

Updates enum parameter generation introduced in #446 to use uppercase C++ enumerators and Python members, while preserving the original, case-sensitive ROS parameter strings.

Changes:

  • Uppercases generated enum declarations, defaults, and conversion references.
  • Rejects values that collide after uppercasing or match listed common C/C++ macros.
  • Updates documentation and tests for uppercase members and unchanged string values.
File Description
README.md Documents uppercase members, validation rules, and usage.
generate_parameter_library_py/​generate_parameter_library_py/​test/​test_enum_parameters.py Tests uppercase generation, validation, and Python string compatibility.
generate_parameter_library_py/​generate_parameter_library_py/​parse_yaml.py Separates enumerator names from strings and validates collisions.
generate_parameter_library_py/​generate_parameter_library_py/​jinja_templates/​python/​declare_enum Generates uppercase Python members with original string values.
generate_parameter_library_py/​generate_parameter_library_py/​jinja_templates/​cpp/​parameter_library_header Updates conversions to use uppercase enumerators.
generate_parameter_library_py/​generate_parameter_library_py/​jinja_templates/​cpp/​declare_enum Generates uppercase C++ enumerators.
example/​test/​test_params_consistency.cpp Updates C++ consistency tests to uppercase references.
example_python/​test/​test_params_consistency.py Updates Python consistency tests to uppercase references.
example_cmake_python/​test/​test_params_consistency.py Updates CMake-based Python consistency tests to uppercase references.

Review effort: Balanced

@christophfroehlich christophfroehlich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.
uppercase enums are enforced, and the user can decide how the parameters should be written by using enum_values: [VELOCITY] or enum_values: [velocity]

@christophfroehlich

Copy link
Copy Markdown
Collaborator

One small suggestion: windows.h also defines ABSOLUTE and RELATIVE (in wingdi.h) and IGNORE (in winbase.h). absolute/relative seem like likely values for a robot parameter, e.g. a position mode, so it might be worth adding those three to CPP_MACRO_NAMES.

reads similar to the claude review in my session ;)

From memory, <windows.h> (through wingdi.h and winbase.h) also defines ABSOLUTE, RELATIVE, INFINITE, TRANSPARENT and OPAQUE. absolute/relative is a very plausible enum for a controller, and it would only fail on Windows, with a confusing compile error. I'm fairly sure about ABSOLUTE/RELATIVE, but I haven't checked them against the header.

I agree that those could be typical values and should be rejected.

@christophfroehlich christophfroehlich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@christophfroehlich
christophfroehlich merged commit da7e100 into ros-tooling:main Nov 30, 2026
19 of 20 checks passed
@Timple

Timple commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Great!

Not sure about the branching strategy here, will this be backported?

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.

4 participants