Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose ROS2 constants in generated bindings (Rust and C++) #428

Merged
merged 6 commits into from
Feb 29, 2024

Conversation

phil-opp
Copy link
Collaborator

@phil-opp phil-opp commented Feb 28, 2024

Some ROS2 message definitions define constants, e.g. to specify the values of an enum-like integer field.
The Dora ROS2 bridge exposes these constants in the generated bindings as functions.

For example, the STATUS_NO_FIX constant of the NavSatStatus message can be accessed as follows:

assert((sensor_msgs::const_NavSatStatus_STATUS_NO_FIX() == -1));

(Note: Exposing them as C++ constants is not possible because it's not supported by cxx yet.)

Requires dtolnay/cxx#1320

@phil-opp phil-opp marked this pull request as ready for review February 29, 2024 12:11
@phil-opp phil-opp merged commit ac6eaec into main Feb 29, 2024
17 checks passed
@phil-opp phil-opp deleted the c++-ros2-constants branch February 29, 2024 13:11
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.

2 participants