• Diff for "smach/Tutorials/Iterator container"
Differences between revisions 6 and 7
Revision 6 as of 2011-01-21 01:05:10
Size: 1600
Editor: MeloneeWise
Comment:
Revision 7 as of 2011-01-21 19:56:49
Size: 1418
Editor: MeloneeWise
Comment:
Deletions are marked like this. Additions are marked like this.
Line 27: Line 27:
{{{#!python
from smach import Iterator
}}}
Line 31: Line 28:
Start by constructing the iterator:
{{{
task_it = Iterator(['succeeded','preempted','aborted'],
                            input_keys = ['key_a', 'key_b','key_c'],
                            it = lambda: range(0, len(sm.userdata.key_c)),
                            output_keys = ['key_d', 'key_e', 'key_f'],
                            it_label = 'it_index',
                            exhausted_outcome = 'succeeded')
}}}
In this tutorial we are going to use an iterator to sort a list of numbers into evens and odds.

<<GetTaggedCode(https://code.ros.org/svn/ros-pkg/stacks/executive_smach_tutorials/trunk/smach_tutorials/examples/iterator_tutorial.py,python,FULLTEXT,show_uri,no_tag_newlines,global_lines)>>




(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Iterator container

Description: This tutorial teaches you how to use the Iterator container.

Tutorial Level: BEGINNER

Next Tutorial: Wrapping a SMACH container with actionlib

Contents

In this tutorial we are going to use an iterator to sort a list of numbers into evens and odds.

Could not fetch external code from 'https://code.ros.org/svn/ros-pkg/stacks/executive_smach_tutorials/trunk/smach_tutorials/examples/iterator_tutorial.py':

Wiki: smach/Tutorials/Iterator container (last edited 2017-01-24 11:26:57 by GertKanter)