Graphical State Space Programming (GSSP) Tutorials
Home -> GSSP Tutorials -> Section 2.1 State-variables and Regions

Section 2.1 State-variables and Regions

State-variables and regions are fundamental building blocks of GSSP.

State-variables

State-variables describe the state of a robot. The following are examples of state-variables:

  • Speed
  • Environment Temperature
  • Altitude
  • Battery Level
  • X Position
  • Y Position

Writable state-variables are state-variables that a given robot's actuators can affect. For example, Speed is a writable state-variable for a typical ground robot because its motors can affect its speed. Environment temperature, on the other hand, is typically a non-writable state-variable for a ground robot because its actuators cannot affect the temperature of its environment.

Regions

When programming robots, we often want to program reactive behaviors like the following:

  • If there is an obstacle in front, stop moving forward
  • If low on battery level, go to charging station
  • If windspeed is too high, lower altitude

Notice that in each of the three examples, there is a constraint on some state-variable, and a reaction affecting some writable state-variable. In the third example, windspeed being too high is the constraint, and lowering altitude is the reaction.

In GSSP, constraints are graphically represented by regions. Consider the following plane, where battery level is on the hirozontal axis, and altitude is on the vertical axis.

The blue rectangle is a region that represents the following constraint:

  • Battery level is between 10% and 40%, and altitude is between 10 m and 30 m.

This is a two-dimensional region because it imposes constraints on two state-variables. The number of dimensions of a region can range from zero to any positive integer. The next section will show you how to create regions of various dimensions using the GUI.

GSSP provides mechanisms for attaching code to regions, such that when the constraints represented by a given region are satisfied, the attached code is executed. This allows you to program reactive behaviors. The next section will show you how to do this using the GUI.