executive_smach icon indicating copy to clipboard operation
executive_smach copied to clipboard

When does the "execute" function of the State class get called?

Open witignite opened this issue 4 years ago • 1 comments

I'm reading the documents of the generic State class and trying to use it with ROS system. I'm just curious when does the execute function of the State class get called?

class Foo(smach.State):
     def __init__(self, outcomes=['outcome1', 'outcome2']):
       # Your state initialization goes here
     
     # When does this function get called? <---------------
     def execute(self, userdata):
        # Your state execution goes here
        if xxxx:
            return 'outcome1'
        else:
            return 'outcome2'

witignite avatar Oct 12 '20 04:10 witignite

maybe in this line of code ? https://github.com/ros/executive_smach/blob/31cc55743431f48e37ee71d26acd5833ebd3753e/smach/src/smach/iterator.py#L164

tutorgaming avatar Jan 06 '21 06:01 tutorgaming