I am using the matlab R2018b sensor fusion toolbox to create acceleration and angular velocity measurements from a trajectory I created (expressed in NED coordinates). After creating the trajectory with the toolbox I obtain the measurements with:
[accelMeas,gyroMeas] = imu(acc,angVel,ori);
where acc, angVel and ori were obtained from the trajectory generation. The data seemed to make sense but then I tested it by rotating the measurements values from the sensor frame to the NED frame by doing this, as I inferred from reading the documentation:
accNED = rotatepoint(ori, accelMeas);
this gives me a vector that is identical to "acc" (the actual acceleration in the NED frame from which i started), but all the components have the opposite sign!!
I am trying to figure out why this would happen! Moreover, can someone explain to me how the sensor reference frame is oriented with respect to the heading of the sensor itself?
And it turns out I am doing everything right and quaternion rotation works perfectly.
So the problem is the following: I rotate the NED frame acceleration to the IMU body frame according to the orientation of the NED with respecto to the IMU body, expecting to get exactly the measured acceleration (accelMeas, see above). BUT it gives me the opposite of accelMeas!
So I think the measurements I get from the toolbox are wrong: if i invert the sign of x and y, leaving z as is, and repeat the whole procedure I get a perfect match! Is it possible that imu(acc,angVel,ori) is giving me a result with wrong sign?