Skip to content

Fix tf2_py on Windows#172

Merged
clalancette merged 4 commits intoros2from
tf2_py-fix-py-references
Sep 20, 2019
Merged

Fix tf2_py on Windows#172
clalancette merged 4 commits intoros2from
tf2_py-fix-py-references

Conversation

@clalancette
Copy link
Copy Markdown
Contributor

The individual commits have more details, but essentially this PR fixes up tf2_py so that it works under Windows Debug. There are two main things here:

  1. Make it so that we find python_d.exe when in debug mode.
  2. Fix up reference counting in tf2_py so that it is done properly.

This should fix ros2/build_farmer#240 . CI upcoming.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Borrowing actually doesn't make much sense; we have to hold
onto it until we are done using it.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
We need to hold onto references until after we have finished
using them.  This change rewrites the last two users of
"borrowString" to properly manage references, and also checks
for errors.  It then removes borrowString completely.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Copy Markdown
Contributor Author

CI:

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

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Copy Markdown
Contributor Author

All right, the latest fix should fix the flakiness on Windows. Re-running CI on everything to check, but I think this is ready for review now:

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

Copy link
Copy Markdown
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

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

One question, otherwise LGTM

{
// Simulate doing some work in here; otherwise, we can complete the goal
// before the rclcpp_action interface ever has time to do any work.
std::this_thread::sleep_for(std::chrono::milliseconds(100));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you think this is a bug in rclcpp_action (ie. should it be reasonable to succeed/abort immediately)?

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.

Yeah, it's a good question. I've gone back and forth on it in my head. On the one hand, I think there is an argument that in a "real" action, there is always some delay between the action client send the goal and the action server getting it and then acting on it. On the other hand, I can imagine a scenario where the client and server are composed together, and there is some kind of "fast-path" on the server that allows it to succeed immediately.

So I could go either way here; what's your thinking?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The composition scenario also came to my mind. I'll take a closer look at the rclcpp_action implementation to see what could be done.

find_package(python_cmake_module REQUIRED)
find_package(PythonExtra REQUIRED)

set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We may want to capture/document this bit of logic somewhere, as it will likely come up anytime pytest is used on Windows Debug.

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.

Yeah, that's a good idea. Are you thinking of a cmake function/macro, or documentation? In either case, any thoughts on where we would put it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Windows debug jobs fail to import tf2_py

3 participants