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

smach shutdown handler #105

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

smach shutdown handler #105

wants to merge 6 commits into from

Conversation

talhabw
Copy link
Contributor

@talhabw talhabw commented Dec 21, 2024

Closes #104

Sometimes we need to shutdown the smach to prevent the robot from getting damaged. This results in robot trying to align itself to the latest frame we have sent to align_frame_controller.

With this change we call the taluy/control/align_frame/cancel service when the smach is killed, which cancels the align_frame_controller, so the robot stays stable.

@talhabw talhabw self-assigned this Dec 21, 2024
@talhabw talhabw requested a review from senceryazici December 21, 2024 13:30
senceryazici
senceryazici previously approved these changes Dec 22, 2024
"/taluy/control/align_frame/cancel", Trigger
)

signal.signal(signal.SIGINT, self.shutdown_handler)
Copy link
Member

Choose a reason for hiding this comment

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

I believe the SIGINT signal already puts the main state machine in to preempted outcome, maybe when that outcome is achieved we just call the align frame controller and cancel it? Just asking if this signal handling is necessary

Copy link
Contributor Author

@talhabw talhabw Dec 22, 2024

Choose a reason for hiding this comment

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

SIGINT puts the main state machine to aborted outcome.

Maybe we can set each state's aborted outcome to CancelAlignControllerState we already have. I think this may be a better way than signal handling.

@senceryazici
Copy link
Member

This will need to wait until #107 is merged and then will need to rebased, since CI is failing @talhabw

@talhabw talhabw force-pushed the talha/smach-shutdown-handler branch from 7ce6428 to 620d5d1 Compare December 23, 2024 12:32
senceryazici
senceryazici previously approved these changes Dec 23, 2024
Copy link
Member

@senceryazici senceryazici left a comment

Choose a reason for hiding this comment

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

maybe consider hooking up preempted to cancel align controller too. This comes down to the practice I guess, just see if this works out for your problem which you've described.

@talhabw talhabw force-pushed the talha/smach-shutdown-handler branch from f9f3486 to b724ebd Compare December 25, 2024 16:21
Copy link
Member

@senceryazici senceryazici left a comment

Choose a reason for hiding this comment

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

Looks good if all tested

@talhabw
Copy link
Contributor Author

talhabw commented Jan 2, 2025

this waits until #91 is merged

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.

Fix align frame controller still executing when smach is killed
2 participants