inserted spaces after commas
							parent
							
								
									80187362b8
								
							
						
					
					
						commit
						82f6ed5ca8
					
				| 
						 | 
				
			
			@ -42,20 +42,20 @@
 | 
			
		|||
 | 
			
		||||
namespace gtsam {
 | 
			
		||||
 | 
			
		||||
// ChartValue is derived from GenericValue<T> and CHART so that CHART can be zero sized (as in DefaultChart<T>)
 | 
			
		||||
// if the CHART is a member variable then it won't ever be zero sized.
 | 
			
		||||
template<class T, class CHART=DefaultChart<T> >
 | 
			
		||||
class ChartValue : public GenericValue<T>, public CHART {
 | 
			
		||||
  BOOST_CONCEPT_ASSERT((ChartConcept<CHART>));
 | 
			
		||||
// ChartValue is derived from GenericValue<T> and Chart so that Chart can be zero sized (as in DefaultChart<T>)
 | 
			
		||||
// if the Chart is a member variable then it won't ever be zero sized.
 | 
			
		||||
template<class T, class Chart_=DefaultChart<T> >
 | 
			
		||||
class ChartValue : public GenericValue<T>, public Chart {
 | 
			
		||||
  BOOST_CONCEPT_ASSERT((ChartConcept<Chart_>));
 | 
			
		||||
 public:
 | 
			
		||||
  typedef T type;
 | 
			
		||||
  typedef CHART Chart;
 | 
			
		||||
  typedef Chart_ Chart;
 | 
			
		||||
 | 
			
		||||
 public:
 | 
			
		||||
  ChartValue() : GenericValue<T>(T()) {}
 | 
			
		||||
  ChartValue(const T& value) : GenericValue<T>(value) {}
 | 
			
		||||
  template<typename C>
 | 
			
		||||
  ChartValue(const T& value, C chart_initializer) : GenericValue<T>(value), CHART(chart_initializer) {}
 | 
			
		||||
  ChartValue(const T& value, C chart_initializer) : GenericValue<T>(value), Chart(chart_initializer) {}
 | 
			
		||||
 | 
			
