How trunk sway (roll/pitch) while robot gait is usually compensated?

Hi everyone,

I am designing the state estimation and navigation pipeline for a mobile robot in ROS 2 / Nav2. During locomotion, the robot’s alternating gait causes the chassis to periodically tilt, creating trunk sway in both roll and pitch.
This cause:

  1. Less precise IMU measurement

  2. Less precise odometry value

  3. Less precise odom->baselink transformation

    I have seen some solutions. They include:

  4. Setting two_d_mode: true as a configuration parametr for the robot localization

  5. Setting base_link_frame: base_footprint

But for me it seems like these options would simply ignore the pith roll and yaw whatsoever and will compute odometry completely ignoring 3rd dimension.

Thanks in advance for you suggestions.