microstrain_3dmgx2_imu confirmity to ROS spec
I've seen slightly similar questions regarding this node before (though I'm having trouble finding them now), but I wanted to put all of my findings in one place so I can hopefully get a definitive answer.
REP-103 states that the coordinate frames should be right-handed. By default, the 3DM-GX2 is right-handed, but is upside-down (with Z pointing into the ground), and so, according to the package's page,
The orientation matrix is the transpose of the orientation matrix returned by the hardware, rotated 180 degrees around the y axis. This corresponds to a transformation from the IMU frame to the world frame, with the z axis point up.
This causes the absolute orientation measurements to increase in the correct directions, but:
- When I expect the IMU to read 0 heading (at magnetic north), it reads pi.
- When I expect the IMU to read 0 roll (laying flat on a surface, with the logo facing up), it reads pi.
- Rotating the sensor counter-clockwise (i.e., in the positive direction) causes the yaw angle to increase correctly, but the yaw velocity is reported as negative.
- Pitching the sensor down (i.e., with the serial port moving towards the floor) causes the absolute pitch angle to increase correctly, but the pitch velocity is reported as negative.
- When the sensor is flat on a table (as in 2 above), the yaw angle increases when I turn counter-clockwise, indicating that the Z-axis is meant to point up, thus agreeing with the wiki. In that case, the measured linear acceleration, which should be in the direction opposite the gravity force vector (i.e., parallel to the normal force vector), should be positive. It is negative.
- If I assume the X-axis projects directly out the front of the sensor (through the serial port), then positive rotation would point the Y axis up away from the ground. In that configuration, the Y linear acceleration should also be positive. It is negative.
My questions are:
(A) Has anyone else had these issues, or is there something wrong with my sensor (or me!)?
(B) If I'm not the only one, is this working as intended, or are these bugs?
(C) Does the node attempt to correct the direction of angular increase only? In other words, by default, the sensor's axes have Z down and Y projecting to the right. This is still right-handed, but in order to get the Z-axis up and remain right-handed, all we'd have to do is invert the signs of yaw, yaw velocity, pitch, pitch velocity, Z acceleration, and Y acceleration as read straight from the sensor.
(D) Would it be possible to add a flag to the node that does everything in (C) instead of what's being done in the package's description excerpt above? I'm happy to add an issue to the repo and submit a PR against it if others would find it useful and the authors would want it that way.
I have the orientation quaternion, how can I transform?