Design Methodology for State based Embedded Systems Case

Design Methodology for State based Embedded Systems Case Study: Maze Navigator Vivek Subramaniam Graduate Student (Masters’ Program) Department of Computing and Information Sciences Kansas State University

Contents q Introduction q Design methodology for state based time triggered systems q Case Study: Maze Navigator q Demo q Questions Department of Computing and Information Sciences Kansas State University

Introduction Department of Computing and Information Sciences Kansas State University

Behavior Control q Behavior – tasks that process external/internal sensory information and issues an action. q Complex behavior – series of alternations of simple behaviors. q Hierarchical Model. q Reactive robot control architecture. Department of Computing and Information Sciences Kansas State University

Behavior Control API Behavior boolean take. Control( ) void action( ) void suppress( ) Arbitrator public Arbitrator (Behavior[ ] behaviors) Department of Computing and Information Sciences Kansas State University

Time triggered Architecture q Initiated at predetermined instances of real- time. q Event inputs or interrupts are queued and polled periodically. q Relatively easy to validate, test and certify. Department of Computing and Information Sciences Kansas State University

Maze Navigator q. A modification of the Navigator robot as given in Brian Bagnall’s book “Core Lego Mindstorms Programming”. q Sensors and Inputs: Touch sensor, Light Sensor, Timer and two Rotation Sensors. q Actuators: Two motors. q Due to limitations of system, a simulation was developed Department of Computing and Information Sciences Kansas State University

Maze Navigator’s Behavior Model Light Sensor HOME Touch Sensor BUMP True MOVE S S S Motors Point of Suppression Department of Computing and Information Sciences Kansas State University

Design Methodology For State based Time Triggered systems Department of Computing and Information Sciences Kansas State University

Definition “Rational Unified Process (RUP) is a framework that can be used to describe specific development process” - Grady Booch Department of Computing and Information Sciences Kansas State University

Rational Unified Process Actors Use-Cases Class Diagrams Use-Case Realizations Use-Case Model (what) Analysis/Design Models (how) Implementation Actual Code Department of Computing and Information Sciences Kansas State University

Use-Case Realization WAIT WAKEUP Department of Computing and Information Sciences Kansas State University

Use-case realizations with asynchronous waits q Allocating a thread per scenario with Synchronization q Finite State Machine based Implementation Department of Computing and Information Sciences Kansas State University

RUP for Concurrent Programs using Synchronization RUP Actors Use-cases Specify global invariant Class Diagram Scenarios Component Code Scenarios identify synchronization regions in which synchronization is required Global invariants (patterns) Coarsegrained solution Complete code Fine-grained code Synchronization aspect code development (A structured approach to develop concurrent programs in UML) Department of Computing and Information Sciences Kansas State University

RUP for time triggered systems using FSM Actors Use-Cases Class Diagrams Use-Case realizations Use-Case Model Analysis/Design Models (what) (how) Original Class Diagram + State information + Active Classes Revised Class Diagrams + Scenarios for threads Implementation Actual Code Department of Computing and Information Sciences Kansas State University

Event Triggered Systems Boundary Classes Other Classes The flow of control is from the Boundary Classes to other classes Department of Computing and Information Sciences Kansas State University

Time Triggered System Boundary Classes Active Classes Other Classes The flow of control is from Active class to boundary and other classes. Department of Computing and Information Sciences Kansas State University

From this discussion we can see that we have these four options. Event Triggered Finite State Machine Time Triggered Allocating thread Per scenario Department of Computing and Information Sciences Kansas State University

Methodology q Identify the Use Cases q Describe the Use Case realizations and class diagrams q Identify states and thread scenarios q Revise Class Diagram and use-case realization p Form the Finite State Machine q Translate to code Department of Computing and Information Sciences Kansas State University

Case Study: Maze Navigator Department of Computing and Information Sciences Kansas State University

Use Cases for Maze Navigator q MOVE (true): p p p q BUMP (Input from touch sensor): p q Travels back to the last cell location. GO HOME (Timer as input): p p q Scan for an unvisited/ least visited cell. Determine random No. of steps in the direction of picked cell. Travel the required No. of steps in that direction. Calculate the angle and distance for initial point (0, 0). Rotate for the angle and travel the distance in straight line. STEER (Inputs from Rotation Sensors): p p Uses rotation sensor to find angle rotated and distance traveled. Keeps the travel in straight line. Department of Computing and Information Sciences Kansas State University

Use Case Model for Maze Navigator Department of Computing and Information Sciences Kansas State University

Class Diagram Department of Computing and Information Sciences Kansas State University

Use Case Realization Example Maze Navigator : MOVE Behavior Scan for a unvisited or least visited cell Calculate random No. of steps to take in that direction Calculate angle and distance Asynchronous waits Start the motors Wait Until required angle is rotated. Stop motors Update geometry Start the motors Wait Until required distance is traveled Stop motors Update geometry Department of Computing and Information Sciences Kansas State University

Revised Use Case Realization Example. States Wait until input trigger Move Behavior : Scan for unvisited/ least visited cell Calculate random steps in that cells direction Calculate angle and distance Start the motors Wait Until required angle is rotated. Stop motors Update geometry Start the motors Wait Until required distance is traveled Stop motors Update geometry Arbitrator thread Rotation Sensor thread Department of Computing and Information Sciences Kansas State University

Finite State Machine Method – Action Call action. C take. Control. C action. B take. Control. B DONE take. Control. A Legend: Arbitrator thread Rotation sensor thread action. A Department of Computing and Information Sciences Kansas State University

Revised Class Diagram Department of Computing and Information Sciences Kansas State University

Demo Department of Computing and Information Sciences Kansas State University

Acknowledgement q Dr. Masaaki Mizuno q Dr. Rodney R. Howell q Dr. Mitchell L. Nielsen Department of Computing and Information Sciences Kansas State University

Questions ? ? ? Department of Computing and Information Sciences Kansas State University
- Slides: 30