Cognitive Robotics – Formula Sheet
1. Probability Theory
Conditional Probability
p ( x ∣ y ) = p ( x , y ) p ( y ) p(x \mid y) = \frac{p(x,y)}{p(y)} p ( x ∣ y ) = p ( y ) p ( x , y )
p ( x , y ) = p ( x ∣ y ) p ( y ) p(x,y) = p(x \mid y)p(y) p ( x , y ) = p ( x ∣ y ) p ( y )
Law of Total Probability
Discrete:
p ( x ) = ∑ y p ( x ∣ y ) p ( y ) p(x) = \sum_y p(x \mid y)p(y) p ( x ) = y ∑ p ( x ∣ y ) p ( y )
Continuous:
p ( x ) = ∫ p ( x ∣ y ) p ( y ) , d y p(x) = \int p(x \mid y)p(y),dy p ( x ) = ∫ p ( x ∣ y ) p ( y ) , d y
Bayes' Rule
p ( x ∣ y ) = p ( y ∣ x ) p ( x ) p ( y ) p(x \mid y) = \frac{p(y \mid x)p(x)}{p(y)} p ( x ∣ y ) = p ( y ) p ( y ∣ x ) p ( x )
p ( x ∣ y ) = η ⋅ p ( y ∣ x ) p ( x ) p(x \mid y) = \eta \cdot p(y \mid x)p(x) p ( x ∣ y ) = η ⋅ p ( y ∣ x ) p ( x )
Complement Rule
p ( ¬ A ) = 1 − p ( A ) p(\neg A) = 1 - p(A) p ( ¬ A ) = 1 − p ( A )
Entropy
How uncertain are we about a random variable X?
(The entries of X can be a discrete set of states/ a distribution over states. A distribution (kitchen, bedrrom, hallway)=(1, 0, 0) has low entropy, while a distribution (0.33, 0.33, 0.34) has high entropy)
H ( X ) = − ∑ x p ( x ) log p ( x ) H(X) = -\sum_x p(x)\log p(x) H ( X ) = − x ∑ p ( x ) log p ( x )
2. Gaussian Distributions
Univariate Gaussian
N ( x ; μ , σ 2 ) = 1 2 π σ 2 exp ( − ( x − μ ) 2 2 σ 2 ) \mathcal{N}(x;\mu,\sigma^2)
=
\frac{1}{\sqrt{2\pi\sigma^2}}
\exp\left(
-\frac{(x-\mu)^2}{2\sigma^2}
\right) N ( x ; μ , σ 2 ) = 2 π σ 2 1 exp ( − 2 σ 2 ( x − μ ) 2 )
Multivariate Gaussian
N ( x ; μ , Σ ) = 1 ( 2 π ) n ∣ Σ ∣ exp ( − 1 2 ( x − μ ) T Σ − 1 ( x − μ ) ) \mathcal{N}(x;\mu,\Sigma)
=
\frac{1}{\sqrt{(2\pi)^n |\Sigma|}}
\exp\left(
-\frac{1}{2}(x-\mu)^T \Sigma^{-1}(x-\mu)
\right) N ( x ; μ , Σ ) = ( 2 π ) n ∣Σ∣ 1 exp ( − 2 1 ( x − μ ) T Σ − 1 ( x − μ ) )
Linear Transformation
x ′ = A x + b x' = A x + b x ′ = A x + b
μ ′ = A μ + b \mu' = A\mu + b μ ′ = A μ + b
Σ ′ = A Σ A T \Sigma' = A\Sigma A^T Σ ′ = A Σ A T
3. Bayes Filter
Belief Definition
B e l ( x t ) = p ( x t ∣ z 1 : t , u 1 : t ) Bel(x_t) = p(x_t \mid z_{1:t}, u_{1:t}) B e l ( x t ) = p ( x t ∣ z 1 : t , u 1 : t )
Markov Assumptions
p ( x t ∣ x 0 : t − 1 , u 1 : t ) = p ( x t ∣ x t − 1 , u t ) p(x_t \mid x_{0:t-1}, u_{1:t}) = p(x_t \mid x_{t-1}, u_t) p ( x t ∣ x 0 : t − 1 , u 1 : t ) = p ( x t ∣ x t − 1 , u t )
p ( z t ∣ x 0 : t , z 1 : t − 1 , u 1 : t ) = p ( z t ∣ x t ) p(z_t \mid x_{0:t}, z_{1:t-1}, u_{1:t}) = p(z_t \mid x_t) p ( z t ∣ x 0 : t , z 1 : t − 1 , u 1 : t ) = p ( z t ∣ x t )
Recursive Bayes Filter
B e l ( x t ) = η p ( z t ∣ x t ) ∫ p ( x t ∣ u t , x t − 1 ) B e l ( x t − 1 ) d x t − 1 Bel(x_t)
=
\eta p(z_t \mid x_t)
\int
p(x_t \mid u_t, x_{t-1})
Bel(x_{t-1}) dx_{t-1} B e l ( x t ) = η p ( z t ∣ x t ) ∫ p ( x t ∣ u t , x t − 1 ) B e l ( x t − 1 ) d x t − 1
η = 1 p ( z t ∣ z 1 : t − 1 , u 1 : t ) \eta = \frac{1}{p(z_t \mid z_{1:t-1}, u_{1:t})} η = p ( z t ∣ z 1 : t − 1 , u 1 : t ) 1
Prediction
B e l ‾ ( x t ) = ∫ p ( x t ∣ u t , x t − 1 ) B e l ( x t − 1 ) d x t − 1 \overline{Bel}(x_t)
=
\int
p(x_t \mid u_t, x_{t-1})
Bel(x_{t-1})
dx_{t-1} B e l ( x t ) = ∫ p ( x t ∣ u t , x t − 1 ) B e l ( x t − 1 ) d x t − 1
Correction
B e l ( x t ) = η p ( z t ∣ x t ) B e l ‾ ( x t ) Bel(x_t)
=
\eta p(z_t \mid x_t)\overline{Bel}(x_t) B e l ( x t ) = η p ( z t ∣ x t ) B e l ( x t )
4. Kalman Filter
Linear System Model
x t = A x t − 1 + B u t + ϵ t x_t = A x_{t-1} + B u_t + \epsilon_t x t = A x t − 1 + B u t + ϵ t
ϵ t ∼ N ( 0 , R ) \epsilon_t \sim \mathcal{N}(0,R) ϵ t ∼ N ( 0 , R )
R: motion noise covariance
Measurement Model
z t = C x t + δ t z_t = C x_t + \delta_t z t = C x t + δ t
δ t ∼ N ( 0 , Q ) \delta_t \sim \mathcal{N}(0,Q) δ t ∼ N ( 0 , Q )
Q: measurement noise covariance
Prediction
x ˉ t = A t x t − 1 + B t u t \bar{x}_t = A_t x_{t-1} + B_t u_t x ˉ t = A t x t − 1 + B t u t
Σ ˉ t = A t Σ t − 1 A t T + R \bar{\Sigma}_t = A_t \Sigma_{t-1} A_t^T + R Σ ˉ t = A t Σ t − 1 A t T + R
Kalman Gain
K t = Σ ˉ t C t T ( C t Σ ˉ t C t T + Q ) − 1 K_t =
\bar{\Sigma}_t C_t^T
\left(
C_t \bar{\Sigma}_t C_t^T + Q
\right)^{-1} K t = Σ ˉ t C t T ( C t Σ ˉ t C t T + Q ) − 1
Correction
x t = x ˉ t + K t ( z t − C t x ˉ t ) x_t = \bar{x}_t + K_t (z_t - C_t\bar{x}_t) x t = x ˉ t + K t ( z t − C t x ˉ t )
Σ t = ( I − K t C t ) Σ ˉ t \Sigma_t = (I - K_t C_t)\bar{\Sigma}_t Σ t = ( I − K t C t ) Σ ˉ t
1D Kalman Filter
Prediction: The mean is transformed linearly and the variances add up.
μ 1 = μ 0 + u \mu_1 = \mu_0 + u μ 1 = μ 0 + u
σ 1 2 = σ 0 2 + σ u 2 σ 1 = σ 0 2 + σ u 2 \sigma_1^2 = \sigma_0^2 + \sigma_u^2 \quad \quad \quad \sigma_1 = \sqrt{\sigma_0^2 + \sigma_u^2} σ 1 2 = σ 0 2 + σ u 2 σ 1 = σ 0 2 + σ u 2
Correction: The Kalman gain is the ratio of the variance of the prediction to the total variance (prediction + measurement). The innovation z − μ 1 z-\mu_1 z − μ 1 is added to the prediction mean, weighted by the Kalman gain. The variance is reduced by a factor of (1-K).
K = σ 1 2 σ 1 2 + σ z 2 K = \frac{\sigma_1^2}{\sigma_1^2 + \sigma_z^2} K = σ 1 2 + σ z 2 σ 1 2
μ = μ 1 + K ( z − μ 1 ) \mu = \mu_1 + K (z-\mu_1) μ = μ 1 + K ( z − μ 1 )
σ 2 = ( 1 − K ) σ 1 2 \sigma^2 = (1-K)\sigma_1^2 σ 2 = ( 1 − K ) σ 1 2
5. Extended Kalman Filter (EKF)
Nonlinear Models
x t = g ( u t , x t − 1 ) + ϵ t x_t = g(u_t, x_{t-1}) + \epsilon_t x t = g ( u t , x t − 1 ) + ϵ t
z t = h ( x t ) + δ t z_t = h(x_t) + \delta_t z t = h ( x t ) + δ t
Jacobians
G t = ∂ g ( u t , x ) ∂ x ∣ x = μ t − 1 G_t = \frac{\partial g(u_t, x)}{\partial x}\Big|_{x=\mu_{t-1}} G t = ∂ x ∂ g ( u t , x ) x = μ t − 1
H t = ∂ h ( x ) ∂ x ∣ x = μ ˉ t H_t = \frac{\partial h(x)}{\partial x}\Big|_{x=\bar{\mu}_t} H t = ∂ x ∂ h ( x ) x = μ ˉ t
EKF Prediction
μ ˉ t = g ( u t , μ t − 1 ) \bar{\mu}_t = g(u_t, \mu_{t-1}) μ ˉ t = g ( u t , μ t − 1 )
Σ ˉ t = G t Σ t − 1 G t T + R \bar{\Sigma}_t = G_t \Sigma_{t-1} G_t^T + R Σ ˉ t = G t Σ t − 1 G t T + R
EKF Correction
K t = Σ ˉ t H t T ( H t Σ ˉ t H t T + Q ) − 1 K_t =
\bar{\Sigma}_t H_t^T
(H_t \bar{\Sigma}_t H_t^T + Q)^{-1} K t = Σ ˉ t H t T ( H t Σ ˉ t H t T + Q ) − 1
μ t = μ ˉ t + K t ( z t − h ( μ ˉ t ) ) \mu_t = \bar{\mu}_t + K_t (z_t - h(\bar{\mu}_t)) μ t = μ ˉ t + K t ( z t − h ( μ ˉ t ))
Σ t = ( I − K t H t ) Σ ˉ t \Sigma_t = (I - K_t H_t)\bar{\Sigma}_t Σ t = ( I − K t H t ) Σ ˉ t
6. Unscented Kalman Filter (UKF)
TODO weights
Sigma Points
χ 0 = μ \chi_0 = \mu χ 0 = μ
χ i = μ + ( ( n + λ ) Σ ) i \chi_i = \mu + (\sqrt{(n+\lambda)\Sigma})_i χ i = μ + ( ( n + λ ) Σ ) i
χ i + n = μ − ( ( n + λ ) Σ ) i \chi_{i+n} = \mu - (\sqrt{(n+\lambda)\Sigma})_i χ i + n = μ − ( ( n + λ ) Σ ) i
λ = α 2 ( n + κ ) − n \lambda = \alpha^2(n+\kappa) - n λ = α 2 ( n + κ ) − n
Mean
μ = ∑ i w i ( m ) χ i \mu = \sum_i w_i^{(m)} \chi_i μ = i ∑ w i ( m ) χ i
Covariance
Σ = ∑ i w i ( c ) ( χ i − μ ) ( χ i − μ ) T \Sigma = \sum_i w_i^{(c)}(\chi_i - \mu)(\chi_i - \mu)^T Σ = i ∑ w i ( c ) ( χ i − μ ) ( χ i − μ ) T
7. Particle Filter
Importance Weight (General)
w t ( i ) ∝ p ( z t ∣ x t ( i ) ) p ( x t ( i ) ∣ u t , x t − 1 ( i ) ) q ( x t ( i ) ∣ x t − 1 ( i ) , u t , z t ) w_t^{(i)} \propto
\frac{
p(z_t \mid x_t^{(i)})
p(x_t^{(i)} \mid u_t, x_{t-1}^{(i)})
}{
q(x_t^{(i)} \mid x_{t-1}^{(i)},u_t,z_t)
} w t ( i ) ∝ q ( x t ( i ) ∣ x t − 1 ( i ) , u t , z t ) p ( z t ∣ x t ( i ) ) p ( x t ( i ) ∣ u t , x t − 1 ( i ) )
or recursively:
w t ( i ) = w t − 1 ( i ) p ( z t ∣ x t ( i ) ) p ( x t ( i ) ∣ u t , x t − 1 ( i ) ) q ( x t ( i ) ∣ x t − 1 ( i ) , u t , z t ) w_t^{(i)}
= w_{t-1}^{(i)}
\frac{
p(z_t \mid x_t^{(i)})
p(x_t^{(i)} \mid u_t, x_{t-1}^{(i)})
}{
q(x_t^{(i)} \mid x_{t-1}^{(i)},u_t,z_t)
} w t ( i ) = w t − 1 ( i ) q ( x t ( i ) ∣ x t − 1 ( i ) , u t , z t ) p ( z t ∣ x t ( i ) ) p ( x t ( i ) ∣ u t , x t − 1 ( i ) )
Bootstrap Filter
w t ( i ) ∝ p ( z t ∣ x t ( i ) ) w_t^{(i)} \propto p(z_t \mid x_t^{(i)}) w t ( i ) ∝ p ( z t ∣ x t ( i ) )
Normalization
w t ( i ) = w t ( i ) ∑ j w t ( j ) w_t^{(i)} =
\frac{w_t^{(i)}}{\sum_j w_t^{(j)}} w t ( i ) = ∑ j w t ( j ) w t ( i )
Effective Sample Size
N eff = 1 ∑ i ( w t ( i ) ) 2 N_{\text{eff}} =
\frac{1}{\sum_i (w_t^{(i)})^2} N eff = ∑ i ( w t ( i ) ) 2 1
8. Differential Drive & Motion Models
Wheel Velocities
v = v r + v l 2 v = \frac{v_r + v_l}{2} v = 2 v r + v l
ω = v r − v l L \omega = \frac{v_r - v_l}{L} ω = L v r − v l
Instantaneous Turning Radius
R = v ω R = \frac{v}{\omega} R = ω v
Velocity Motion Model
x ′ = x − v ω sin θ + v ω sin ( θ + ω Δ t ) x' = x - \frac{v}{\omega}\sin\theta
+ \frac{v}{\omega}\sin(\theta + \omega \Delta t) x ′ = x − ω v sin θ + ω v sin ( θ + ω Δ t )
y ′ = y + v ω cos θ − v ω cos ( θ + ω Δ t ) y' = y + \frac{v}{\omega}\cos\theta
- \frac{v}{\omega}\cos(\theta + \omega \Delta t) y ′ = y + ω v cos θ − ω v cos ( θ + ω Δ t )
θ ′ = θ + ω Δ t \theta' = \theta + \omega \Delta t θ ′ = θ + ω Δ t
Special Case: ω = 0 \omega = 0 ω = 0 , straight line motion
x ′ = x + v Δ t cos θ x' = x + v \Delta t \cos\theta x ′ = x + v Δ t cos θ
y ′ = y + v Δ t sin θ y' = y + v \Delta t \sin\theta y ′ = y + v Δ t sin θ
θ ′ = θ \theta' = \theta θ ′ = θ
9. Occupancy Grid Mapping
Binary Bayes Update
Assumption:
Cells are independent given measurements.
p ( m i ∣ z 1 : t , x 1 : t ) = p ( z t ∣ m i , x t ) p ( m i ∣ z 1 : t − 1 , x 1 : t − 1 ) p ( z t ∣ z 1 : t − 1 , x 1 : t ) p(m_i \mid z_{1:t}, x_{1:t})
=
\frac{
p(z_t \mid m_i, x_t)
p(m_i \mid z_{1:t-1}, x_{1:t-1})
}{
p(z_t \mid z_{1:t-1}, x_{1:t})
} p ( m i ∣ z 1 : t , x 1 : t ) = p ( z t ∣ z 1 : t − 1 , x 1 : t ) p ( z t ∣ m i , x t ) p ( m i ∣ z 1 : t − 1 , x 1 : t − 1 )
Log-Odds Representation
l t = log p ( m i ∣ z 1 : t , x 1 : t ) p ( ¬ m i ∣ z 1 : t , x 1 : t ) l_t = \log \frac{p(m_i \mid z_{1:t}, x_{1:t})}{p(\neg m_i \mid z_{1:t}, x_{1:t})} l t = log p ( ¬ m i ∣ z 1 : t , x 1 : t ) p ( m i ∣ z 1 : t , x 1 : t )
Log-Odds Update
l ( m i ∣ z 1 : t , x 1 : t ) = l ( m i ∣ z t , x t ) + l ( m i ∣ z 1 : t − 1 , x 1 : t − 1 ) − l ( m i ) l(m_i | z_{1:t}, x_{1:t}) = l(m_i | z_t, x_t) + l(m_i | z_{1:t-1}, x_{1:t-1}) - l(m_i) l ( m i ∣ z 1 : t , x 1 : t ) = l ( m i ∣ z t , x t ) + l ( m i ∣ z 1 : t − 1 , x 1 : t − 1 ) − l ( m i )
10. EKF-SLAM
State Vector
μ = ( x m ) \mu =
\begin{pmatrix}
x \\
m
\end{pmatrix} μ = ( x m )
dim ( μ ) = 3 + 2 N \dim(\mu) = 3 + 2N dim ( μ ) = 3 + 2 N
Σ ∈ R ( 3 + 2 N ) × ( 3 + 2 N ) \Sigma \in \mathbb{R}^{(3+2N)\times(3+2N)} Σ ∈ R ( 3 + 2 N ) × ( 3 + 2 N )
Σ = ( Σ x x Σ x m Σ m x Σ m m ) \Sigma = \begin{pmatrix}
\Sigma_{xx} & \Sigma_{xm} \\
\Sigma_{mx} & \Sigma_{mm}
\end{pmatrix} Σ = ( Σ xx Σ m x Σ x m Σ mm )
11. FastSLAM (Rao-Blackwellization)
p ( x 1 : t , m ∣ z 1 : t , u 1 : t ) = p ( x 1 : t ∣ z 1 : t , u 1 : t ) ∏ j p ( m j ∣ x 1 : t , z 1 : t ) p(x_{1:t}, m \mid z_{1:t}, u_{1:t})
=
p(x_{1:t} \mid z_{1:t}, u_{1:t})
\prod_j p(m_j \mid x_{1:t}, z_{1:t}) p ( x 1 : t , m ∣ z 1 : t , u 1 : t ) = p ( x 1 : t ∣ z 1 : t , u 1 : t ) j ∏ p ( m j ∣ x 1 : t , z 1 : t )
12. ICP (Least Squares Alignment)
Minimize:
E ( R , t ) = ∑ i ∣ y i − ( R x i + t ) ∣ 2 E(R,t) =
\sum_i
| y_i - (R x_i + t) |^2 E ( R , t ) = i ∑ ∣ y i − ( R x i + t ) ∣ 2
Centroids:
x ˉ = 1 N ∑ i x i \bar{x} = \frac{1}{N}\sum_i x_i x ˉ = N 1 i ∑ x i
y ˉ = 1 N ∑ i y i \bar{y} = \frac{1}{N}\sum_i y_i y ˉ = N 1 i ∑ y i
Covariance:
H = ∑ i ( x i − x ˉ ) ( y i − y ˉ ) T H = \sum_i (x_i - \bar{x})(y_i - \bar{y})^T H = i ∑ ( x i − x ˉ ) ( y i − y ˉ ) T
SVD:
H = U Σ V T H = U \Sigma V^T H = U Σ V T
R = V U T R = V U^T R = V U T
t = y ˉ − R x ˉ t = \bar{y} - R \bar{x} t = y ˉ − R x ˉ
13. A*
TODO admissability and consistency
f ( n ) = g ( n ) + h ( n ) f(n) = g(n) + h(n) f ( n ) = g ( n ) + h ( n )
Without heuristic:
f ( n ) = g ( n ) f(n) = g(n) f ( n ) = g ( n )
14. Hough Transform (Line)
ρ = x cos θ + y sin θ \rho = x\cos\theta + y\sin\theta ρ = x cos θ + y sin θ
15. Precision / Recall / F1
Precision = T P T P + F P \text{Precision} = \frac{TP}{TP + FP} Precision = TP + FP TP
Recall = T P T P + F N \text{Recall} = \frac{TP}{TP + FN} Recall = TP + FN TP
F 1 = 2 ⋅ Precision ⋅ Recall Precision + Recall F_1 =
\frac{2 \cdot \text{Precision} \cdot \text{Recall}}
{\text{Precision} + \text{Recall}} F 1 = Precision + Recall 2 ⋅ Precision ⋅ Recall
16. Distance Point to Line
For line through points (A,B) and point (C):
d = ∣ ( B − A ) × ( C − A ) ∣ ∣ B − A ∣ d =
\frac{| (B-A) \times (C-A) |}
{|B-A|} d = ∣ B − A ∣ ∣ ( B − A ) × ( C − A ) ∣
17. DWA Navigation Function
N F = α vel + β n f + γ Δ n f + θ g o a l NF = \alpha \text{vel} + \beta nf + \gamma \Delta nf + \theta goal NF = α vel + β n f + γ Δ n f + θ g o a l
18. Types of Robotics
Classical Robotics: (e.g. industrial robots)
Exact models of the world
No sensing necessary
Reactive Paradigm: (e.g. Didabot)
No world model at all
Relies heavily on sensing
Hybrid Systems: (e.g. rovers)
model based at higher levels, e.g. for navigation
reactive at lower levels, e.g. for obstacle avoidance
Probabilistic Robotics: (e.g. self-driving cars)
Integrates models and sensing with explicit representation of uncertainty (e.g. bayesian filters)
Models and sensors are inaccurate
Cognitive Robotics: (e.g. humanoid robots)
Cognitive functions normally associated with people or animals: act autonomously to achieve goals and cope with unpredictable situations
Can interpret various kinds of sensor data
Kommentare Noch Fragen?
Durch das Anmelden mit Github wird ein Login-Cookie erstellt und gespeichert. Sie können dies jederzeit rückgängig machen, indem Sie 'Cookie löschen' anklicken.