Skip to content

Define the supported URDF version range in a single place - #269

Open
saikishor wants to merge 4 commits into
ros:rollingfrom
saikishor:unify/supported_urdf_version
Open

saikishor wants to merge 4 commits into
ros:rollingfrom
saikishor:unify/supported_urdf_version

Conversation

@saikishor

Copy link
Copy Markdown
Collaborator

Description

The latest supported URDF version (1.2) was hardcoded in more than one place: the range check in model.cpp and its error message. Adding support for a new URDF version meant finding and updating every one of them.

This PR adds the supported range once, as public constexpr constants in urdf_parser/urdf_parser.hpp:

namespace urdf_export_helpers {
constexpr URDFVersion URDF_MIN_SUPPORTED_VERSION(1, 0);
constexpr URDFVersion URDF_MAX_SUPPORTED_VERSION(1, 2);
}

The version check in model.cpp and its error message are now built from these constants. Supporting a new URDF version becomes a one-line change. Integrators can also query the supported range at compile time.

The feature gates (at_least(1, 1), at_least(1, 2), ...) are intentionally left as they are. They mark the version a feature was introduced in, and they must not move when the latest supported version is bumped.

Changes

  • The URDFVersion (major, minor) constructor, comparisons and getters are now constexpr, so the class can be used in constant expressions
  • New URDF_MIN_SUPPORTED_VERSION / URDF_MAX_SUPPORTED_VERSION constants
  • model.cpp version check and error message use the constants; the message text is unchanged
  • Tests: the supported range, acceptance of the max version, and rejection of versions above it
  • README: documents the constants

Signed-off-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
Signed-off-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
Signed-off-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
Signed-off-by: Sai Kishor Kothakota <sai.kishor@pal-robotics.com>
@saikishor
saikishor requested a review from ahcorde November 5, 2026 05:16
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.

1 participant