Skip to content

spin until future complete for async service client#317

Closed
Karsten1987 wants to merge 1 commit intomasterfrom
future_handling_keyboard_interrupt
Closed

spin until future complete for async service client#317
Karsten1987 wants to merge 1 commit intomasterfrom
future_handling_keyboard_interrupt

Conversation

@Karsten1987
Copy link
Copy Markdown
Contributor

@Karsten1987 Karsten1987 commented Mar 20, 2019

fixes #316

When hitting ctrl-c, the node exits cleanly now:

[INFO] [add_two_ints_client]: service not available, waiting again...
[INFO] [add_two_ints_client]: service not available, waiting again...
^C[INFO] [rclcpp]: signal_handler(signal_value=2)
[ERROR] [add_two_ints_client]: Interrupted while waiting for the service. Exiting.

Signed-off-by: Karsten Knese karsten@openrobotics.org

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
@Karsten1987 Karsten1987 added the in review Waiting for review (Kanban column) label Mar 20, 2019
@Karsten1987 Karsten1987 self-assigned this Mar 20, 2019
@jacobperron
Copy link
Copy Markdown
Member

I think it might make for a more compelling demo if the spinning on the future was encapsulated in the class, although it's a bit more involved. For example, in ros2/examples#230 I have class methods "spin_until_goal_complete" (client) and "spin" (server) for encapsulating the logic related to the futures.

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.

Following my previous comment, we'd like to change this (and the other demos) to use composition. I've opened #325 to track this. I'll leave it up to you if you want to merge this as-is.

@nuclearsandwich
Copy link
Copy Markdown
Member

@Karsten1987 with the composition transition underway what is the status of this PR?

@jacobperron
Copy link
Copy Markdown
Member

We can try to address it in #325 (or post) to avoid conflicts.

@skucheria FYI

@wjwwood wjwwood deleted the future_handling_keyboard_interrupt branch October 11, 2019 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in review Waiting for review (Kanban column)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rclcpp] Unhandled RCLError exception on keyboard interrupt

3 participants