This package contains an implementation of an Extended Kalman Filter (EKF) for state estimation using odometry and IMU measurements. The EKF estimates the position and velocity of a mobile robot in a 2D space.
The following dependencies are required to run the code:
- ROS1 (Robot Operating System)
- Python (version 3.x)
- numpy
- filterpy
-
Install ROS by following the official installation instructions: ROS Installation
-
Install the required Python packages using pip:
pip install numpy filterpy -
Clone this package to your ROS workspace:
cd <path_to_your_ros_workspace>/src git clone https://github.com/mohdwaseem27/ekf.git -
Build and source the ROS workspace:
cd <path_to_your_ros_workspace> catkin_make source devel/setup.bash
-
Launch the robot:
roslaunch ekf ekf.launch -
Add some noise to the odom:
rosrun ekf odom_noise.py -
Run the EKF node:
rosrun ekf ekf.py -
Subscribe to the
/odom_filteredtopic to receive the filtered odometry data. -
Publish the odometry and IMU messages to the respective topics (
/odom_noisyand/sk/imu) for the EKF to process.
- Subscribers:
/odom_noisy(nav_msgs/Odometry): Odometry data with noise/sk/imu(sensor_msgs/Imu): IMU measurements
- Publishers:
/odom_filtered(nav_msgs/Odometry): Filtered odometry data.
- The initial state of the EKF and the initial state covariance can be adjusted in the
__init__function of the EKFNode class. - The process noise covariance matrix (Q) and the measurement noise covariance matrix (R) can be modified in the
__init__function as well.
- If needed, you can modify the motion model (motion_model function), the measurement model (Hx function), and their respective Jacobian matrices (F_jacobian and H_jacobian functions) to suit your specific application.
- Additional sensor data or measurements can be incorporated into the EKF by adding new subscriber callbacks and modifying the measurement vector (z) and covariance matrices accordingly.