This folder is to fulfill the Least-square SLAM framework implemented in Sheet 10 of the course Robot Mapping
The Least-square SLAM is a graph-based SLAM algorithm whose graph comprises of robot pose at diffrenet time instance and landmarks position (Fig. 1). A node of this graph is either a robot pose or a landmark's position. An edge is a constraint between two poses or between one pose and a landmark.
Fig.1 An example of graph in graph-based SLAM
The formation of such a pose graph given the sequence of control signal and sequence of observation
is carried out by the Front-end of a graph-based SLAM algorithm, while the Back-end interprets the resulted graph into a cost function and optimize this function to find the optimal nodes position (Fig.2).
Fig.2 The interaction between two ends of graph-based SLAM
The implementation here just covers the Back-end while assume that the poses graph is already available.
Before progressing further, the state vector needs to be defined so that the target of the algorithm is clear. Since graph SLAM aims to address the full SLAM which is estimatation of robot trajectory and environment map, the state vector is made of all robot poses and location of all landmarks position.
Here is robot's 2D pose in world frame at time instance
.
The map in this implementation consists of point landmarks. Therefore, a landmark is described by solely its position in is 2D location of landmark
in world frame.
An edge connecting node and node
stems from the measurement
. This measurement can be produced by the motion model, the measurement model or the loop closure procedure. Since the generation of graph edges is handled by the Front-end, at this point, an edge is regarded as the homogeneous transformation from one node to another (assume node position is expressed in homogeneous coordinate). The uncertainty of measurement
is encoded in its infomation matrix
.
Depend on the nature of 2 nodes that an edge connects, the constraint introduced by this edge is classified as a pose-pose constraint or pose-landmark constraint.
Let and
be the measurement and the corresponding information matrix of the edge connects node
and node
(Fig.3).
Fig.3 Pose-pose constraint (image in coursety of Robot Mapping)
Let be the homogeneous transformation matrices represent pose of
and
in the world frame, respectively.
is the transformation matrix representing
.
According to Fig.3, estimation of based on
and
is
Let be the transformation from
to
; hence,
As a result, the error introduces by this edge is
Here, is the function that extracts the translation vector and the angle of rotation from a 2D transformation matrix. Expand equation above to get
The constraint of an edge connecting a pose and a landmark position
can be derived in the same manner as pose-pose constraint. Notice that the state of a landmark does not containt its orientation, this means the measurement
is just the translation from
to
. The error equation in the presvious section becomes
With the error introduced by every edge in the graph being defined, the global cost function is the sum of all errors' -norm.
Rewrite as a function of the whole state vector
, meaning
Note that though the argument of is changed from just two state
and
to the full state
, the fact that
does not depend on the other state keeps the value of
exactly the same.
With new definition of , the cost function becomes
Apply Taylor expandsion on with
is an arbitrary value of
and
is a small step from this value
The structure of is elaborarted in the following section. Substitue the Taylor expandsion of
into the cost function,
Let,
A quadratic form emerge from the cost function
For to be a local minimum of
,
needs to satisfy the equation
The quation above results in the optimal step from
To find and solve the graph optimization, the contribution of each edge to
and
need to be investigated.
Considering an arbitrary edge connecting node to node
, the Jacobian of the error introduces by this edge
is
Let respectively denote
and
,
becomes
As can be seen from this equation, is sparse.
Substitute established above into the formula of
(an element in the sum resulting in
) and
2 equations above shows that edge connecting node to node
only contributes to entries corresponding to these nodes in both
and
.
With the structure of the linearized cost function dervied above, this section shows how and
are constructed by iterating through all edge of the pose graph.
Consider an arbitrary edge connecting node to node
, as mentioned in Sec.1, the contribution to cost function of this edge can becomputed according to pose-pose constraint or pose-landmark constraint.
If the edge is induced by a pose-pose constraint, the corresponding Jacobian is
If the edge is induced by a pose-landmark constraint, the error's Jacobian is
Because of the sparseness of the Jacobian, an edge connecting node to node
only contributes to some certaint blocks in
and
which corresponding to index
and
The coefficient vector written in block form as
The 2 blocks get updated by edge are
The Hessian writen in block form as
The 4 blocks of get updated by edge
are
The result of applying Least-square SLAM on three datasets are shown below.
Fig.4 Applying LS-SLAM on simulation dataset
Fig.5 Applying LS-SLAM on intel dataset
Fig.6 Applying LS-SLAM on DLR dataset