NA 568 - Winter 2020 Introduction Maani Ghaffari January 8, 2020
Robotics Systems: How and Why? https://www.youtube.com/watch?v=uFyT8zCg1Kk 2
Course Objective ◮ Teaching essential mathematics and algorithms behind the current robotics research ◮ Prepare you for research and development in robotics ◮ Solving real robotic problems 3
Logistics and Collaboration Policy ◮ All official course info on Canvas ◮ Join Piazza from Canvas ◮ Your assignments must represent original work. ◮ Can talk with other students at a conceptual level all you want. ◮ CANNOT share non-trivial code or solutions. ◮ It is critical that you encounter unexpected challenges! ◮ Solving these problems is where you’ll learn the material! 4
Probability Density Functions Courtesy: T. Barfoot 5
Joint and Conditional Distribution Let X and Y be two random variables. ◮ The joint distribution of X and Y is: p ( x,y ) = p ( X = x and Y = y ) ; ◮ If X and Y are independent then p ( x,y ) = p ( x ) p ( y ) ◮ The conditional probability of X given Y is: p ( x | y ) = p ( x,y ) p ( y ) > 0 . p ( y ) 6
Marginalization ◮ Given p ( x,y ) , the marginal distribution of X can be computed by summing (integration) over Y . ◮ The law of total probability is its variant which uses the conditional probability definition � � p ( x ) = p ( x,y ) = p ( x | y ) p ( y ) y ∈Y y ∈Y and for continuous random variables is � � p ( x | y ) p ( y ) dy p ( x ) = p ( x,y ) dy = y ∈Y y ∈Y 7
Bayes’ Rule ◮ p ( x,y ) = p ( x | y ) p ( y ) = P ( y | x ) p ( x ) ◮ p ( hypothesis | data ) = p ( data | hypothesis ) p ( hypothesis ) p ( data ) p ( x | y ) = p ( y | x ) p ( x ) p ( y | x ) p ( x ) = p ( y ) � x ∈X p ( y | x ) p ( x ) ◮ Likelihood × Prior Posterior = Evidence (Marginal Likelihood) 8
Bayes’ Rule Example An autonomous car is approaching a traffic light which can be either green, yellow, or red. The car is programmed to be conservative and thus it will stop if it detects a yellow or red light; otherwise it will continue driving. Previous tests have demonstrated that due to sensor imperfections, the car will drive through (without stopping) 10% of yellow lights, 95% of green lights, and 1% of red lights. The traffic light is on a continuous cycle (30 seconds green, 5 seconds yellow, 25 seconds red). You are riding in the car and are busy working on your Mobile Robotics project (i.e., not watching the road, light, etc.). You feel the car stop as it approaches the traffic light described above. What is the probability that the traffic light was yellow when the vehicle sensed it? 9
Bayes’ Rule Answer Let S represent the event that the vehicle stopped, G the event that the light was green, Y that it was yellow, R that is was red. ◮ Given: P ( S | Y ) = 0 . 90 , P ( S | G ) = 0 . 05 , P ( S | R ) = 0 . 99 , P ( Y ) = 5 / 60 , P ( R ) = 25 / 60 , P ( G ) = 30 / 60 ◮ Find: P ( Y | S ) P ( Y | S ) = P ( S | Y ) P ( Y ) P ( S ) P ( S | Y ) P ( Y ) P ( Y | S ) = P ( S | Y ) P ( Y ) + P ( S | R ) P ( R ) + P ( S | G ) P ( G ) 0 . 90(5 / 60) P ( Y | S ) = 0 . 90(5 / 60) + 0 . 99(25 / 60) + 0 . 05(30 / 60) = 14 . 63% 10
Bayes’ Rule with Prior Knowledge ◮ Given three random variables X , Y , and Z , Bayes’ rule relates the prior probability distribution, p ( x | z ) , and the likelihood function, p ( y | x,z ) , as follows. p ( x | y,z ) = p ( y | x,z ) p ( x | z ) p ( y | z ) ◮ Given Z , if X and Y are conditionally independent then p ( x,y | z ) = p ( x | z ) p ( y | z ) Example Height and vocabulary are not independent; but they are conditionally independent if you add age. https://en.wikipedia.org/wiki/Conditional independence#Examples 11
Univariate Normal Distribution The univariate (one-dimensional) Gaussian (or normal) distribution with mean µ and variance σ 2 has the following Probability Density Function (PDF). ( x − µ ) 2 2 πσ 2 exp( − 1 1 p ( x ) = √ ) σ 2 2 We often write x ∼ N ( µ, σ 2 ) or N ( x ; µ, σ 2 ) to imply that x follows a Gaussian distribution with mean µ = E [ x ] and variance σ 2 = V [ x ] . 12
Multivariate Normal Distribution The multivariate Gaussian (normal) distribution of an n -dimensional random vector x ∼ N ( µ, Σ) , with mean µ = E [ x ] and covariance Σ = Cov [ x ] = E [( x − µ )( x − µ ) T ] is 2 exp( − 1 p ( x ) = (2 π ) − n 2 | Σ | − 1 2( x − µ ) T Σ − 1 ( x − µ )) 13
Visualizing multivariate Gaussian Let x = vec( x 1 , x 2 ) and x ∼ N ( µ, Σ) where � � � � 0 . 0 0 . 8 0 . 3 µ = , Σ = 0 . 5 0 . 3 1 . 0 Figure: Left, two-dimensional PDF; right, top view of the first plot. 14
Marginalization and Conditioning of Normal Distribution Let x and y be jointly Gaussian random vectors � � � � � � x µ x A C ∼ N ( ) , C T y µ y B then the marginal distribution of x is x ∼ N ( µ x , A ) and the conditional distribution of x given y is x | y ∼ N ( µ x + CB − 1 ( y − µ y ) , A − CB − 1 C T ) 15
Visualizing multivariate Gaussian Let x = vec( x 1 , x 2 ) and x ∼ N ( µ, Σ) where � � � � 0 . 0 0 . 8 0 . 3 µ = , Σ = 0 . 5 0 . 3 1 . 0 0 . 0 2 0.02 0.04 0.06 0 0.08 0 . 1 2 0 . 0.1 8 0.04 0.06 0 0.1 0.04 1 . 0.02 0.18 4 0.02 0.16 0.14 6 0 0.16 0 . 0 . 1 0.12 2 0.08 0.08 0.1 0.04 0 4 . 0.06 0 0 2 . 0 0.02 Figure: Left, the contour plot of the PDF; right, the marginals and the conditional distribution of p ( x 1 | x 2 = 0 . 9) . 16
Affine Transformation of a Multivariate Gaussian Suppose x ∼ N ( µ, Σ) and y = Ax + b . Then y ∼ N ( Aµ + b, A Σ A T ) . E [ y ] = E [ Ax + b ] = A E [ x ] + b = Aµ + b Cov [ y ] = E [( y − E [ y ])( y − E [ y ]) T ] = E [( Ax − Aµ )( Ax − Aµ ) T ] = A E [( x − µ )( x − µ ) T ] A T = A Σ A T 17
Bayes Filters: Framework ◮ Given: ◮ Stream of observations z 1: t and action data u 1: t ◮ Sensor/measurement model p ( z t | x t ) ◮ Action/motion/transition model p ( x t | x t − 1 ,u t ) ◮ Wanted: ◮ The state x t of dynamical system ◮ The posterior of state is called belief bel ( x t ) = p ( x t | z 1: t , u 1: t ) 18
Bayes Filter Algorithm 1 Bayes-filter Require: Belief bel ( x t − 1 ) = p ( x t − 1 | z 1: t − 1 , u 1: t − 1 ) , action u t , measurement z t ; 1: for all state variables do � bel ( x t ) = p ( x t | x 1: t − 1 , u t ) bel ( x t − 1 )d x t − 1 // Predict using ac- 2: tion/control input u t bel ( x t ) = ηp ( z t | x t ) bel ( x t ) // Update using perceptual data z t 3: 4: return bel ( x t ) 19
Bayes Filters: Implementation Examples ◮ Kalman Filter: unimodal linear filter ◮ Information Filter: unimodal linear filter ◮ Extended Kalman Filter: unimodal nonlinear filter with Gaussian noise assumption ◮ Extended Information Filter: unimodal nonlinear filter with Gaussian noise assumption ◮ Particle Filter: multimodal nonlinear filter 20
Simple Example of State Estimation ◮ Suppose a robot obtains measurement z , e.g., using its camera; ◮ What is p (open | z ) ? 21
Causal vs. Diagnostic Reasoning ◮ p (open | z ) is diagnostic . ◮ p ( z | open) is causal . ◮ Often causal knowledge is easier to obtain. ◮ Bayes rule allows us to use causal knowledge: p (open | z ) = p ( z | open) p (open) p ( z ) 22
Example Sensor model (likelihood): ◮ p ( z = sense open | open) = 0 . 6 ◮ p ( z = sense open |¬ open) = 0 . 3 23
Example Sensor model (likelihood): ◮ p ( z = sense open | open) = 0 . 6 ◮ p ( z = sense open |¬ open) = 0 . 3 Prior knowledge (non-informative in this case): ◮ p (open) = p ( ¬ open) = 0 . 5 23
Example Sensor model (likelihood): ◮ p ( z = sense open | open) = 0 . 6 ◮ p ( z = sense open |¬ open) = 0 . 3 Prior knowledge (non-informative in this case): ◮ p (open) = p ( ¬ open) = 0 . 5 Update/Correction: p ( z | open) p (open) p (open | z ) = p ( z | open) p (open) + p ( z |¬ open) p ( ¬ open) 0 . 6 × 0 . 5 p (open | z = sense open) = 0 . 6 × 0 . 5 + 0 . 3 × 0 . 5 = 0 . 6667 Remark z raises the probability that the door is open. 23
Combining Evidence ◮ Suppose our robot obtains another observation z 2 . ◮ How can we integrate this new information? ◮ More generally, how can we estimate p ( x | z 1 , . . . ,z n ) ? 24
Recursive Bayesian Updating p ( x | z 1 , . . . ,z n ) = p ( z n | x, z 1 , . . . ,z n − 1 ) p ( x | z 1 , . . . ,z n − 1 ) p ( z n | z 1 , . . . ,z n − 1 ) Assumption (Markov Assumption) z n is independent of z 1 , . . . ,z n − 1 if we know x . 25
Recursive Bayesian Updating p ( x | z 1 , . . . ,z n ) = p ( z n | x, z 1 , . . . ,z n − 1 ) p ( x | z 1 , . . . ,z n − 1 ) p ( z n | z 1 , . . . ,z n − 1 ) Assumption (Markov Assumption) z n is independent of z 1 , . . . ,z n − 1 if we know x . or equivalently we can state: Assumption (Markov Property) The Markov property states that “ the future is independent of the past if the present is known. “ A stochastic process that has this property is called a Markov process . 25
Recommend
More recommend