Skip to content

Conversation

InvincibleRMC
Copy link
Contributor

@InvincibleRMC InvincibleRMC commented Aug 27, 2025

Description

Having messages inherit from a common base class will make it so Client/Service/ActionClient/ActionServer can automatically infer the generic types they are using. Currently they need to be manually specified.

Based on the original issue but the base classes in rosidl_pycommon.
Builds off ros2/rosidl#887

Fixes #215

Is this user-facing behavior change?

It would allow users to isinstance check to determine if an object is a message.

Did you use Generative AI?

Additional Information

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

this makes sense to me.
this PR upgrades the inheritance of the generated metaclass to use ROS-specific metaclass logic, improving support for endpoint types and their associated messages in ROS 2 Python code generation.

i would like to have another approval before merge.

Copy link
Member

@christophebedard christophebedard left a comment

Choose a reason for hiding this comment

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

I have a minor comment in the other PR, otherwise LGTM

Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
@christophebedard christophebedard self-assigned this Sep 11, 2025
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
@christophebedard
Copy link
Member

Pulls: #230, ros2/rosidl#887
Gist: https://gist.githubusercontent.com/christophebedard/eed622fd1da65170263b1734edfe11de/raw/b75cc11d0a0989e0916903b5dc6e8064be274b42/ros2.repos
BUILD args: --packages-above-and-dependencies rosidl_pycommon rosidl_generator_py
TEST args: --packages-above rosidl_pycommon rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/16931

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@christophebedard
Copy link
Member

christophebedard commented Sep 12, 2025

@InvincibleRMC it looks like there's a real test failure in rosidl_generator_py/test/test_interfaces.py's test_strings

@InvincibleRMC
Copy link
Contributor Author

Ok I found the bug not having __slots__ in the base class was allowing dynamic attributes. It originated in the rosidl pr. It should be good now.

@christophebedard
Copy link
Member

christophebedard commented Sep 17, 2025

Pulls: #230, ros2/rosidl#887
Gist: https://gist.githubusercontent.com/christophebedard/e44c47ef2dc14944e3f6dc0a1ce87cea/raw/1bd32654fcd99a86f61159ce9523b75466bf24c8/ros2.repos
BUILD args: --packages-above-and-dependencies rosidl_pycommon rosidl_generator_py
TEST args: --packages-above rosidl_pycommon rosidl_generator_py
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/17020

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@christophebedard christophebedard merged commit fdb9fed into ros2:rolling Sep 18, 2025
2 of 3 checks passed
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.

Derive generated message classes from a base class
3 participants