Specifically, Lidar-Inertial SLAM.

The basic idea is you build a map and then localize the robot on that map. I discussed in Lidar-Inertial Perception the types of map representations and also the scan matching methods.

GRAPH-SLAM

“Given all sensor measurements and motion constraints collected so far… What is the most probable set of robot poses and map variables?”

  • In graph representation, all robot states are discretized into nodes
  • Nodes are robot poses (circles) or observed features (stars)
  • Link indicate
    • transformations (𝑹, 𝒕) between consecutive poses (i.e. spatial constraints)
    • observations of features, i.e., perception measurements

This means that this factor graph is a topological map.

Since every edge corresponds to a spatial constraints between two nodes, we need to optimize the graph:

  • Minimize the error introduced by the two constraints (alter nodes and change links)

STATE SPACE

We consider the position and orientation as the states:

If we consider a 2D graph, then one robot state is equivalent to

How to discretize the trajectory so that the problem is computationally sound?

We use the key frames concept from Lidar-Inertial Perception. We discretize the trajectory w.r.t. time , or by saying that there can be only one state per traveled distance (e.g. )

Motion Constraint

Since we are talking about Lidar-Inertial SLAM, the IMU tells us how the robot moved or the control input .

We denote as the motion constraint.

To complete the update from one state to the next, we also need to take noise into consideration:

where we define as the Process noise covariance matrix.

Measurement Constraint

This is mainly about finding the landmarks and making use of the information from them. For this, we define a measurement model h which relies on landmarks with signatures and observer position .

Therefore, we can define the measurement against the previously known landmark position of .

Since for this we use the Lidar, the measurement vector contains the range and the viewing angle (against robot orientation ) with signature :

where we define and as the Measurement noise covariance matrix.

The basic SLAM problem

These two constraints together describe a basic SLAM problem: given with the noisy control input  and the sensor reading  data, how to estimate  (localization) and mapping problem?

So the 4 important variables:

  • the pose of the robot in body frame
  • the motion constraint using the IMU data in body frame
  • the measurement constraint in body frame
  • the measurement model which is the pose of the landmark in body frame

Graph Construction

After constructing the graph, we have a cost function J to minimize. The graph contains all the measurements between time and

To construct the cost function, we first define the information matrix where graph links are represented in a matrix.

Therefore, we define:

Took from Section 11.4.3 of the Probabilistic Robotics book by S. Thrun:

We define to be a vector composed of the robot poses and the landmark positions , whereas is composed of the momentary pose at time and the respective landmark:

Linearizing the Motion Model:

The various terms in the loss function above are quadratic in the functions and , not in the variables we seek to estimate (poses and the map). Thus, we have to linearize g and h via Taylor expansion around the current estimate :

  • Here is the current estimate of the state vector .
  • is the Jacobian of g at

We define the motion residual:

Then:

Linearizing the Measurement Model:

  • is the current estimate of state
  • is the Jacobian of

We define the measurement residual:

In class, we expand

The Jacobian of w.r.t. the full state vector is:

  • it’s a row vector (a sparse matrix row) that:
    • is zero everywhere except at the positions corresponding to:
      • the current pose (where we have )
      • the observed landmark (where we have )

Example: If we are at pose observing landmark :

The Full Linearization of the Cost Function:

After linearization, we substitute back into the cost function. For the measurement term:

Let be the correction we want to find. Then:

By expanding this quadratic, we will get the contribution to and

  • Information matrix (from quadratic terms ). It tells us which states are connected
  • Information vector (from linear terms ). It tells us how much correction is needed in each direction.

Similarly, for the motion model, we have:

Define the Jacobian for motion in the global state space:  Where: 

  • appears at position (for
  • (identity) appears at position (for

The contribution to : 

The contribution to : 

Once we have and , the solution is:

where is the correction to apply to the current state estimate:

# Initialize X = initial_guess  # All poses and landmarks 
 
for iteration in range(max_iterations): 
	# 1. Compute residuals at current estimate 
	Ω = Ω_0 
	ζ = 0 
	for t in range(T): 
		r_u[t] = x[t] - g(u[t], X[t-1]) 
		r_z[t] = z[t] - h(X[t], m[c[t]], X) 
		# 2. Compute Jacobians 
		G[t] = compute_jacobian_of_g(X[t-1]) 
		H[t] = compute_jacobian_of_h(X[t], m[c[t]]) 
		# 3. Build sparse J matrices 
		J_u[t] = build_sparse_motion_jacobian(G[t], t) 
		J_z[t] =build_sparse_measurement_jacobian(H[t], t, c[t]) 
		# 4. Build Ω and ζ 
		Ω += J_u[t].T @ inv(R[t]) @ J_u[t] 
		Ω += J_z[t].T @ inv(Q[t]) @ J_z[t] 
		ζ += J_u[t].T @ inv(R[t]) @ r_u[t] 
		ζ += J_z[t].T @ inv(Q[t]) @ r_z[t] 
		# 5. Solve for correction 
		δX = solve(Ω, ζ)  # Using sparse solver 
		# 6. Update 
		X = X + δX 
		# 7. Check convergence 
		ifnorm(δX) < threshold: 
			break 

Some insights:

  • we can recover the covariances after solving
  • we iterate because linearization is only accurate near the linearization point

Now we can answer to these questions:

Why isn’t integrating all odometry enough?

  • Because odometry has cumulative errors (drift) that grow unbounded over time

Consider a factor graph, why is it useful to represent the robot trajectory this way?

  • Sparsity (the factor graph represents only the constraints, not all correlations),
  • modularity (we can add constraints incrementally)

How do nodes help with scalability when the environment gets large?

  • We can discretize using the key frame concept.
  • Helps with traceability.

Loop Closure

Covered in Loop Closure.