| 
									
										
										
										
											2016-06-11 08:48:42 +08:00
										 |  |  | class UnaryFactor: public NoiseModelFactor1<Pose2> { | 
					
						
							|  |  |  |   double mx_, my_; ///< X and Y measurements
 | 
					
						
							| 
									
										
										
										
											2022-03-21 01:24:15 +08:00
										 |  |  |    | 
					
						
							| 
									
										
										
										
											2016-06-11 08:48:42 +08:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-01-12 03:43:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Provide access to the Matrix& version of evaluateError:
 | 
					
						
							| 
									
										
										
										
											2023-01-07 08:29:15 +08:00
										 |  |  |   using gtsam::NoiseModelFactor1<Pose2>::evaluateError; | 
					
						
							| 
									
										
										
										
											2023-01-12 03:01:49 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-11 08:48:42 +08:00
										 |  |  |   UnaryFactor(Key j, double x, double y, const SharedNoiseModel& model): | 
					
						
							|  |  |  |     NoiseModelFactor1<Pose2>(model, j), mx_(x), my_(y) {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-07 08:29:15 +08:00
										 |  |  |   Vector evaluateError(const Pose2& q, OptionalMatrixType H) const override { | 
					
						
							| 
									
										
										
										
											2021-03-23 23:13:13 +08:00
										 |  |  |     const Rot2& R = q.rotation(); | 
					
						
							| 
									
										
										
										
											2021-03-23 17:11:19 +08:00
										 |  |  |     if (H) (*H) = (gtsam::Matrix(2, 3) << | 
					
						
							| 
									
										
										
										
											2021-03-23 23:13:13 +08:00
										 |  |  |             R.c(), -R.s(), 0.0, | 
					
						
							|  |  |  |             R.s(), R.c(), 0.0).finished(); | 
					
						
							| 
									
										
										
										
											2016-06-16 01:18:23 +08:00
										 |  |  |     return (Vector(2) << q.x() - mx_, q.y() - my_).finished(); | 
					
						
							| 
									
										
										
										
											2016-06-11 08:48:42 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | }; |