Design Methodology for State based Embedded Systems Case
Design Methodology for State based Embedded Systems Case Study: Robot Controller Phaneendra Vanka Graduate Student (Masters’ Program) Department of Computing and Information Sciences Kansas State University
Contents q Introduction q Demo q Design Methodology for Time-Triggered State Machine based systems q Case Study: Robot Controller 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 Reactive robot control architecture. q Complex behavior – series of alternations of simple behaviors. q Hierarchical Model. Department of Computing and Information Sciences Kansas State University
LEGO MINDSTORMS q Robotics Invention System Kit consists of motors, touch sensors, light sensors, bricks, gears etc. q RCX Brick - Hitachi H 8/3292 series microcontroller. - 16 MHz of clock speed. - 16 Kb ROM. - 32 Kb external RAM. Department of Computing and Information Sciences Kansas State University
le. JOS q Java Platform for the RCX Brick. q le. JOS API - java. lang, java. util and java. io - classes to control motors, sensors, buttons, IR communication, navigation etc. 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
Robot Controller q. A modification of the Navigator robot as given in Brian Bagnall’s book “Core Lego Mindstorms Programming”. q Sensors and Inputs: Touch sensor, Timer and two Rotation Sensors. q Actuators: Three motors. Department of Computing and Information Sciences Kansas State University
Behavior’s of Robot Controller q MOVE (true): p q COMMAND (Input from IR transceiver): p q Travels 20 units in backward direction. GO HOME (Timer as input): p q Travel to a predefined point. If there is an obstacle go around that obstacle BUMP (Input from touch sensor): p q Travel to a random point Travel to the starting point ARM ROTATE (Timer as input): p . Rotate the arm Department of Computing and Information Sciences Kansas State University
Robot Controller’s Behavior Model Timer GO HOME BUMP S Command COMMAND S Default MOVE Timer ARM ROTATE Touch Sensor S S Motors Point of Suppression Department of Computing and Information Sciences Kansas State University
DEMO Department of Computing and Information Sciences Kansas State University
Design Methodology for Time-Triggered State Machine based systems Department of Computing and Information Sciences Kansas State University
Rational Unified Process Actors Class Diagrams Use-Case realizations Use-Case Model Analysis/Design (what) (how) Implementation Actual code Department of Computing and Information Sciences Kansas State University
Use-Case realizations WAIT WAKEUP Department of Computing and Information Sciences Kansas State University
Use-Case realizations with asynchronous waits q Allocating a thread for each scenario with synchronization code q Finite State Machine based implementation Department of Computing and Information Sciences Kansas State University
Allocating a thread for each scenario Actors Class Diagrams Use-Case realizations Component code Identify regions in which synchronization is required Global invariants (patterns) Coarsegrained solution Complete code Fine-grained code A Structured Approach to Develop Concurrent Programs in UML, Masaaki Mizuno, Gurdip Singh, Mitchell Nielsen Department of Computing and Information Sciences Kansas State University
Finite State Machine based implementation Actors Class Diagrams Use-case realizations Revised Class Diagram Scenarios for threads Original Class Diagram + State information + Active Classes Implementation Time Triggered Department of Computing and Information Sciences Kansas State University
Event Triggered Systems Boundary Class Other Classes Department of Computing and Information Sciences Kansas State University
Time Triggered Systems Boundary Class Active Class Other Classes Department of Computing and Information Sciences Kansas State University
From the above discussion we have the following combinations q Time q Event Triggered State Machine based implementation Thread for each scenario Department of Computing and Information Sciences Kansas State University
Case Study : Robot Controller Department of Computing and Information Sciences Kansas State University
Use Cases for Robot Controller q MOVE (true): p p p q COMMAND (Input from IR transceiver): p p q Travel 20 units in backward direction. GO HOME (Timer as input): p p q Calculate the angle and distance to (MAXX, MAXY). Rotate for the angle and travel the distance in straight line. BUMP (Input from touch sensor): p q Pick up a random point (x, y) to reach. Calculate the angle and distance to (x, y). Rotate for the angle and travel the distance in straight line. Calculate the angle and distance for initial point (0, 0). Rotate for the angle and travel the distance in straight line. ARM ROTATE (Timer as input): p p Rotate the arm in forward direction for 2 seconds Rotate the arm in backward direction for 2 seconds 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 Robot Controller Department of Computing and Information Sciences Kansas State University
Class Diagram Department of Computing and Information Sciences Kansas State University
Use Case Realization Example Robot Controller : MOVE Behavior Wait Until MOVE is triggered Pick a new point (x, y) 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 Department of Computing and Information Sciences Kansas State University
Use Case Realization Example Robot Controller : MOVE Behavior Wait Until MOVE is triggered Pick a new point (x, y) 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 Asynchronous waits Department of Computing and Information Sciences Kansas State University
Finite State Machine Method actions Behavior Action q q Each behavior is a set of actions. After completing one action it goes to the next action of the behavior. Describe the entire system using finite state machine. Allocate threads to traverse through the state machine. p Needs only mutual exclusion of shared variables. Department of Computing and Information Sciences Kansas State University
Use Case Realization Example States Tippy Senior : MOVE Behavior Wait Until MOVE is triggered Pick a new point (x, y) 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 Department of Computing and Information Sciences Kansas State University
Revised Class Diagram Department of Computing and Information Sciences Kansas State University
Use Case Realization Example Arbitrator Tippy Senior : MOVE Behavior Wait Until MOVE is triggered Pick a new point (x, y) 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 Rotation Sensor Thread Department of Computing and Information Sciences Kansas State University
Arbitrator thread Action (GO HOME) take. Control GO HOME Action (BUMP) take. Control BUMP take. Control COMMAND DONE take. Control MOVE Action (COMMAND) Action (MOVE) Department of Computing and Information Sciences Kansas State University
Rotation Sensor Thread Action (GO HOME) take. Control GO HOME Action (BUMP) take. Control BUMP take. Control COMMAND DONE take. Control MOVE Action (COMMAND) Action (MOVE) Department of Computing and Information Sciences Kansas State University
Acknowledgement q Dr. Masaaki Mizuno q Dr. Gurdip Singh q Dr. Mitchell Nielsen Department of Computing and Information Sciences Kansas State University
Questions ? ? ? Department of Computing and Information Sciences Kansas State University
- Slides: 34