HW: Turtle Robot Statechart

Learning objective: hands-on experience with statecharts; experience responding to a requirements change with a statechart change; get an idea what design drawing tools are available; low-stakes chance to find out if you'll have troubles with your project statechart. This homework is intended to be done BEFORE the project to get you started in the right direction.

Create a statechart for a maze-solving robot with the below properties. Be sure that your statechart has an initialization arc, a number of states, an action for each state, and guard conditions on each transition.

Consider a maze-solving robot that uses the left-hand-rule approach to solving a maze. A person using this rule would extend their left hand and walk while keep it touching the wall at all times, turning as required to follow the wall.

However, our turtle-bot doesn't have a "left hand," and instead only has a front bumper. We assume that the front bumper can detect the wall without the need for the turtle bot to actually move (for example, it is a single forward-facing ultrasonic distance sensor with a range of less than one square size). Thus, implementing a left-hand-rule approach requires a step of turning left to see if the wall is there, and then either proceding or turning again depending upon whether the wall was sensed.

The turtle bot has the following movement capabilities. These are the ONLY permitted actuator outputs that can be set by states in the statechart. The system can only perform one action per time step, and can only be in one state per time step. (This is a fully synchronous state machine, with the time step equalling the time taken by the robot to turn or move, which we assume is the same for each possible action.)

The turtle bot has the following input sensing capabilities:

This means that one turtle time step includes the following:

Solving a maze is subject to the following constraints:

  1. The maze is an NxM size rectangular grid, for example a standard chess board would be an 8x8 grid (64 squares, with walls at some square boundaries but not others).
  2. You have no information as to where in the grid the turtle starts, and where in the grid the goal square is. (This means you have to book-keep movement and you can't exploit any knowledge about where the rest of the maze might be.)
  3. Each statechart transition takes one time step, including same-state default transitions.
  4. The turtle is only permitted to make exactly ONE of its listed movement capabilities at each time step. It should correctly process both input sources at each time step. (We stress this because some prior-year projects tried to rotate 360 degrees and sample all four walls in a single time step. The default code lets you do this, but later on this constraint will be actively enforced as we improve the simulation framework's representation of real world constraints.)
  5. Maze walls are between squares. This implies that each square is surrounded by 0, 1, 2, 3, or 4 walls. (If trapped inside 4 walls, movement is not possible.)
  6. The turtle displays movements in keeping with the left-hand-rule or right-hand-rule approach to maze solving. (This will change for future projects, but do this for now to keep it simple.)
  7. The turtle must stay still once it has reached the goal square (i.e., it must execute only STOP move actions when on the goal square).

The output of this exercise should be a well formed statechart. Do NOT write code to implement the statechart. Paste the statchart onto a slide using the usual naming convention.

Here's a video showing how the turtle should move. (View directly on YouTube here: https://youtu.be/xifVOQs9ZEc )

Follow these rules for your statechart:

13-1. Create two variants: one with a left-hand-rule and one with a right-hand-rule maze solving heuristic.

RUBRIC:

Supplemental Material: