robot_localization is a package of nonlinear state estimation nodes. The package was developed by Charles River Analytics, Inc. Please ask questions on answers.ros.org.
In my robot project I want to fuse odom coming from ros2_control DiffDriveController and IMU from oak camera. ROS2 is humble and robot_localization installed using
sudo apt install ros-humble-robot-localization
ros-humble-robot-localization is already the newest version (3.5.1-2jammy.20230525.003924).
Angular velocity / yaw fusion is working correctly -> if robot wheels are in the air -> imu angular zv is zero thus odom angular twist z is ignored, or in case if robot is on the ground its odometry/filtered orientation yaw is updated correctly.
The issue is with imu linear x acceleration and odom linear x velocity. EKF does not listen to imu data at all. Thus when wheels are rotating in the air in +x direction the odometry/filtered still outputs same twist/linear/x as odom from diff drive.
Looking at the debug logs from EKF I noticed that imu ros2 message processing is divided into 2 parts: imu0_twist and imu0_acceleration and time delta for imu0_acceleration is always 0! Is this intended or a bug?
------ RosFilter<T>::integrateMeasurements ------
Integration time is 1685534594.0991454124
11 measurements in queue.
------ FilterBase::processMeasurement (imu0_twist) ------
Filter is already initialized. Carrying out predict/correct loop...
Measurement time is 1685534594064252232, last measurement time is 1685534594063644280, delta is 607952
...
...
...
---------------------- /Ekf::correct ----------------------
------ /FilterBase::processMeasurement (imu0_twist) ------
------ FilterBase::processMeasurement (imu0_acceleration) ------
Filter is already initialized. Carrying out predict/correct loop...
Measurement time is 1685534594064252232, last measurement time is 1685534594064252232, delta is 0
...
...
...
I also add my messages and configs for the reference.
IMU has to be in ENU frame, double checked this multiple times. Gravity is also removed from IMU accelerations.
EKF config
ekf_filter_node:
ros__parameters:
frequency: 30.0
sensor_timeout: 0.1
two_d_mode: true
publish_tf: true
map_frame: map # Defaults to "map" if unspecified
odom_frame: odom # Defaults to "odom" if unspecified
base_link_frame: base_link # Defaults to "base_link" if unspecified
world_frame: odom # Defaults to the value of odom_frame if unspecified
odom0: diff_cont/odom
odom0_config: [false, false, false,
false, false, false,
true, true, false,
false, false, true,
false, false, false]
odom0_differential: false
odom0_relative: false
odom0_queue_size: 10
# Further input parameter examples
imu0: imu/data
imu0_config: [false, false, false,
false, false, false,
false, false, false,
false, false, true,
true, false, false]
imu0_differential: false
imu0_relative: false
imu0_queue_size: 10
debug: true
print_diagnostics: true
Hello!
In my robot project I want to fuse odom coming from ros2_control DiffDriveController and IMU from oak camera. ROS2 is humble and robot_localization installed using
Angular velocity / yaw fusion is working correctly -> if robot wheels are in the air -> imu angular zv is zero thus odom angular twist z is ignored, or in case if robot is on the ground its odometry/filtered orientation yaw is updated correctly.
The issue is with imu linear x acceleration and odom linear x velocity. EKF does not listen to imu data at all. Thus when wheels are rotating in the air in +x direction the odometry/filtered still outputs same twist/linear/x as odom from diff drive.
Looking at the debug logs from EKF I noticed that imu ros2 message processing is divided into 2 parts: imu0_twist and imu0_acceleration and time delta for imu0_acceleration is always 0! Is this intended or a bug?
robot_localization_debug.txt
I also add my messages and configs for the reference. IMU has to be in ENU frame, double checked this multiple times. Gravity is also removed from IMU accelerations.
EKF config
IMU sample
Odom from diffdrive