Week 08 SOLUTION - Action Selection / Finite-State Machines / Area-Restricted Search

Sample Solution

  due date: Tue Mar 07 by 9:00 PM
  email to: mcb419@gmail.com
  subject: hw08
  email contents:
    1) jsbin.com link to your project code (THIS FILE)
    2) answer all the questions at the bottom of this page in the email
  

Introduction

This assignment combines elements of action selection, finite-state machines, and area-restricted search behavior. The goal is to develop a controller that collects as much energy as possible (100 max) in a fixed time period (2000 ticks). To achieve this goal you will use a finite-state machine to implement an efficient action-selection policy. You will not need to modify anything in fsmBot.js, but you should look at the code to see how it works. The scenario is described below.

Pellets
green pellets - randomly distributed; can be detected at a distance; worth 1 point each; 20 pellets = 20 points
invisible pellets - clustered; can only be detected by running into them; worth 5 points each; 16 pellets = 80 points
Bot sensory inputs
bot.sns.left/right = intensity of green pellet scent (Braitenberg-style);
bot.sns.collision = true when the bot hits a boundary; false otherwise
bot.sns.deltaEnergy = energy gained on previous time step (+1 for green pellets, +5 for invisible pellets, 0 otherwise)
Bot motor outputs
bot.mtr.left/right = motor velocity (Braitenberg-style);
Sample controllers
aggressive - standard Braitenberg crossed-excitation wiring pattern
spiral - a sample spiral (non-optimal)
wander - random wandering
fsm1 - a finite-state machine that 'wanders' by default and 'spins' to get unstuck when it hits a boundary
fsm2 - you will use this slot to implement your own controller
 

Instructions

Develop and test a new FSM-based controller (fsm2) that effectively collects energy from the environment. Your target performance should be around 80 energy-points collected in 2000 ticks (use 'run series' to collect statistics). Part of your policy must include an area-restricted search (ARS) behavior that is triggered when the bot encounters an invisible pellet; the suggested ARS pattern is an outward spiraling trajectory that is likely to hit other invisible pellets (example trajectory).

You will need to code individual state behaviors as stand-alone controller methods. (For example, aggressive, spiral, and wander implement individual state behaviors). These individual "building blocks" should only implement the specific behavior; they should not include the decisison-making rules on when to transition to a different state. All of the transition rules should be in your fsm2 code. More details will be provided in class.

NOTE: Your controller should not use any information that is not available to the bot through its sensors (your controller code should not directly access bot position, pellet positions, etc.).

Results Table

ControllerFitness
mean (std dev)

Questions

*** Please answer the following questions in the body of your email when you submit your assignment.***

  1. List the individual "states" that you used in your fsm2 controller, with a one-line description of what each state does.
    seek - taxis to sensed green pellet at constant speed
    spin - rotate in place when no green pellets visible
    spiral - area-restricted search triggered by invis pellet
    wander - default behavior when failed to find green pellet
  2. For N states there are N2 possible transition rules (allowing for states to transition to themselves). How many of those transitions were actually allowed by your fsm2 code?
    My code allowed 9 of the 16 possible transitions.
    (3 from seek, 2 from spin, 2 from spiral, 2 from wander)
  3. What part of the controller design and implementation did you find most challenging in this week's assignment?
    tuning the parameters for seek, spiral and transition rules