2014-01-29 01:19:25 +08:00
|
|
|
function [ finalPose, finalVelocityGlobal ] = integrateIMUTrajectory_bodyFrame( ...
|
|
|
|
initialPoseGlobal, initialVelocityGlobal, acc_omegaIMU, deltaT, velocity1Body)
|
|
|
|
|
|
|
|
% Before integrating in the body frame we need to compensate for the Coriolis
|
|
|
|
% effect
|
2020-08-18 02:37:12 +08:00
|
|
|
acc_body = acc_omegaIMU(1:3) - Point3(cross(acc_omegaIMU(4:6), velocity1Body));
|
2014-01-29 01:19:25 +08:00
|
|
|
% after compensating for coriolis this will be essentially zero
|
|
|
|
% since we are moving at constant body velocity
|
|
|
|
|
|
|
|
import gtsam.*;
|
|
|
|
%% Integrate in the body frame
|
|
|
|
% Integrate rotations
|
|
|
|
imu2in1 = Rot3.Expmap(acc_omegaIMU(4:6) * deltaT);
|
|
|
|
% Integrate positions
|
|
|
|
finalPositionBody = velocity1Body * deltaT + 0.5 * acc_body * deltaT * deltaT;
|
|
|
|
finalVelocityBody = velocity1Body + acc_body * deltaT;
|
|
|
|
|
|
|
|
%% Express the integrated quantities in the global frame
|
2020-08-18 02:37:12 +08:00
|
|
|
finalVelocityGlobal = initialVelocityGlobal + (initialPoseGlobal.rotation().rotate(Point3(finalVelocityBody)) );
|
|
|
|
finalPosition = initialPoseGlobal.translation() + initialPoseGlobal.rotation().rotate( Point3(finalPositionBody)) ;
|
2014-01-29 01:19:25 +08:00
|
|
|
finalRotation = initialPoseGlobal.rotation.compose(imu2in1);
|
|
|
|
% Include position and rotation in a pose
|
|
|
|
finalPose = Pose3(finalRotation, Point3(finalPosition) );
|
|
|
|
|
|
|
|
end
|
|
|
|
|