		||||
  virtual ~ChartValue() {}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -96,7 +96,7 @@ class ChartValue : public GenericValue<T>, public CHART {
 | 
			
		|||
 | 
			
		||||
    // Create a Value pointer copy of the result
 | 
			
		||||
    void* resultAsValuePlace = boost::singleton_pool<PoolTag, sizeof(ChartValue)>::malloc();
 | 
			
		||||
    Value* resultAsValue = new(resultAsValuePlace) ChartValue(retractResult, static_cast<const CHART&>(*this));
 | 
			
		||||
    Value* resultAsValue = new(resultAsValuePlace) ChartValue(retractResult, static_cast<const Chart&>(*this));
 | 
			
		||||
 | 
			
		||||
    // Return the pointer to the Value base class
 | 
			
		||||
    return resultAsValue;
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +141,7 @@ private:
 | 
			
		|||
 | 
			
		||||
namespace traits {
 | 
			
		||||
template <typename T, typename Chart>
 | 
			
		||||
struct dimension<ChartValue<T,Chart> > : public dimension<Chart> {};
 | 
			
		||||
struct dimension<ChartValue<T, Chart> > : public dimension<Chart> {};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<typename Chart>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -181,12 +181,12 @@ struct ChartConcept {
 | 
			
		|||
    /**
 | 
			
		||||
     * Returns Retraction update of val_
 | 
			
		||||
     */
 | 
			
		||||
    type retract_ret = C::retract(val_,vec_);
 | 
			
		||||
    type retract_ret = C::retract(val_, vec_);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns local coordinates of another object
 | 
			
		||||
     */
 | 
			
		||||
    vec_ = C::local(val_,retract_ret);
 | 
			
		||||
    vec_ = C::local(val_, retract_ret);
 | 
			
		||||
 | 
			
		||||
    // a way to get the dimension that is compatible with dynamically sized types
 | 
			
		||||
    dim_ = C::getDimension(val_);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -124,7 +124,7 @@ Matrix numericalDerivative11(boost::function<Y(const X&)> h, const X& x,
 | 
			
		|||
  ChartY chartY;
 | 
			
		||||
 | 
			
		||||
  // Bit of a hack for now to find number of rows
 | 
			
		||||
  TangentY zeroY = chartY.local(hx,hx);
 | 
			
		||||
  TangentY zeroY = chartY.local(hx, hx);
 | 
			
		||||
  size_t m = zeroY.size();
 | 
			
		||||
 | 
			
		||||
  // get chart at x
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,19 +65,19 @@ namespace gtsam {
 | 
			
		|||
  };
 | 
			
		||||
  // partial specialized version for ValueType == Value
 | 
			
		||||
  template<class CastedKeyValuePairType, class KeyValuePairType>
 | 
			
		||||
  struct ValuesCastHelper<Value,CastedKeyValuePairType,KeyValuePairType> {
 | 
			
		||||
  struct ValuesCastHelper<Value, CastedKeyValuePairType, KeyValuePairType> {
 | 
			
		||||
    static CastedKeyValuePairType cast(KeyValuePairType key_value) {
 | 
			
		||||
      // Static cast because we already checked the type during filtering
 | 
			
		||||
      // in this case the casted and keyvalue pair are essentially the same type (key,Value&) so perhaps this could be done with just a cast of the key_value?
 | 
			
		||||
      // in this case the casted and keyvalue pair are essentially the same type (key, Value&) so perhaps this could be done with just a cast of the key_value?
 | 
			
		||||
      return CastedKeyValuePairType(key_value.key, key_value.value);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  // partial specialized version for ValueType == Value
 | 
			
		||||
  template<class CastedKeyValuePairType, class KeyValuePairType>
 | 
			
		||||
  struct ValuesCastHelper<const Value,CastedKeyValuePairType,KeyValuePairType> {
 | 
			
		||||
  struct ValuesCastHelper<const Value, CastedKeyValuePairType, KeyValuePairType> {
 | 
			
		||||
    static CastedKeyValuePairType cast(KeyValuePairType key_value) {
 | 
			
		||||
      // Static cast because we already checked the type during filtering
 | 
			
		||||
      // in this case the casted and keyvalue pair are essentially the same type (key,Value&) so perhaps this could be done with just a cast of the key_value?
 | 
			
		||||
      // in this case the casted and keyvalue pair are essentially the same type (key, Value&) so perhaps this could be done with just a cast of the key_value?
 | 
			
		||||
      return CastedKeyValuePairType(key_value.key, key_value.value);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
| 
						 | 
				
			
			@ -302,7 +302,7 @@ namespace gtsam {
 | 
			
		|||
  // overloaded insert with chart initializer
 | 
			
		||||
  template<typename ValueType, typename Chart, typename ChartInit>
 | 
			
		||||
  void Values::insert(Key j, const ValueType& val, ChartInit chart) {
 | 
			
		||||
    insert(j, static_cast<const Value&>(ChartValue<ValueType, Chart>(val,chart)));
 | 
			
		||||
    insert(j, static_cast<const Value&>(ChartValue<ValueType, Chart>(val, chart)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // update with default chart
 | 
			
		||||
| 
						 | 
				
			
			@ -318,7 +318,7 @@ namespace gtsam {
 | 
			
		|||
  // update with chart initializer, /todo: perhaps there is a way to init chart from old value...
 | 
			
		||||
  template<typename ValueType, typename Chart, typename ChartInit>
 | 
			
		||||
  void Values::update(Key j, const ValueType& val, ChartInit chart) {
 | 
			
		||||
    update(j, static_cast<const Value&>(ChartValue<ValueType, Chart>(val,chart)));
 | 
			
		||||
    update(j, static_cast<const Value&>(ChartValue<ValueType, Chart>(val, chart)));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -393,7 +393,7 @@ namespace gtsam {
 | 
			
		|||
    // supplied \c filter function.
 | 
			
		||||
    template<class ValueType>
 | 
			
		||||
    static bool filterHelper(const boost::function<bool(Key)> filter, const ConstKeyValuePair& key_value) {
 | 
			
		||||
      BOOST_STATIC_ASSERT((!std::is_same<ValueType,Value>::value));
 | 
			
		||||
      BOOST_STATIC_ASSERT((!std::is_same<ValueType, Value>::value));
 | 
			
		||||
      // Filter and check the type
 | 
			
		||||
      return filter(key_value.key) && (dynamic_cast<const GenericValue<ValueType>*>(&key_value.value));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ static double inf = std::numeric_limits<double>::infinity();
 | 
			
		|||
using symbol_shorthand::X;
 | 
			
		||||
using symbol_shorthand::L;
 | 
			
		||||
 | 
			
		||||
const Symbol key1('v',1), key2('v',2), key3('v',3), key4('v',4);
 | 
			
		||||
const Symbol key1('v', 1), key2('v', 2), key3('v', 3), key4('v', 4);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TestValueData {
 | 
			
		||||
| 
						 | 
				
			
			@ -76,10 +76,10 @@ TEST( Values, equals1 )
 | 
			
		|||
  Values expected;
 | 
			
		||||
  LieVector v((Vector(3) << 5.0, 6.0, 7.0));
 | 
			
		||||
 | 
			
		||||
  expected.insert(key1,v);
 | 
			
		||||
  expected.insert(key1, v);
 | 
			
		||||
  Values actual;
 | 
			
		||||
  actual.insert(key1,v);
 | 
			
		||||
  CHECK(assert_equal(expected,actual));
 | 
			
		||||
  actual.insert(key1, v);
 | 
			
		||||
  CHECK(assert_equal(expected, actual));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ************************************************************************* */
 | 
			
		||||
| 
						 | 
				
			
			@ -269,7 +269,7 @@ TEST(Values, expmap_d)
 | 
			
		|||
  CHECK(config0.equals(config0));
 | 
			
		||||
 | 
			
		||||
  Values poseconfig;
 | 
			
		||||
  poseconfig.insert(key1, Pose2(1,2,3));
 | 
			
		||||
  poseconfig.insert(key1, Pose2(1, 2, 3));
 | 
			
		||||
  poseconfig.insert(key2, Pose2(0.3, 0.4, 0.5));
 | 
			
		||||
 | 
			
		||||
  CHECK(equal(config0, config0));
 | 
			
		||||
| 
						 | 
				
			
			@ -339,7 +339,7 @@ TEST(Values, update)
 | 
			
		|||
  Values expected;
 | 
			
		||||
  expected.insert(key1, LieVector((Vector(1) << -1.)));
 | 
			
		||||
  expected.insert(key2, LieVector((Vector(1) << -2.)));
 | 
			
		||||
  CHECK(assert_equal(expected,config0));
 | 
			
		||||
  CHECK(assert_equal(expected, config0));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ************************************************************************* */
 | 
			
		||||
| 
						 | 
				
			
			@ -419,9 +419,9 @@ TEST(Values, Symbol_filter) {
 | 
			
		|||
 | 
			
		||||
  Values values;
 | 
			
		||||
  values.insert(X(0), pose0);
 | 
			
		||||
  values.insert(Symbol('y',1), pose1);
 | 
			
		||||
  values.insert(Symbol('y', 1), pose1);
 | 
			
		||||
  values.insert(X(2), pose2);
 | 
			
		||||
  values.insert(Symbol('y',3), pose3);
 | 
			
		||||
  values.insert(Symbol('y', 3), pose3);
 | 
			
		||||
 | 
			
		||||
  int i = 0;
 | 
			
		||||
  BOOST_FOREACH(const Values::Filtered<Value>::KeyValuePair& key_value, values.filter(Symbol::ChrTest('y'))) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,8 +67,8 @@ TEST(Manifold, _dimension) {
 | 
			
		|||
TEST(Manifold, DefaultChart) {
 | 
			
		||||
 | 
			
		||||
  DefaultChart<Point2> chart1;
 | 
			
		||||
  EXPECT(chart1.local(Point2(0, 0), Point2(1,0)) == Vector2(1, 0));
 | 
			
		||||
  EXPECT(chart1.retract(Point2(0, 0), Vector2(1,0)) == Point2(1, 0));
 | 
			
		||||
  EXPECT(chart1.local(Point2(0, 0), Point2(1, 0)) == Vector2(1, 0));
 | 
			
		||||
  EXPECT(chart1.retract(Point2(0, 0), Vector2(1, 0)) == Point2(1, 0));
 | 
			
		||||
 | 
			
		||||
  Vector v2(2);
 | 
			
		||||
  v2 << 1, 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +79,7 @@ TEST(Manifold, DefaultChart) {
 | 
			
		|||
  DefaultChart<double> chart3;
 | 
			
		||||
  Vector v1(1);
 | 
			
		||||
  v1 << 1;
 | 
			
		||||
  EXPECT(assert_equal(v1,chart3.local(0, 1)));
 | 
			
		||||
  EXPECT(assert_equal(v1, chart3.local(0, 1)));
 | 
			
		||||
  EXPECT_DOUBLES_EQUAL(chart3.retract(0, v1), 1, 1e-9);
 | 
			
		||||
 | 
			
		||||
  // Dynamic does not work yet !
 | 
			
		||||
| 
						 | 
				
			
			@ -94,20 +94,20 @@ TEST(Manifold, DefaultChart) {
 | 
			
		|||
  Rot3 I = Rot3::identity();
 | 
			
		||||
  Rot3 R = I.retract(v3);
 | 
			
		||||
  DefaultChart<Rot3> chart5;
 | 
			
		||||
  EXPECT(assert_equal(v3,chart5.local(I, R)));
 | 
			
		||||
  EXPECT(assert_equal(v3, chart5.local(I, R)));
 | 
			
		||||
  EXPECT(assert_equal(chart5.retract(I, v3), R));
 | 
			
		||||
  // Check zero vector
 | 
			
		||||
  DefaultChart<Rot3> chart6;
 | 
			
		||||
  EXPECT(assert_equal(zero(3),chart6.local(R, R)));
 | 
			
		||||
  EXPECT(assert_equal(zero(3), chart6.local(R, R)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ************************************************************************* */
 | 
			
		||||
// zero
 | 
			
		||||
TEST(Manifold, _zero) {
 | 
			
		||||
  EXPECT(assert_equal(Pose3(),traits::zero<Pose3>::value()));
 | 
			
		||||
  EXPECT(assert_equal(Pose3(), traits::zero<Pose3>::value()));
 | 
			
		||||
  Cal3Bundler cal(0, 0, 0);
 | 
			
		||||
  EXPECT(assert_equal(cal,traits::zero<Cal3Bundler>::value()));
 | 
			
		||||
  EXPECT(assert_equal(Camera(Pose3(),cal),traits::zero<Camera>::value()));
 | 
			
		||||
  EXPECT(assert_equal(cal, traits::zero<Cal3Bundler>::value()));
 | 
			
		||||
  EXPECT(assert_equal(Camera(Pose3(), cal), traits::zero<Camera>::value()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ************************************************************************* */
 | 
			
		||||
| 
						 | 
				
			
			@ -115,14 +115,14 @@ TEST(Manifold, _zero) {
 | 
			
		|||
TEST(Manifold, Canonical) {
 | 
			
		||||
 | 
			
		||||
  Canonical<Point2> chart1;
 | 
			
		||||
  EXPECT(chart1.local(Point2(1,0))==Vector2(1,0));
 | 
			
		||||
  EXPECT(chart1.retract(Vector2(1,0))==Point2(1,0));
 | 
			
		||||
  EXPECT(chart1.local(Point2(1, 0))==Vector2(1, 0));
 | 
			
		||||
  EXPECT(chart1.retract(Vector2(1, 0))==Point2(1, 0));
 | 
			
		||||
 | 
			
		||||
  Vector v2(2);
 | 
			
		||||
  v2 << 1, 0;
 | 
			
		||||
  Canonical<Vector2> chart2;
 | 
			
		||||
  EXPECT(assert_equal(v2,chart2.local(Vector2(1,0))));
 | 
			
		||||
  EXPECT(chart2.retract(v2)==Vector2(1,0));
 | 
			
		||||
  EXPECT(assert_equal(v2, chart2.local(Vector2(1, 0))));
 | 
			
		||||
  EXPECT(chart2.retract(v2)==Vector2(1, 0));
 | 
			
		||||
 | 
			
		||||
  Canonical<double> chart3;
 | 
			
		||||
  Eigen::Matrix<double, 1, 1> v1;
 | 
			
		||||
| 
						 | 
				
			
			@ -134,29 +134,29 @@ TEST(Manifold, Canonical) {
 | 
			
		|||
  Point3 point(1, 2, 3);
 | 
			
		||||
  Vector v3(3);
 | 
			
		||||
  v3 << 1, 2, 3;
 | 
			
		||||
  EXPECT(assert_equal(v3,chart4.local(point)));
 | 
			
		||||
  EXPECT(assert_equal(chart4.retract(v3),point));
 | 
			
		||||
  EXPECT(assert_equal(v3, chart4.local(point)));
 | 
			
		||||
  EXPECT(assert_equal(chart4.retract(v3), point));
 | 
			
		||||
 | 
			
		||||
  Canonical<Pose3> chart5;
 | 
			
		||||
  Pose3 pose(Rot3::identity(), point);
 | 
			
		||||
  Vector v6(6);
 | 
			
		||||
  v6 << 0, 0, 0, 1, 2, 3;
 | 
			
		||||
  EXPECT(assert_equal(v6,chart5.local(pose)));
 | 
			
		||||
  EXPECT(assert_equal(chart5.retract(v6),pose));
 | 
			
		||||
  EXPECT(assert_equal(v6, chart5.local(pose)));
 | 
			
		||||
  EXPECT(assert_equal(chart5.retract(v6), pose));
 | 
			
		||||
 | 
			
		||||
  Canonical<Camera> chart6;
 | 
			
		||||
  Cal3Bundler cal0(0, 0, 0);
 | 
			
		||||
  Camera camera(Pose3(), cal0);
 | 
			
		||||
  Vector z9 = Vector9::Zero();
 | 
			
		||||
  EXPECT(assert_equal(z9,chart6.local(camera)));
 | 
			
		||||
  EXPECT(assert_equal(chart6.retract(z9),camera));
 | 
			
		||||
  EXPECT(assert_equal(z9, chart6.local(camera)));
 | 
			
		||||
  EXPECT(assert_equal(chart6.retract(z9), camera));
 | 
			
		||||
 | 
			
		||||
  Cal3Bundler cal; // Note !! Cal3Bundler() != zero<Cal3Bundler>::value()
 | 
			
		||||
  Camera camera2(pose, cal);
 | 
			
		||||
  Vector v9(9);
 | 
			
		||||
  v9 << 0, 0, 0, 1, 2, 3, 1, 0, 0;
 | 
			
		||||
  EXPECT(assert_equal(v9,chart6.local(camera2)));
 | 
			
		||||
  EXPECT(assert_equal(chart6.retract(v9),camera2));
 | 
			
		||||
  EXPECT(assert_equal(v9, chart6.local(camera2)));
 | 
			
		||||
  EXPECT(assert_equal(chart6.retract(v9), camera2));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ************************************************************************* */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue