Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Richard Voyles
Professor and Director, Purdue Robotics Accelerator
Purdue University
Real-Time and Embedded Systems
Software Engineering
Real-Time and Embedded Systems Software Engineering - 2
Where Have We Been?
Scheduling - Periodic Tasks
Scheduling - Sporadic Tasks
Communication and Synchronization
What Now?
Software Engineering Software Life Cycle
Specification Methods Natural Language
Flowcharts
State Transition Diagrams
Structure Charts
Data Flow Diagrams
Petri Nets
Real-Time and Embedded Systems Software Engineering - 3
Software Life Cycle (Software Engineering)
Real-Time and Embedded Systems Software Engineering - 4
Software Engineering Life Cycle Phases
Concept Phase needs and goals
management directive, customer input, technology, etc.
features and feasibility (design and testing)
Requirements Phase Software Specification
timing, accuracy, user interface, etc.
software/hardware interfaces
testing plan
budget and schedule
Functional and Non-functional requirements
Complete, correct, consistent, testable
Real-Time and Embedded Systems Software Engineering - 5
Software Engineering Life Cycle Phases (cont.)
Design Phase
Convert Requirements to Detailed Design Spec.
Module partitioning
Programming Phase
Convert to code, incremental test, documentation
Test Phase
Formal test cases
Does it meet the specs?
Maintenance Phase
Customer support, bug fixes
Real-Time and Embedded Systems Software Engineering - 6
The Real Software Life Cycle
Real-Time and Embedded Systems Software Engineering - 7
Software Specification and Design
Natural Language Written description of the functionality
Required, but should be redundant
Mathematical Specification Precise, maps to code, provable (?)
Flowcharts Well understood, but promotes use of GOTO
Parallel flow interaction not easily represented
Timing issues difficult to represent
Example: Roomba – Home Vacuum with Real-Time Controller
• IR Cliff Sensors
• Back-up
• Turn (90o, 60o, 45o)
• Go straight
Roomba Cliff Response
It is assumed the Roomba is placed in the center of the room and then the “Clean” button is pressed. The robot starts the suction motor and then loads the spiral trajectory and starts moving in a growing spiral to cover the room. If a bump sensor is activated, the robot rotates in place, away from the sensor direction (right, left) up to 90 degrees to align with the wall sensor peak value. The robot then moves forward in a straight line. At any time, if the cliff sensor is activated, the robot will backup 1 cm, then rotate 90o, 45o, or 60o based on the cliff sensor activated (forward, edge, or both, respectively) and move in a straight line.
Roomba – Natural Language Spec
Flowcharts
Start / Stop
Execution
If / Then
No
Yes
Flow of Program Execution
Roomba FlowchartStart
Suction Motor
“Clean” Pressed?
Load Spiral Trajectory
Bump Sensor?
Cliff Sensor?
Execute Trajectory
NoYes
Backup 1 cm
Forward AND
Edge?
No
Load Straight Trajectory
Rotate 60o
Edge?
Rotate 45o Rotate 90o
Yes
Yes Yes
No No
No
Left?
Rotate Right
Rotate Left
Peak Sensor?
Peak Sensor?
Load Straight Trajectory
No
No
NoYes
YesYesYes
Real-Time and Embedded Systems Software Engineering - 13
State Transition Diagrams
State (circle) Represents “equilibrium
points” of the system
Transitions (arrow) Changes of state
Occurs when “condition” is met
“Actions” are taken during transition
System must have Discrete States
Determine What Events Cause Changes in State
Mealy = output during transition
Moore = output within state
Real-Time and Embedded Systems Software Engineering - 14
Roomba State Transition Diagram
Waiting
Execute Trajectory
Backup 1 cm
Rotate Right
Rotate LeftRotate
Delta Angle
Start
Real-Time and Embedded Systems Software Engineering - 15
Structure Charts
“Calling Trees”
Left-to-Right implies: Execution order
o - denotes conditional execution
* - denotes repetitive execution
Top-to-Bottom implies: Increasing detail
Represents program flow, not data flow
Example in [PL] text is poor
Jackson Extensions
Real-Time and Embedded Systems Software Engineering - 16
Roomba Structure Chart
Roomba Robotic Vacuum Cleaning
Accept Button
Suction On
Spiral Trajectory
React to Sensors
*
*
React to Bumps
React to Cliffs
oo
Right/Left Bumper
Rotate Left/Right
Stop at Peak
Stop at 90o
o oStraight
Trajectory