Day 5

Finite-State Control

The concept of finite-states shows up in a number of places in software engineering and computer science, including models of computation, regular expressions, programming, GUIs, etc. Today, we're going to talk about how this concept can be used for controlling a robot.

We've seen finite-state control already in the context of some group exercises (and in the project), but we haven't talked about it much as a class. Conceptually the idea is quite simple, your robot can be in one of some finite number of states. Depending on the state your robot is in, the robot will be executing a different pattern of behavior. Additionally, there should be well-defined rules for transitioning between states or entering a terminal state (e.g., indicating that the robot has succeeded or failed).

Finite-State Diagrams

When defining your finite-state controller, it helps to create a diagram that clearly spells out both states and state transitions. With the folks on your project team, come up with an example of a behavior (either robotic or human) that can be described with a finite-state controller. Sketch a diagram that clearly shows all states as bubbles and shows state transitions as labeled arrows where the label indicates the conditions under which this transition occurs.

Finite-State Implementation Architectures

There are quite a few methods for implementing a finite-state controller. As a starting point, let's take the skeleton code that we've been using for our ROS nodes thus far. Given this architecture as a starting point, how would you add finite-state control? Discuss with your project team.

Smach

I mentioned smach in an optional exercise during day 3 (which I'm sure no one actually got to!). Briefly, smach is ROS's official infrastructure for finite-state control. If you're interested take a quick scan through the tutorials. If you are considering creating larger finite-state controllers (in particular, hierarchical finite-state controllers), you should probably take a look at these tutorials.

scan versus stable_scan

I'll show you the difference between these two topics.

Peer Brainstorming

Find another team. Take turns going through the following steps for each of the behaviors you are implementing.

    1. Using the whiteboard, sketch out your basic approach.
  1. If you are having any challenges, describe them to your audience. These challenges could be with the basic behavior or enhancements. For instance, perhaps you might ask for help on making your wall follower successfully navigate around corners
    1. If you are having any challenges implementing these behaviors in code that you think the other team might be able to help with, ask for some assistance.

Repeat steps 1-3 for each behavior and each team. If you haven't started thinking about a particular behavior, then you can skip your turn.

Work on Warmup Project

You have the rest of class to work on the warmup project. The schedule over the next few classes is a bit weird since I will be gone next Monday for a conference. The warmup project is officially due at the end of class next Monday, however, we are going to be launching the next project on Thursday. This means that you should make sure to carve out bandwidth for both doing the preliminary reading for the next project and putting the finishing touches on your warmup project.

For Next Time

Continue working on the warmup project... Push yourself.