Skip to content

Convert take API to pybind11 - #721

Merged
hidmic merged 3 commits into
masterfrom
hidmic/pybind-take
Mar 22, 2021
Merged

hidmic merged 3 commits into
masterfrom
hidmic/pybind-take

Conversation

@hidmic

@hidmic hidmic commented Mar 18, 2021

Copy link
Copy Markdown
Contributor

Precisely what the title says. Part of #665. This patch also exposes SerializedMessage for reuse and migrates some C helper functions to C++ (hopefully helping readability).

CI up to rclpy:

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

@hidmic
hidmic requested review from gbalke and sloretz March 18, 2021 21:10

@sloretz sloretz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A couple nitpicks I wouldn't block on.

Comment thread rclpy/src/rclpy/subscription.cpp Outdated
} else {
auto taken_msg = create_from_py(pymsg_type);

if (!taken_msg) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like the pybind11-ified create_from_py would throw if taken_msg holds a nullptr, so no need to check it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. See bc2a249.

Comment thread rclpy/src/rclpy_common/src/common.cpp Outdated
{
typedef void * create_ros_message_signature (void);

py::object pymetaclass = py::getattr(pymessage, "__class__");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pymessage.attr("__class__") works too, but the free function style is fine if you like it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See bc2a249.

@gbalke gbalke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great! Can't find anything to prod at haha.

@hidmic

hidmic commented Mar 19, 2021

Copy link
Copy Markdown
Contributor Author

CI up to rclpy:

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

@sloretz sloretz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with a rebase to fix merge conflicts

hidmic added 3 commits March 22, 2021 14:40
Signed-off-by: Michel Hidalgo <[email protected]>
Signed-off-by: Michel Hidalgo <[email protected]>
@hidmic
hidmic force-pushed the hidmic/pybind-take branch from bc2a249 to 53ffcd5 Compare March 22, 2021 17:49
@hidmic

hidmic commented Mar 22, 2021 •

Copy link
Copy Markdown
Contributor Author

Re-running CI up to rclpy, JIC:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status
  • Windows Debug Build Status

@hidmic

hidmic commented Mar 22, 2021 •

Copy link
Copy Markdown
Contributor Author

Warning introduced by #723, fixed by #731. Going in!

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.

3 participants