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 Usecase Question #75

Closed
haritsahm opened this issue Aug 26, 2020 · 6 comments
Closed

SMACH Usecase Question #75

haritsahm opened this issue Aug 26, 2020 · 6 comments

Comments

@haritsahm
Copy link

Hi! First if all, your State Machine is Awesome!
I'm using it to control my robot and here is my architecture so far,

fsm

As you can see, after Initializing System, it will change to Task_Monitor State that will read user input from rosservice to determine the next task. My question is, is it a good idea to listen input from user using service/msg? Can I use smach for my robot task controller based on user input and it will run until we terminate the system or is it for single task only (opendoor_fsm, go_somewhere_fsm) and I have to call it from other node? Thankyou!

@bajo
Copy link

bajo commented Sep 1, 2020

@haritsahm this is quite similar to how I used smach a few years ago. Main difference would be that I had a combined task monitor / manager.
This would listen to certain inputs (eg. input from touch interface or speech reco, scheduled task events on ROS topics), do some simple rule-based decision making process and trigger the appropriate sub-state machine (eg. go_to_charging_station).
For us this would run for days, so no need to restart it after a task was finished.

@haritsahm
Copy link
Author

@bajo I see, thank you. Another question, if an action state is running and there is a new task that needs to be executed immidiately, how to set that action state to stop?

@bajo
Copy link

bajo commented Sep 2, 2020

If I remember correctly you need to first preempt the currently running ActionState, after that you can execute another one.

@haritsahm
Copy link
Author

@bajo do you have an example of requesting a preempt of a running state from other task/state? The only available example in tutorial is using a concurrence with a monitor state

@bajo
Copy link

bajo commented Sep 2, 2020

@haritsahm sorry, no public example to point you to. But I guess it depends how you are using the actionlib state. I think you just need to send a new goal to the running actionlib state, with a preempt request as message. See for example the tutorial at http://wiki.ros.org/smach/Tutorials/Simple%20Action%20State , especially the execute_cb of the TestServer.

@haritsahm
Copy link
Author

@bajo I will try it later. Thank you!

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

No branches or pull requests

2 participants