| 
									
										
										
										
											2013-04-11 06:02:21 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @file testVelocityConstraint3 | 
					
						
							|  |  |  |  * @author Duy-Nguyen Ta | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <CppUnitLite/TestHarness.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-23 01:44:09 +08:00
										 |  |  | #include <gtsam/nonlinear/Symbol.h>
 | 
					
						
							| 
									
										
										
										
											2013-04-11 06:02:21 +08:00
										 |  |  | #include <gtsam_unstable/dynamics/VelocityConstraint3.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | using namespace gtsam; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-23 01:44:09 +08:00
										 |  |  | namespace { | 
					
						
							| 
									
										
										
										
											2013-04-11 06:02:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-23 01:44:09 +08:00
										 |  |  |   const double tol=1e-5; | 
					
						
							|  |  |  |   const double dt = 1.0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   LieScalar origin, | 
					
						
							|  |  |  |     x1(1.0), x2(2.0), v(1.0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2013-04-11 06:02:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | TEST( testVelocityConstraint3, evaluateError) { | 
					
						
							| 
									
										
										
										
											2013-04-23 01:44:09 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   using namespace gtsam::symbol_shorthand; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-11 06:02:21 +08:00
										 |  |  |   // hard constraints don't need a noise model
 | 
					
						
							| 
									
										
										
										
											2013-04-23 01:44:09 +08:00
										 |  |  |   VelocityConstraint3 constraint(X(1), X(2), V(1), dt); | 
					
						
							| 
									
										
										
										
											2013-04-11 06:02:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // verify error function
 | 
					
						
							|  |  |  |   EXPECT(assert_equal(zero(1), constraint.evaluateError(x1, x2, v), tol)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************************************************************* */ | 
					
						
							|  |  |  | int main() { TestResult tr; return TestRegistry::runAllTests(tr); } | 
					
						
							|  |  |  | /* ************************************************************************* */ |