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

set_initial_state: set current_state to initial state #93

Open
wants to merge 2 commits into
base: noetic-devel
Choose a base branch
from

Conversation

k-okada
Copy link

@k-okada k-okada commented Dec 27, 2022

Does anyone know how to use the Set as initialState' button in smach_viewer` or has it ever worked?

This button is used to issue ~/smach/container_init and executes

def set_initial_state(self, initial_states, userdata=smach.UserData()):
smach.logdebug("Setting initial states to " + str(initial_states))
if len(initial_states) > 1:
smach.logwarn("Attempting to set initial state to include more than"
" one state, but the StateMachine container can only"
" have one initial state. Taking the first one.")
# Set the initial state label
if len(initial_states) > 0:
self._initial_state_label = initial_states[0]
# Set local userdata
self.userdata.update(userdata)

but it only updates _initial_state_label, which appears to have no effect on the content. I thought this feature used to work and stopped working at some point, but the first commit 88ce804, but it doesn't seem to be working. If anyone has saved the code prior to this, please let me know.

This PR allows you to force the initial state by clocking this button, see https://github.com/eacousineau/executive_smach_tutorials/blob/854024cc2bbed1ebf90181bef2a7086beca82b24/examples/state_machine_simple_introspection.py for an example.

hoge.mp4

@130s
Copy link
Member

130s commented Oct 16, 2024

Could @k-okada or anyone resolve the conflict?

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.

2 participants