| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  | /* ----------------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * GTSAM Copyright 2010, Georgia Tech Research Corporation, | 
					
						
							|  |  |  |  * Atlanta, Georgia 30332-0415 | 
					
						
							|  |  |  |  * All Rights Reserved | 
					
						
							|  |  |  |  * Authors: Frank Dellaert, et al. (see THANKS for the full author list) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * See LICENSE for the license information | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @file    testEquivInertialNavFactor_GlobalVel.h.cpp | 
					
						
							|  |  |  |  * @brief   Unit test for the InertialNavFactor_GlobalVelocity | 
					
						
							|  |  |  |  * @author  Vadim Indelman, Stephen Williams | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-14 05:04:31 +08:00
										 |  |  | #include <gtsam_unstable/slam/EquivInertialNavFactor_GlobalVel.h>
 | 
					
						
							| 
									
										
										
										
											2013-04-10 04:04:10 +08:00
										 |  |  | #include <gtsam/navigation/ImuBias.h>
 | 
					
						
							| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  | #include <gtsam/geometry/Pose3.h>
 | 
					
						
							|  |  |  | #include <gtsam/nonlinear/Values.h>
 | 
					
						
							| 
									
										
										
										
											2013-07-30 07:54:40 +08:00
										 |  |  | #include <gtsam/inference/Key.h>
 | 
					
						
							| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  | #include <gtsam/base/numericalDerivative.h>
 | 
					
						
							|  |  |  | #include <gtsam/base/LieVector.h>
 | 
					
						
							|  |  |  | #include <CppUnitLite/TestHarness.h>
 | 
					
						
							|  |  |  | #include <iostream>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using namespace std; | 
					
						
							|  |  |  | using namespace gtsam; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | TEST( EquivInertialNavFactor_GlobalVel, Constructor) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2013-10-11 01:52:57 +08:00
										 |  |  |   Key poseKey1(11); | 
					
						
							|  |  |  |   Key poseKey2(12); | 
					
						
							|  |  |  |   Key velKey1(21); | 
					
						
							|  |  |  |   Key velKey2(22); | 
					
						
							|  |  |  |   Key biasKey1(31); | 
					
						
							| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // IMU accumulation variables
 | 
					
						
							| 
									
										
										
										
											2013-12-17 05:33:12 +08:00
										 |  |  |   Vector delta_pos_in_t0 = (Vector(3) << 0.0, 0.0, 0.0); | 
					
						
							|  |  |  |   Vector delta_vel_in_t0 = (Vector(3) << 0.0, 0.0, 0.0); | 
					
						
							|  |  |  |   Vector delta_angles = (Vector(3) << 0.0, 0.0, 0.0); | 
					
						
							| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  |   double delta_t = 0.0; | 
					
						
							|  |  |  |   Matrix EquivCov_Overall = zeros(15,15); | 
					
						
							|  |  |  |   Matrix Jacobian_wrt_t0_Overall = eye(15); | 
					
						
							|  |  |  |   imuBias::ConstantBias bias1 = imuBias::ConstantBias(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-11 01:52:57 +08:00
										 |  |  |   // Earth Terms (gravity, etc)
 | 
					
						
							| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  |   Vector3 g(0.0, 0.0, -9.80); | 
					
						
							|  |  |  |   Vector3 rho(0.0, 0.0, 0.0); | 
					
						
							|  |  |  |   Vector3 omega_earth(0.0, 0.0, 0.0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-11 01:52:57 +08:00
										 |  |  |   // IMU Noise Model
 | 
					
						
							|  |  |  |   SharedGaussian imu_model = noiseModel::Gaussian::Covariance(EquivCov_Overall.block(0,0,9,9)); | 
					
						
							| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-11 01:52:57 +08:00
										 |  |  |   // Constructor
 | 
					
						
							|  |  |  |   EquivInertialNavFactor_GlobalVel<Pose3, LieVector, imuBias::ConstantBias> factor( | 
					
						
							| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  |       poseKey1, velKey1, biasKey1, poseKey2, velKey2, | 
					
						
							|  |  |  |           delta_pos_in_t0, delta_vel_in_t0, delta_angles, delta_t, | 
					
						
							| 
									
										
										
										
											2013-05-08 21:23:27 +08:00
										 |  |  |           g, rho, omega_earth, imu_model, Jacobian_wrt_t0_Overall, bias1); | 
					
						
							| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							| 
									
										
										
										
											2013-10-11 01:52:57 +08:00
										 |  |  |   int main() { TestResult tr; return TestRegistry::runAllTests(tr);} | 
					
						
							| 
									
										
										
										
											2013-02-20 05:24:44 +08:00
										 |  |  | /* ************************************************************************* */ |