| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  *  @file  planarSLAM.h | 
					
						
							|  |  |  |  *  @brief: bearing/range measurements in 2D plane | 
					
						
							|  |  |  |  *  @authors Frank Dellaert | 
					
						
							|  |  |  |  **/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-02 06:02:31 +08:00
										 |  |  | #include "BearingRangeFactor.h"
 | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | #include "TupleConfig.h"
 | 
					
						
							|  |  |  | #include "NonlinearEquality.h"
 | 
					
						
							| 
									
										
										
										
											2010-02-19 10:48:47 +08:00
										 |  |  | #include "PriorFactor.h"
 | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | #include "BetweenFactor.h"
 | 
					
						
							|  |  |  | #include "NonlinearFactorGraph.h"
 | 
					
						
							|  |  |  | #include "NonlinearOptimizer.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // We use gtsam namespace for generally useful factors
 | 
					
						
							|  |  |  | namespace gtsam { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Use planarSLAM namespace for specific SLAM instance
 | 
					
						
							|  |  |  | 	namespace planarSLAM { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Keys and Config
 | 
					
						
							| 
									
										
										
										
											2010-01-18 03:34:57 +08:00
										 |  |  | 		typedef TypedSymbol<Pose2, 'x'> PoseKey; | 
					
						
							|  |  |  | 		typedef TypedSymbol<Point2, 'l'> PointKey; | 
					
						
							| 
									
										
										
										
											2010-02-20 08:28:10 +08:00
										 |  |  | 		typedef LieConfig<PoseKey, Pose2> PoseConfig; | 
					
						
							|  |  |  | 		typedef LieConfig<PointKey, Point2> PointConfig; | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | 		typedef PairConfig<PoseKey, Pose2, PointKey, Point2> Config; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Factors
 | 
					
						
							|  |  |  | 		typedef NonlinearEquality<Config, PoseKey, Pose2> Constraint; | 
					
						
							| 
									
										
										
										
											2010-02-19 10:48:47 +08:00
										 |  |  | 		typedef PriorFactor<Config, PoseKey, Pose2> Prior; | 
					
						
							| 
									
										
										
										
											2010-01-18 13:38:53 +08:00
										 |  |  | 		typedef BetweenFactor<Config, PoseKey, Pose2> Odometry; | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | 		typedef BearingFactor<Config, PoseKey, PointKey> Bearing; | 
					
						
							|  |  |  | 		typedef RangeFactor<Config, PoseKey, PointKey> Range; | 
					
						
							| 
									
										
										
										
											2010-04-02 06:02:31 +08:00
										 |  |  | 		typedef BearingRangeFactor<Config, PoseKey, PointKey> BearingRange; | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// Graph
 | 
					
						
							|  |  |  | 		struct Graph: public NonlinearFactorGraph<Config> { | 
					
						
							| 
									
										
										
										
											2010-02-19 10:48:47 +08:00
										 |  |  | 			void addPrior(const PoseKey& i, const Pose2& p, const SharedGaussian& model); | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | 			void addPoseConstraint(const PoseKey& i, const Pose2& p); | 
					
						
							| 
									
										
										
										
											2010-01-18 13:38:53 +08:00
										 |  |  | 			void addOdometry(const PoseKey& i, const PoseKey& j, const Pose2& z, | 
					
						
							| 
									
										
										
										
											2010-01-23 01:36:57 +08:00
										 |  |  | 					const SharedGaussian& model); | 
					
						
							| 
									
										
										
										
											2010-01-18 13:38:53 +08:00
										 |  |  | 			void addBearing(const PoseKey& i, const PointKey& j, const Rot2& z, | 
					
						
							| 
									
										
										
										
											2010-01-23 01:36:57 +08:00
										 |  |  | 					const SharedGaussian& model); | 
					
						
							| 
									
										
										
										
											2010-01-18 13:38:53 +08:00
										 |  |  | 			void addRange(const PoseKey& i, const PointKey& j, double z, | 
					
						
							| 
									
										
										
										
											2010-01-23 01:36:57 +08:00
										 |  |  | 					const SharedGaussian& model); | 
					
						
							| 
									
										
										
										
											2010-01-16 09:16:59 +08:00
										 |  |  | 		}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Optimizer
 | 
					
						
							|  |  |  | 		typedef NonlinearOptimizer<Graph, Config> Optimizer; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} // planarSLAM
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace gtsam
 | 
					
						
							|  |  |  | 
 |