Sorry - couldn’t resist the bad pun.
I’ve been exploring using the DI IMU with ROS. There is a ROS driver (IMU-sensor.py). The weird thing is that the driver publishes its own transform between “world” and “IMU”. This transform seems to override the transform between the IMU and base_link that is generated by the robot_state_publisher based on the URDF. At first I thought this was a frame naming issue, but it didn’t matter if I called it “imu_link” (as suggested by REP 145) in the URDF, and named the frames that way in the ROS driver, or if I kept “IMU” in the driver and changed my link name in the URDF. Regardless - if I wasn’t running the IMU driver I had my transform between the IMU and base_link, and if I was running the driver that would disappear, and instead there was a transform between the IMU and “world”
The other thing I noticed is that the axes were all backwards. Just sitting flat I get:
linear_acceleration:
x: 0.09
y: 0.06
z: 9.72
But since Z is supposed to be point up, I expected gravity to show about -9.8 on the z-axis. If I tilt the robot forward I expect positive X acceleration, but I get negative. Likewise if I tilt the robot left, that should be positive y-axis acceleration, but I get negative. As a refresher, the mount looks like:
I could tweak the driver, but that’s a bummer. Not sure why this is. I didn’t try to see if the magnetometer data was similarly backwards.
I may come back to messing with this, but I’m somewhat dissuaded because I keep getting errors: grove_i2c_transfer error: Timeout waiting for data
. If I’m just running the imu alone, I have no issues. But if I’m running the lidar, etc, I get this regularly and have to relaunch the IMU. So for some reason the driver just can’t keep up.
Getting back to the first paragraph - I thought about commenting out the lines the publish the transform between “IMU” and “world” (making sure first that I’m using the same name consistently (either “IMU” or “imu_link”) for both the URDF and the driver and seeing what things look like. But since the driver keeps crashing, trying to figure out the IMU just doesn’t seem like a productive avenue. I’ve decided that this was a somewhat educational, but ultimately non-productive detour in improving my localization. Maybe I’ll come back to it later, but for now I’ll get back to working on other optimizations.
/K