ros / executive_smach

A procedural python-based task execution framework with ROS integration.
Other
173 stars 141 forks source link

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

Open witignite opened 4 years ago

witignite commented 4 years ago

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'
tutorgaming commented 3 years ago

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