| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @file ilm3DSystem.cpp | 
					
						
							|  |  |  |  * @brief Implementations of ilm 3D domain | 
					
						
							|  |  |  |  * @author Alex Cunningham | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:25 +08:00
										 |  |  | #include <gtsam_unstable/dynamics/imuSystem.h>
 | 
					
						
							| 
									
										
										
										
											2012-05-16 02:13:37 +08:00
										 |  |  | #include <gtsam/nonlinear/LevenbergMarquardtOptimizer.h>
 | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace imu { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using namespace gtsam; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | void Graph::addPrior(Key key, const PoseRTV& pose, const SharedNoiseModel& noiseModel) { | 
					
						
							| 
									
										
										
										
											2012-06-10 03:17:15 +08:00
										 |  |  | 	add(Prior(key, pose, noiseModel)); | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | void Graph::addConstraint(Key key, const PoseRTV& pose) { | 
					
						
							| 
									
										
										
										
											2012-06-10 03:17:15 +08:00
										 |  |  | 	add(Constraint(key, pose)); | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | void Graph::addHeightPrior(Key key, double z, const SharedNoiseModel& noiseModel) { | 
					
						
							| 
									
										
										
										
											2012-06-10 03:17:15 +08:00
										 |  |  | 	add(DHeightPrior(key, z, noiseModel)); | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | void Graph::addFullIMUMeasurement(Key key1, Key key2, | 
					
						
							|  |  |  | 		const Vector& accel, const Vector& gyro, double dt, const SharedNoiseModel& noiseModel) { | 
					
						
							| 
									
										
										
										
											2012-06-10 03:17:15 +08:00
										 |  |  | 	add(FullIMUMeasurement(accel, gyro, dt, key1, key2, noiseModel)); | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | void Graph::addIMUMeasurement(Key key1, Key key2, | 
					
						
							|  |  |  | 		const Vector& accel, const Vector& gyro, double dt, const SharedNoiseModel& noiseModel) { | 
					
						
							| 
									
										
										
										
											2012-06-10 03:17:15 +08:00
										 |  |  | 	add(IMUMeasurement(accel, gyro, dt, key1, key2, noiseModel)); | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | void Graph::addVelocityConstraint(Key key1, Key key2, double dt, const SharedNoiseModel& noiseModel) { | 
					
						
							| 
									
										
										
										
											2012-06-10 03:17:15 +08:00
										 |  |  | 	add(VelocityConstraint(key1, key2, dt, noiseModel)); | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | void Graph::addBetween(Key key1, Key key2, const PoseRTV& z, const SharedNoiseModel& noiseModel) { | 
					
						
							| 
									
										
										
										
											2012-06-10 03:17:15 +08:00
										 |  |  | 	add(Between(key1, key2, z, noiseModel)); | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | void Graph::addRange(Key key1, Key key2, double z, const SharedNoiseModel& noiseModel) { | 
					
						
							| 
									
										
										
										
											2012-06-10 03:17:15 +08:00
										 |  |  | 	add(Range(key1, key2, z, noiseModel)); | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | Values Graph::optimize(const Values& init) const { | 
					
						
							| 
									
										
										
										
											2012-05-16 02:13:37 +08:00
										 |  |  |   return LevenbergMarquardtOptimizer(*this, init).optimize(); | 
					
						
							| 
									
										
										
										
											2012-05-04 01:03:16 +08:00
										 |  |  | } | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // \namespace imu
 | 
					
						
							|  |  |  | 
 |