Support for using CONSTANTS as message defaults

Open
#28 5 comments 0 reactions 1 assignee View on GitHub

@SamuelFoo is already working on this.

Since Apr 27, 2026.

Assessment

This issue has not been assessed yet.

Description

enhancement help wanted
Description

Currently, constants can be used as follows:

Constants[<=3] constants_values

And defaults:

uint16[<=3] uint16_values_default [0, 1, 65535]

But - when specifying a const default, rosidl fails. I was hoping I could use syntax such as

Constants[<=3] constants_values_default [Constants::CONST_INT8_MAX, Constants::CONST_UINT8_MAX, Constants::CONST_STRING]
or
Constants[<=3] constants_values_default [Constants.CONST_INT8_MAX, Constants.CONST_UINT8_MAX, Constants.CONST_STRING]

I couldn't find any tests for this case

Motivation

above

Design / Implementation Considerations

above

Additional Information

eg

    File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/parser.py", line 362, in __init__
      self.default_value = parse_value_string(
                           ^^^^^^^^^^^^^^^^^^^
    File "/opt/ros/jazzy/lib/python3.12/site-packages/rosidl_adapter/parser.py", line 639, in parse_value_string
      raise NotImplementedError(

  NotImplementedError: parsing string values into type
Dominant language
CMake
Stars
4
Forks
16
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.