Gazebo simulated robot imu has erratic movement while stationary
I am trying to perform SLAM mapping using a gazebo simulated robot. I am simulating a velodyne VLP-16 lidar for the point cloud and using the IMU plugin for gazebo.
When I load my robot into the gazebo environment, the /imu/data topic reading fluctuates randomly.
Attempting to map it with LIO-SAM produced this:
The top is the map link, while the one at the bottom is the base link. The robot is stationary in gazebo.
What could be causing it?
edit: echo of the imu data, only took a few data points as nothing changes except the orientation x,y,z values.
<pre>me_id: "base_footprint"
orientation:
x: -0.0004771787200831384
y: -0.004141362131355094
z: -0.012690029209163286
w: 0.9999107883100555
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity:
x: 0.0
y: 0.0
z: 0.0
angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
linear_acceleration:
x: 0.0
y: 0.0
z: 0.0
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---
header:
seq: 32127
stamp:
secs: 246
nsecs: 36000000
frame_id: "base_footprint"
orientation:
x: -0.00047878039731265965
y: -0.004128353785896729
z: -0.01268815748355096
w: 0.9999108650894951
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity:
x: 0.0
y: 0.0
z: 0.0
angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
linear_acceleration:
x: 0.0
y: 0.0
z: 0.0
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---
</pre>
Asked by bc524 on 2022-08-23 02:50:41 UTC
Answers
I've managed to somewhat solve the issue.
In short, the plugin, libgazebo_ros_imu does not play nice with LIO_SAM as it is somehow generating a z-axis acceleration. Switching to libgazebo_ros_imu_sensor worked a lot better. The imu is teetering back and forth between 2 points (which I believe is being caused by another plugin as disabling that plugin made it stable) but no longer creating a bottomless tunnel .
https://github.com/TixiaoShan/LIO-SAM/issues/136
Hope this helps anyone else.
Asked by bc524 on 2022-08-25 04:56:58 UTC
Comments
It looks like LIO_SAM assumes your acceleration data includes gravity. So after it subtracts 9.8 from linear_acceleration.z
, it now thinks your robot is accelerating down the z axis toward negative infinity.
Asked by Mike Scheutzow on 2022-08-25 07:53:23 UTC
Comments
An IMU plugin for this purpose would need to be implemented carefully. Wheeled robots already tend to "vibrate" in gazebo, so if your plugin simply differentiates the instantaneous velocity (to get acceleration), I suspect it is going to produce bad results. Have you looked at the robot's velocity when it is supposedly stationary?
Can you provide a link to the IMU plugin you are using?
Asked by Mike Scheutzow on 2022-08-23 07:32:34 UTC
I'm using the GazeboRosImu as listed in the Gazebo tutorial https://classic.gazebosim.org/tutorials?tut=ros_gzplugins#IMU(GazeboRosImu)
I added it within my robot's urdf file but it isn't linked to any part. Could this be the cause?
Not sure if this is correct, but another ros-answer said to subscribe to /gazebo/model_states/twist to get velocity. Echoed the topic and the output for all the values is 0.
Asked by bc524 on 2022-08-23 20:05:33 UTC
Please edit your description and show us one of these published Imu messages. Copy/paste the text, and format it with the 101010 button.
What Is your
<gaussianNoise>
parameter set to?Asked by Mike Scheutzow on 2022-08-24 16:05:36 UTC
edited my description with the echo of the imu reading.
I have gaussianNoise se at 0.0
Asked by bc524 on 2022-08-24 20:38:45 UTC