Skip to content
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

Loop logic cleanup #63

Merged
merged 1 commit into from
Feb 4, 2023
Merged

Loop logic cleanup #63

merged 1 commit into from
Feb 4, 2023

Conversation

AndyZe
Copy link
Collaborator

@AndyZe AndyZe commented Jan 29, 2023

Detect Ctrl+C and quit the while loop gracefully. Also, added a sleep to one loop to reduce CPU usage.

@AndyZe AndyZe changed the title [Draft] Loop logic cleanup Loop logic cleanup Jan 29, 2023
Copy link
Owner

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

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

Thanks!

@AndyZe AndyZe merged commit dad713e into main Feb 4, 2023
@AndyZe AndyZe deleted the andyz/sleep_rate_in_loops branch February 4, 2023 15:47
@@ -24,8 +24,13 @@ def __init__(self):
GoalSpecification, "goal_specification", 10
)
self.get_logger().info("Waiting for subscription")
while self.goalspec_pub.get_subscription_count() < 1:
while rclpy.ok() and self.goalspec_pub.get_subscription_count() < 1:
Copy link
Owner

Choose a reason for hiding this comment

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

Seems like this change causes a deadlock when you run e.g. ros2 launch pyrobosim_ros demo_pddl.launch.py. Can you look at this to see if something is amiss, or else revert this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't see what the problem is. I figured it might be that rclpy.init() was not called prior, but it is.

I'll refactor and open a new PR to avoid the issue.

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.

None yet

2 participants