In this project, we implement state estimation for a biped humanoid robot using an Extended Kalman Filter (EKF). The goal is to locally estimate the robot’s base pose and velocities using only onboard sensors.
Estimate the state of the robot (position, orientation, linear and angular velocity) using the following available sensors:
- 1 RealSense RGB-D camera
- IMU (angular velocities, linear accelerations)
- Joint encoders and torque sensors (joint positions, velocities and torques)
To estimate the robot's state we use an Extended Kalman Filter (EKF) with a floating rigid body dynamic model. The state vector
Where:
-
$\mathbf{p}$ : position of the base (world frame) -
$\mathbf{\theta}$ : orientation (roll, pitch, yaw) -
$\mathbf{v}$ : linear velocity (world frame) -
$\mathbf{\omega}$ : angular velocity (body frame)
The control input consists of foot contact forces:
Where:
-
$\mathbf{F}_{c1}$ : Contact force associated to left foot (world frame) -
$\mathbf{F}_{c2}$ : Contact force associated to right foot (world frame)
Note: We will need to estimate these contact forces, since we do not have force sensors on the feet.
In this model, we treat the robot as a single rigid body with mass concentrated at the center of mass (CoM). This is a common and effective simplification when dealing with floating base dynamics, especially for state estimation purposes.
The system dynamics are divided into two main components:
- Translational dynamics: describe how the position and linear velocity of the CoM evolve under external forces.
- Rotational dynamics: describe how the orientation and angular velocity of the body evolve under external torques induced by contact forces.
These equations form the basis for predicting the robot's motion given contact forces, gravity and inertial effects.
Translational Dynamics:
Where:
-
$m$ : mass of the robot -
$\ddot{\mathbf{p}}$ : acceleration of the CoM in the world frame -
$\mathbf{F}_c$ : net external contact force (in world frame) -
$m \mathbf{g}$ : gravitational force acting on the CoM
Rotational Dynamics:
Where:
-
$\mathbf{I}$ : inertia matrix of the rigid body -
$\dot{\mathbf{\omega}}$ : angular acceleration in the body frame -
$\mathbf{\omega}$ : angular velocity in the body frame -
$\mathbf{F}_c$ : contact force -
$\mathbf{r}_c$ : distance between contact point and CoM
We now write the system dynamics in the form:
The state
Note 1: Simplifications
We assume:
- The inertia tensor
$\mathbf{I}$ is constant and diagonal (mass symmetrically distributed). - Roll and pitch angular velocities are small.
Therefore:
Note 2: Orientation–Angular Velocity Mapping
We represent orientation using ZYX Euler angles:
To relate body angular velocity
Where the matrix
When roll and pitch are small,
Simplified State Space Form:
Where:
-
$\mathbf{p}$ is the position of the base in world frame -
$\mathbf{\theta}$ is the orientation (roll, pitch, yaw) -
$\mathbf{v}$ is the linear velocity (world frame) -
$\mathbf{\omega}$ is the angular velocity (body frame) -
$\mathbf{F}_c^i$ is the$i$ -th foot contact force (expressed in world frame) -
$\mathbf{R}_{\text{world}}^{\text{body}}$ : rotation matrix to express contact forces in body frame. -
$\mathbf{r}_i$ is the moment arm from CoM to the$i$ -th foot contact point (body frame) -
$\mathbf{g}$ is gravity (in world frame)
To apply the Extended Kalman Filter (EKF), we linearize the nonlinear dynamics around the current state estimate. This results in a linear system of the form:
Where:
-
$\mathbf{x} \in \mathbb{R}^{12}$ is the state vector -
$\mathbf{u} \in \mathbb{R}^6$ is the input (external foot contact forces)
The matrix
Where:
-
$I_3$ : 3×3 identity matrix -
$T^{-1}(\mathbf{\theta})$ : transformation matrix relating Euler angle rates to angular velocity
The matrix
Where:
-
$\text{skew}(\mathbf{r}_i)$ : skew-symmetric matrix for cross product with moment arm$\mathbf{r}_i$ -
$R(\mathbf{\theta})$ : rotation matrix from world frame to body frame
Note
Matrices
In order to use EKF, I need to rely on some measurements which will correct my update based only on blind dynamic equations. ORB-SLAM gives me
So the measurement model
The EKF fuses data from three sensors: angular velocity
To estimate contact forces at the feet, we use the full-body dynamics equation of a humanoid robot, which includes both the floating base and the leg joints:
Where:
-
$q$ : generalized coordinates (floating base + joint positions) -
$M(q) \in \mathbb{R}^{n \times n}$ : inertia (mass) matrix -
$h(q, \dot{q})$ : Coriolis, centrifugal, and gravitational effects -
$\tau \in \mathbb{R}^{m}$ : joint torques (measured from sensors) -
$S \in \mathbb{R}^{m \times n}$ : selection matrix for actuated joints -
$J_c \in \mathbb{R}^{3 \times n}$ : contact Jacobian for all feet in contact -
$F_c \in \mathbb{R}^{3}$ : contact forces at the feet (output to estimate)
Since
-
$(J_c^\top)^\dagger$ : pseudoinverse of the transposed contact Jacobian.
This gives us the contact wrench (forces and torques) applied at the feet. These estimated contact forces are then used as control inputs to the Extended Kalman Filter (EKF) for improved state estimation of the floating base.
- F. Stark, J. Middelberg (2025): QP Formulations and Solvers for Dynamic Quadrupedal Walking
- G. Raiola, E. Mingo (2023): A simple yet effective whole-body locomotion framework for quadruped robots
- J. Li, J. Ma (2023): Dynamic Loco-manipulation on HECTOR: Humanoid for Enhanced ConTrol*
- D. Kim, J. Di Carlo (2019): Dynamic Quadruped Locomotion via Whole-Body Control and Model Predictive Control