rclpy icon indicating copy to clipboard operation
rclpy copied to clipboard

Using Generics for messages

Open InvincibleRMC opened this issue 1 year ago • 4 comments
trafficstars

First Draft.

InvincibleRMC avatar Mar 04 '24 23:03 InvincibleRMC

Noticed bug in protocol definitions working on a fix.

InvincibleRMC avatar Mar 22 '24 00:03 InvincibleRMC

Until this gets merged https://github.com/ros2/rosidl_python/pull/205 the type of all messages/services/actions have to be inferred as Any due to PEP 561. Because messages are all inferred to be Any It won't currently alert user about putting in the wrong message type. But I tested it by adding a py.typed file into std_msgs it correctly warns the user about different messages.

InvincibleRMC avatar Mar 23 '24 01:03 InvincibleRMC

Limited scope to Generics for publishers and subscribers only because couldn't get generics of services and clients working the way I wanted.

InvincibleRMC avatar Mar 24 '24 16:03 InvincibleRMC

Mini CI just to see what happens (repos file build: --packages-up-to rclpy test: --packages-select rclpy)

Linux: Build Status

sloretz avatar Apr 12 '24 18:04 sloretz

CI (repos file build: --packages-up-to rclpy test: --packages-select rclpy)

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

sloretz avatar May 03 '24 18:05 sloretz

Thank you for the PR!

sloretz avatar May 03 '24 20:05 sloretz

Thank you for the PR! @sloretz Would it be possible to backport this and future typing changes into Jazzy as well?

InvincibleRMC avatar May 03 '24 20:05 InvincibleRMC

Seems safe to back port to me

@mergifyio backport jazzy

sloretz avatar May 03 '24 23:05 sloretz

Seems safe to back port to me

While I'm OK with backporting this, I'm going to suggest we hold off on doing it until after Jazzy is released. That way we can be certain that only critical bugfixes are going in at this time.

clalancette avatar May 06 '24 20:05 clalancette

Seems safe to back port to me

While I'm OK with backporting this, I'm going to suggest we hold off on doing it until after Jazzy is released. That way we can be certain that only critical bugfixes are going in at this time.

Seems very reasonable.

InvincibleRMC avatar May 08 '24 17:05 InvincibleRMC