CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Stability of Hybrid Systems Is the dynamics in mode A stable? (s2 = -0.2s1) ? (s2 = 5s1) ? CIS 540 Spring 2015; Lecture April 29 A ds1 = -s1-100s2 s2>=-0.2s1 ds2 = 10s1-s2 B ds1 = -s1+10s2 s2>=5s1 ds2 = -100s1-s2 Is the dynamics in mode B stable? Both modes have stable dynamics, but switching causes instability!
Stability of Hybrid Systems CIS 540 Spring 2015; Lecture April 29
Design and Modeling of Hybrid Systems Automated Guided Vehicle Goal: Follow a track as closely as possible Design of mode-switching controller Obstacle Avoidance for Robotic System Reach target while avoiding obstacles Augment obstacle estimation via communication Multi-hop control network Maintain stability of multiple plants when information flows among sensors, actuators, and computing elements over shared network Design control algorithm in conjunction with scheduling policy for the network CIS 540 Spring 2015; Lecture April 29
Model-Based Design and Analysis Requirements Specify correctness formally Modeling High-level design Analysis Debugging Design-space exploration Implementation And Testing CIS 540 Spring 2015; Lecture April 29
Multi-Robot Coordination Autonomous mobile robots in a room Goal of each robot: Reach a target at a known location Avoid obstacles (positions of obstacles not known in advance) Minimize distance travelled Cameras and vision processing algorithms allow each robot to estimate obstacle positions Estimates are only approximate, and depend on relative position of obstacles with respect to a robot’s position How often should robot update these estimates ? Each robot can communicate with others using wireless links How often and what information? How does communication help ? High-level motion control (path planning) Decide on speed and direction CIS 540 Spring 2015; Lecture April 29
Path Planning with Obstacle Avoidance X Y Robot R (x,y) Direction Robot R’ (x’,y’) ’ ’ Target(x f,y f ) Obstacle O 2 Obstacle O 1 Assumptions: Two dimensional world Point Robots Fixed speed v CIS 540 Spring 2015; Lecture April 29
Path Planning with Obstacle Avoidance X Y (x,y) (x’,y’) ’ ’ Target(x f,y f ) O2O2 O1O1 State variables: (x,y); (x’,y’) Initialization: (x,y) := (x 0, y 0 ); (x’,y’) := (x’ 0, y’ 0 ) Dynamics: dx = v cos , dy = v sin ; dx’ = v cos ’, dy’ = v sin ’ Safety requirement: (x,y) is not in O 1 U O 2 & (x’,y’) is not in O 1 U O 2 Liveness requirement: Eventually (x,y) = (x f, y f ) & Eventually (x’,y’) = (x f, y f ) Performance: Reduce distance travelled! CIS 540 Spring 2015; Lecture April 29
Modeling Obstacles For modeling and analysis, in context of motion planning, need to simplify obstacle shapes and complexity of image processing algorithms Simplicity and abstraction: Key to modeling Assume each obstacle/estimate is a circle Can be described by coordinates of center and radius Assumption: Real obstacle is always contained in estimated circle Alternative: ellipses (more accurate) Consider an obstacle with center (x o,y o ) and radius r Radius of smallest circle that envelopes the actual obstacle Estimate of the obstacle as computed by a robot using image processing algorithms of a robot A circle with center (x o,y o ) and radius e > r Closer is the robot to the obstacle, better is the estimate Decreases with distance of robot from obstacle, and converges to r CIS 540 Spring 2015; Lecture April 29
Obstacle Estimation Y Estimated radius e = r + a(d-r) 0 < a < 1 is a constant x o,y o r Estimate from distance d (x,y) Distance d e (x’,y’) Distance d’ Estimate from distance d’ CIS 540 Spring 2015; Lecture April 29
Rule for Obstacle Estimation X Y (x,y) Target(x f,y f ) Robot R maintains radii e 1 and e 2 that are estimates of the obstacles e1e1 (x o1,y o1 ) e2e2 (x o2,y o2 ) Obstacle estimation is computationally expensive Every t e seconds, robot executes discrete update: e 1 := min( e 1, r 1 + a(dist((x,y), (x o1,y o1 )) –r 1 ); e 2 := min( e 2, r 2 + a(dist((x,y), (x o2,y o2 )) –r 2 ); Computation of robot R’ is symmetric CIS 540 Spring 2015; Lecture April 29
Path Planning X Y (x,y) (x f,y f ) Shortest path: Straight line to target Preferred direction 0 If estimate of obstacle 1 intersects straight path, calculate two paths that are tangents to obstacle If estimate of obstacle 2 intersects straight path, or obstacle 1, calculate tangent paths Path P4 Path P1 Plausible paths: P1 and P4 Calculate which one is shorter: Planning algorithm returns either 1 or 4 CIS 540 Spring 2015; Lecture April 29
Path Planning Function plan with inputs Current position of robot Target position Obstacle 1 position (center and radius estimate) Obstacle 2 position (center and radius estimate) Output: Direction for motion Best possible path to target while avoiding obstacles assuming estimates are correct Function plan written in C code (can be embedded in model) Does it help to execute planning algorithm again as robot moves ? Yes! Estimates may improve suggesting shorter paths Invoke planning algorithm every t p seconds CIS 540 Spring 2015; Lecture April 29
Communication Each robot has its own estimate of each obstacle Robot 2’s estimates may be better than Robot 1’s own estimates Strategy: Every t c seconds, send your own estimates to the other robot, and receive estimates from the other If your own estimates are e 1 and e 2, and receive estimates e’ 1 and e’ 2, execute e 1 := min (e 1, e’ 1 ); e 2 := min (e 2, e’ 2 ) CIS 540 Spring 2015; Lecture April 29
Effect of Coordination X Y (x,y) (x f,y f ) Suppose Path P1 was preferred Path P4 Path P1 Communication with Robot 2 gives a better estimate of obstacle 2, but not for obstacle 1 P2 Path P2 is now viable. Running planner again could choose path P2 CIS 540 Spring 2015; Lecture April 29
System of Robots (real x real) in (real x real) out Hybrid process Robot (real x real) Robot2Robot1 CIS 540 Spring 2015; Lecture April 29
Robot Model clock z p, z e, z c :=0 cont x := x 0, y := y 0 real e 1, e 2 := e 0 ; := 0 dx = v cos dy = v sin z p <= t p & z c <= t c & z e <= t e ~ (x = x f & y = y f ) x = x f & y = y f dx = dy = 0 z c = t c out ! (e1, e2); z c := 0 z p = t p := plan(x,y,e1,e2); z p := 0 z e = t e z e := 0; e 1 := min( e 1, r 1 + a(dist((x,y), (x o1,y o1 )) –r 1 ); e 2 := min( e 2, r 2 + a(dist((x,y), (x o2,y o2 )) –r 2 ); in? (e1’, e2’) e1 := min(e1,e1’); e2:=min(e2,e2’) CIS 540 Spring 2015; Lecture April 29
Analysis Key system parameters How often should a robot communicate? How often should a robot execute planning algorithm How often should a robot execute image processing algorithm to update obstacle estimates? Design-space exploration: Choose values of t c, t p, t e Reduce distance travelled, but also account for costs of communication/computation Symbolic analysis beyond the scope of current tools, so need to run multiple simulations CIS 540 Spring 2015; Lecture April 29
Illustrative Execution: No Communication CIS 540 Spring 2015; Lecture April 29 Distance travelled by R = 8.81
Illustrative Execution: No Communication CIS 540 Spring 2015; Lecture April 29 Distance travelled by R = 8.64
Hybrid Systems Wrap-up Integrated modeling of control, communication, and computation See notes for modeling of multi-hop control networks Not covered: Linear Hybrid Automata (section 9.3) Restricted continuous dynamics and discrete tests/updates Symbolic reachability analysis by representing regions as polyhedra CIS 540 Spring 2015; Lecture April 29
Course Topics Goal: Introduction to principles of design, specification, analysis and implementation of CPS Disciplines Model-based design Concurrency theory Distributed algorithms Formal specification Verification techniques and tools Control theory Real-time systems Hybrid systems Emphasis on mathematical concepts and logical reasoning CIS 540 Spring 2015; Lecture April 29
Logistics Project phase 2: due Friday Final: Wed, May 6, Noon Moore 216 Topics: all covered during lectures during the entire semester Open book: Can consult textbook and your notes during exam Extended office hours (next week): Mon 3 - 4, Tues 4 – 6 Review: Friday’s recitation CIS 540 Spring 2015; Lecture April 29