From 3a7a636f0fec52dd39799ca00fe1c62910f01155 Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 17 Feb 2014 10:41:42 -0500 Subject: [PATCH] minor --- .../+imuSimulator/coriolisExample.m | 12 ++++++------ .../+imuSimulator/coriolisTestMonteCarlo.m | 11 +++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/matlab/unstable_examples/+imuSimulator/coriolisExample.m b/matlab/unstable_examples/+imuSimulator/coriolisExample.m index e128dacb4..555ca553e 100644 --- a/matlab/unstable_examples/+imuSimulator/coriolisExample.m +++ b/matlab/unstable_examples/+imuSimulator/coriolisExample.m @@ -60,6 +60,12 @@ if ~exist('externalCoriolisConfiguration', 'var') initialPosition = [0; 1; 0];% initial position in both frames initialVelocity = [0;0;0]; % initial velocity in the rotating frame (ignoring the velocity due to the frame's rotation) end + + if navFrameRotating == 0 + omegaCoriolisIMU = [0;0;0]; + else + omegaCoriolisIMU = omegaRotatingFrame; + end end % From Wikipedia Angular Velocity page, dr/dt = W*r, where r is @@ -72,12 +78,6 @@ angularVelocityTensor = [ 0 -omegaRotatingFrame(3) omegaRot initialVelocityFixedFrame = angularVelocityTensor * initialPosition + initialVelocity; initialVelocityRotatingFrame = initialVelocity; -if navFrameRotating == 0 - omegaCoriolisIMU = [0;0;0]; -else - omegaCoriolisIMU = omegaRotatingFrame; -end - % currentRotatingFrame = Pose3; % rotating frame initially coincides with fixed frame at t=0 currentPoseFixedGT = Pose3(Rot3, Point3(initialPosition)); diff --git a/matlab/unstable_examples/+imuSimulator/coriolisTestMonteCarlo.m b/matlab/unstable_examples/+imuSimulator/coriolisTestMonteCarlo.m index f525a407f..d48abca2c 100644 --- a/matlab/unstable_examples/+imuSimulator/coriolisTestMonteCarlo.m +++ b/matlab/unstable_examples/+imuSimulator/coriolisTestMonteCarlo.m @@ -49,13 +49,24 @@ end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% numTests = 20 for testInd=1:numTests + omegaCoriolisIMU = [0;0;0]; navFrameRotating = 0; accelFixed = 2*rand(3,1)-ones(3,1); imuSimulator.coriolisExample posFinErrorFixed(testInd) = norm(axisPositionsError(:,end))/trajectoryLengthFixedFrameGT*100 rotFinErrorFixed(testInd) = norm(rotationsErrorVectors(:,end)) velFinErrorFixed(testInd) = norm(axisVelocityError(:,end)) + % Run the same initial conditions but navigating in the rotating frame +--> enable coriolis effect by setting:omegaCoriolisIMU = omegaRotatingFrame; + navFrameRotating = 1; + imuSimulator.coriolisExample + posFinErrorRot(testInd) = norm(axisPositionsError(:,end))/trajLen*100 + rotFinErrorRot(testInd) = norm(rotationsErrorVectors(:,end)) + velFinErrorRot(testInd) = norm(axisVelocityError(:,end)) + + % Run the same initial conditions but navigating in the rotating frame +--> disable coriolis effect by setting: omegaCoriolisIMU = [0;0;0]; navFrameRotating = 1; imuSimulator.coriolisExample posFinErrorRot(testInd) = norm(axisPositionsError(:,end))/trajLen*100