0
$\begingroup$

Rosanswers logo

I'm trying to modify Nav2 Getting Started example to fuse diff_drive odometry and imu data via robot_localization pkg, but I've noticed that the simulated imu sensor outputs an inadequate data. Digging in showed, that the imu sensor is actually detached from the base_link robot body and is keeping falling down from the beginning.

Is that imu falling problem is just my local problem? Or anybody could reproduce the same problem with unmodified Nav2 Getting started example? How to resolve this issue i.e. how fix the imu_link properly to body_link?

Here is a sample of imu data (look at linear_acceleration.z value, it is about zero value), while robot stands still (not moving anywhere):

$ ros2 topic echo /imu --once
header:
  stamp:
    sec: 6
    nanosec: 298000000
  frame_id: imu_link
orientation:
  x: 0.0
  y: 0.0
  z: 0.0
  w: 1.0
orientation_covariance:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
angular_velocity:
  x: 3.674648740750363e-05
  y: -1.5758485404928543e-05
  z: 8.80878528687566e-05
angular_velocity_covariance:
- 4.0e-08
- 0.0
- 0.0
- 0.0
- 4.0e-08
- 0.0
- 0.0
- 0.0
- 4.0e-08
linear_acceleration:
  x: -0.006802633792902658
  y: -0.0074336465388991375
  z: -0.034367962884921444
linear_acceleration_covariance:
- 0.00028900000000000003
- 0.0
- 0.0
- 0.0
- 0.00028900000000000003
- 0.0
- 0.0
- 0.0
- 0.00028900000000000003
---

Here a screenshot from gazebo window with imu_link pose (highlighted with red, z = -1355 meters):

image description

If I update imu_link pose data (by clicking again at imu_link field in gzclient window), then z value is going to be even lower, then it's keeping falling.

In comparison here is a sample of sam_bot imu data (got from First-Time Robot Setup Guide - Setting Up Odometry - Adding Gazebo Plugins to a URDF) (look at linear_acceleration.z value, it is about expected 9.81 value):

$ ros2 topic echo /demo/imu --once
header:
  stamp:
    sec: 61
    nanosec: 838000000
  frame_id: base_link
orientation:
  x: -1.537258480573929e-09
  y: 1.4639308030715501e-05
  z: 0.004202907273712188
  w: 0.9999911676390645
orientation_covariance:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
angular_velocity:
  x: 6.531781238713562e-05
  y: -0.00010195262499235747
  z: 9.86782271776771e-06
angular_velocity_covariance:
- 4.0e-08
- 0.0
- 0.0
- 0.0
- 4.0e-08
- 0.0
- 0.0
- 0.0
- 4.0e-08
linear_acceleration:
  x: -0.09869154506498802
  y: -0.11664874054304436
  z: 9.719326321457395
linear_acceleration_covariance:
- 0.00028900000000000003
- 0.0
- 0.0
- 0.0
- 0.00028900000000000003
- 0.0
- 0.0
- 0.0
- 0.00028900000000000003
---

Gazebo client doesn't show any imu_link with spawned sam_bot (though it's not an issue here):

image description

System description

tb3 config is the same as Nav2 tutorials has the following:

sam_bot config is the same as in Nav2 tutorial:

My distribution is ROS2 Humble with Gazebo 11.10.2. ROS2 Humble installed via sudo apt install ros-humble-desktop as default way of installation. ROS2 Nav2 is installed with sudo apt install as from nav2 getting started:

$ ros2 pkg xml nav2_bringup --tag version
1.1.0

My platform is x86 Ubuntu 22.04, kernel 5.15

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:   jammy

$ uname -a
Linux X512UA 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Update:

iimata's workaround has resolved the issue. Imu sensor is not falling down anymore and /imu message returns expected 9.81 linear_acceleration.z value.

I've done it by adding the gravity field in waffle.model SDF file:

...
<link name="imu_link">
  <gravity>false</gravity>
  <sensor name="tb3_imu" type="imu">
...

But still I'd say that fixed to robot's body imu sensor must not fall down. Why is it happening anyway and how to fix it properly? Is it gazebo bug and I should update gazebo with the newer patched version?


Originally posted by Robotics010 on ROS Answers with karma: 13 on 2022-08-16

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

i was facing this issue with the gazebo depth camera ...

but it is not a ros issue .

try to add ..

<gravity>false</gravity>

below the imu link.

like

<link name="sensor_link">
    <gravity>false</gravity>
    <pose>? ? ? ? ? ? </pose>
</link>

Originally posted by iimata with karma: 40 on 2022-08-17

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Robotics010 on 2022-08-18:
Thanks iimata! Your workaround has resolved the issue. Imu sensor is not falling down anymore and /imu message returns expected 9.81 linear_acceleration.z value.

Comment by iimata on 2022-08-19:
you'r welcome <3

Comment by iimata on 2022-08-19:
u can accept the answer <3

Comment by Robotics010 on 2022-08-19:
But still I'd say that fixed to robot's body imu sensor must not fall down. Why is it happening anyway and how to fix it properly? Is it gazebo bug and I should update gazebo with the newer patched version?

Comment by ljaniec on 2022-08-19:
Maybe it was lack of something like?

<joint name="imu_joint" type="fixed">
  <parent link="base_link"/>
  <child link="imu_link"/>
  <origin xyz="0 0 0.01"/>
</joint>

If you could prepare a MWE repository with your model and launcher we could check it out properly :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.