| 
									
										
										
										
											2010-01-17 03:37:17 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  *  @file  pose3SLAM.h | 
					
						
							|  |  |  |  *  @brief: 3D Pose SLAM | 
					
						
							|  |  |  |  *  @authors Frank Dellaert | 
					
						
							|  |  |  |  **/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-20 01:23:19 +08:00
										 |  |  | #include <gtsam/geometry/Pose3.h>
 | 
					
						
							|  |  |  | #include <gtsam/nonlinear/LieConfig.h>
 | 
					
						
							|  |  |  | #include <gtsam/slam/PriorFactor.h>
 | 
					
						
							|  |  |  | #include <gtsam/slam/BetweenFactor.h>
 | 
					
						
							| 
									
										
										
										
											2010-10-09 06:04:47 +08:00
										 |  |  | #include <gtsam/nonlinear/Key.h>
 | 
					
						
							| 
									
										
										
										
											2010-08-20 01:23:19 +08:00
										 |  |  | #include <gtsam/nonlinear/NonlinearEquality.h>
 | 
					
						
							|  |  |  | #include <gtsam/nonlinear/NonlinearFactorGraph.h>
 | 
					
						
							|  |  |  | #include <gtsam/nonlinear/NonlinearOptimizer.h>
 | 
					
						
							| 
									
										
										
										
											2010-01-17 03:37:17 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace gtsam { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Use pose3SLAM namespace for specific SLAM instance
 | 
					
						
							|  |  |  | 	namespace pose3SLAM { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Keys and Config
 | 
					
						
							| 
									
										
										
										
											2010-01-18 03:34:57 +08:00
										 |  |  | 		typedef TypedSymbol<Pose3, 'x'> Key; | 
					
						
							| 
									
										
										
										
											2010-08-24 03:44:17 +08:00
										 |  |  | 		typedef LieConfig<Key> Config; | 
					
						
							| 
									
										
										
										
											2010-01-17 03:37:17 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		/**
 | 
					
						
							|  |  |  | 		 * Create a circle of n 3D poses tangent to circle of radius R, first pose at (R,0) | 
					
						
							|  |  |  | 		 * @param n number of poses | 
					
						
							|  |  |  | 		 * @param R radius of circle | 
					
						
							|  |  |  | 		 * @param c character to use for keys | 
					
						
							|  |  |  | 		 * @return circle of n 3D poses | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		Config circle(size_t n, double R); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Factors
 | 
					
						
							| 
									
										
										
										
											2010-08-24 03:44:17 +08:00
										 |  |  | 		typedef PriorFactor<Config, Key> Prior; | 
					
						
							|  |  |  | 		typedef BetweenFactor<Config, Key> Constraint; | 
					
						
							|  |  |  | 		typedef NonlinearEquality<Config, Key> HardConstraint; | 
					
						
							| 
									
										
										
										
											2010-01-17 03:37:17 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Graph
 | 
					
						
							|  |  |  | 		struct Graph: public NonlinearFactorGraph<Config> { | 
					
						
							| 
									
										
										
										
											2010-01-18 13:38:53 +08:00
										 |  |  | 			void addPrior(const Key& i, const Pose3& p, | 
					
						
							| 
									
										
										
										
											2010-01-23 01:36:57 +08:00
										 |  |  | 					const SharedGaussian& model); | 
					
						
							| 
									
										
										
										
											2010-01-18 13:38:53 +08:00
										 |  |  | 			void addConstraint(const Key& i, const Key& j, const Pose3& z, | 
					
						
							| 
									
										
										
										
											2010-01-23 01:36:57 +08:00
										 |  |  | 					const SharedGaussian& model); | 
					
						
							| 
									
										
										
										
											2010-01-17 03:37:17 +08:00
										 |  |  | 			void addHardConstraint(const Key& i, const Pose3& p); | 
					
						
							|  |  |  | 		}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Optimizer
 | 
					
						
							|  |  |  | 		typedef NonlinearOptimizer<Graph, Config> Optimizer; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} // pose3SLAM
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/**
 | 
					
						
							|  |  |  | 	 * Backwards compatibility | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	typedef pose3SLAM::Config Pose3Config; | 
					
						
							|  |  |  | 	typedef pose3SLAM::Prior Pose3Prior; | 
					
						
							|  |  |  | 	typedef pose3SLAM::Constraint Pose3Factor; | 
					
						
							|  |  |  | 	typedef pose3SLAM::Graph Pose3Graph; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace gtsam
 | 
					
						
							|  |  |  | 
 |