Step References in "At..."

Under error handling you can select various ways to proceed in case an error occurs. The following three ways listed require that you identify a previous step on the execution path (either a Try step or a loop step) where execution should proceed. Execution proceeds at or after the selected step depending on which one you select:

  • Try Next Alternative
  • Next Iteration
  • Break Loop

When identifying the preferred step, you can select the "nearest step" (of the appropriate kind) or a specific step by name. Sometimes, however, the preferred step does not appear in the selection list for a number of reasons:

  • Only named steps can be selected. If the step is unnamed (the default for Try steps), the step must be given a name before it will appear in the selection list. If the step is the nearest one of the appropriate kind, you can also reach it by selecting "nearest step."
  • Remember that Next Iteration cannot be used with Repeat steps. Thus Repeat steps do not appear in the selection list for Next Iteration.
  • A step name never appears more than once in the selection list, because any reference always goes to the nearest step (of the appropriate kind) with the selected name. Keep that in mind when modifying the robot!
  • If more than one path through the robot leads to the current step, an (appropriate) step with the selected name must be present on every path to the current step. Otherwise, the name does not appear on the selection list.

The last two rules support using error handling in an advanced way that is very similar to the try-catch constructs in Java or C#. See the Try-Catch section for more on this. In those programming languages, you "throw" a named "exception" at the point of error, and "catch" it (by name) somewhere in surrounding code. In robots, you can do something similar with Try steps. The correspondence between the Java/C# terms and the Design Studio terms is described in the table.

Java/C# term What to use in Design Studio

try

The first branch of a Try step

Name of an exception

Name of a Try step

throw E

Handling an error with "Try Next Alternative at E"

catch E

The second branch of a Try step named "E"

This way of thinking about error handling probably is most useful in large robots. When using error handling this way, the names of the Try steps signal what kind of exceptional circumstances each Try step's second branch handles.