Skip to content

Draft: Derive macro for StructuredParameters #516

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BCSol
Copy link

@BCSol BCSol commented Aug 19, 2025

Proposal for structured parameters derive macro (#496)

Changes:

  • added trait StructuredParameters
  • added derive macro in new rclrs_proc_macros
  • added poc some tests
  • install test_msgs and example_messages with apt, without the cargo build without colon would fail to link rosidl message (I'd be happy about some help there)

TODO:

  • proper documentation of traits
  • default values should be made possible
  • more tests
  • better error messages: should we use anyhow here?
  • make derive feature optional
  • add generic declare macro to NodeState/Node

@mxgrey before I continue here, I'd be happy about some feedback, whether this is what you had in mind or how we could improve upon this POC.

Comment on lines +22 to +25
<depend>rosidl_default_generators</depend>

<test_depend>test_msgs</test_depend>
<test_depend>example_interfaces</test_depend>
<depend>test_msgs</depend>
<depend>example_interfaces</depend>
Copy link
Author

Choose a reason for hiding this comment

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

these are tinkering steps to resolve cargo build without colcon.
I'll remove these

Comment on lines +12 to +13
ros-humble-test-msgs \
ros-humble-example-interfaces \
Copy link
Author

Choose a reason for hiding this comment

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

I was unable to build with cargo without these changes.
With colcon everything was working fine.
These can probably be reverted, but then development with rust-analyzer doesn't really work

Choose a reason for hiding this comment

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

I only ran into this issue after adding the crate rclrs_proc_macros and enabling proc-macro=True in the cargo config

@BCSol BCSol marked this pull request as draft August 19, 2025 23:08
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