To encourage good coding practice, a PARSL specification can be written so as to use parameters given at run time. These parameters are specified in the <parameters> section and may be referenced simply by name. In most places in the PARSL specification, (states, periods, phases, offsets, cycles, etc.), mathematical expressions can be used. JEP is used to parse the expressions. When the program commences execution, the user can enter the desired values in the parameter GUI which then remain fixed for the duration of the program. Such parameters are important when writing reusable or scalable code.
Fig. 4.1 shows a modification of "loop_times.xml" where the number of modules in "loop" and the radius (number of bending modules) of the bending segments are specified as parameters. The type of parameter "text" indicates its GUI is a text input. When the program is loaded, its parameter window pops up, as shown in Fig. 4.2.


If "turnloop.xml" is modified to have 16 modules in "loop" instead of 10, one can simply set N to be 16, rather than changing the code. Such a code is scalable.
More sophisticated again is the use of a customizable interactive user interface used for tele-operation. PARSL allows the user to specify a series of custom controls (e.g. speed or direction) which they can vary during execution. Similar to parameters, controls are specified in the <controls> section. The program can then reference the user's current input in any expression using $name, where name is the name of the control input.
Fig. 4.3 shows a snake gait as in "helloworld.xml" except that the period and amplitude can be changed in run time. When the program is loaded, its control window pops up, as shown in Fig. 4.4. The type of control is slider in this case.


Exercise 4.1 Modify centipede_group.xml so that the speed of walking can be controlled. [Easy]