A traditional way of programming gaits for modular robots is through the use of gait tables. A gait table is a two-dimensional array, with one axis representing modules, and the other representing time; the entries of the table are joint angles. PARSL can represent gait tables easily. Fig. 2.1 shows the same code as "helloworld.xml", but using a gait table.
For a small number of modules, gait tables are simple to produce and easy to understand, however their size grows linearly with increasing number of modules and there is no structure in the table. From software engineering point of view, this is not scalable. For example, it is not obvious to modify the table to a robot with five modules instead of four modules in "group1". Interested readers may try this out as an exercise.
Exercise 2.1 Modify snake_table.xml so that group1 has five modules. [Median]
Every named state referenced in <automata> has to be defined in the <states> section, where the actions on that state is specified. In the current version of the specification, only "angles" are defined. Future extensions to other types of actuators and actions are easy to make. The elements in "angles" specifies the state vector. Each element in the state vector specifies the actuation on that joint. Without other notations, a linear interpolation between the current angle and the value in the state is assumed. More state specifications will be presented in Lesson 7.
Looking carefully at the table specified in Fig. 2.1, one may have noticed that the state of each module is simply shifted by one entry to its neighbors. Since there are total four time steps, one entry corresponds to 0.25 phase of the total cycle. Also because value between states are interpolated linearly, 0's are redundant. By defining states explicitly in the <states> section, one gets "helloworld.xml". In general, attribute "phase" has real values from 0 to 1.
By default, the state duration for every state is evenly distributed for a cycle. However, one can explicitly specify the state duration in the attribute "times" for an automaton. For example, Fig. 2.2 specifies a simple loop gait for 10 modules in the "loop" group of "turnloop.xml".
The automaton "wave" defines a state transition trace as in Fig. 2.3.

Exercise 2.2 Modify loop_simple.xml to have 16 loop modules. [Median]
The automaton "wave" can be modified, as in Fig. 2.4 to explicitly specify the relative time duration. Note that time durations are relative, i.e., the actual time duration of a state is scaled by "period". Time durations can be any real number.
In addition, a new type of state labeled by "@", is introduced, meaning holding the current joint angle to the exit angle of the previous state.
Exercise 2.3 Modify loop_times.xml to have 16 loop modules. [Easy]
There are two ways an automaton applies to a group: type 1. if each element in the group is a module and the number of modules matches the state vector in the automaton, the automaton applies to the whole group; or type 2. if each element in the group (module or subgroup) matches the state vector of the automaton, the automaton applies to each element of the group, with possible phase shifts among the modules or subgroups. An example of type 1 is "snake_table.xml" and an example of type 2 is "loop_simple.xml".
For many symmetric configurations, e.g., humanoids or legged robots, motions of the symmetric parts are identical except negated signs. In PARSL, Symbol ! is used in front of the group name to indicate the negated signs. For most legged walking gaits, the left and right pair of legs has a phase shift 0.5. In PARSL, attribute "offset" in <behaviors> indicates the phase delay, of the group for type 1, or of the first element of the group for type 2. Fig. 2.5 shows an example of a centipede wave gait, where in addition to phase delay between legs on the same side (0.75), the initial phase shift (0.5) has to be there for the left or the right side. Furthermore, the left and the right sides are symmetrical; the left side is negated in this case.

Exercise 2.4 Modify centipede_group.xml to have 12 legs. [Easy]