Curves
A library for curves generation.
LinearInterpolationVectorSpaceCurve.hpp
Go to the documentation of this file.
1 /*
2 
3  * @file LinearInterpolationVectorSpaceCurve-Inl.hpp
4  * @date Oct 31, 2014
5  * @author Renaud Dube
6 
7 
8 #ifndef CURVES_LINEAR_INTERPOLATION_VECTOR_SPACE_CURVE_HPP
9 #define CURVES_LINEAR_INTERPOLATION_VECTOR_SPACE_CURVE_HPP
10 
11 #include "VectorSpaceCurve.hpp"
12 #include "LocalSupport2CoefficientManager.hpp"
13 #include "gtsam/nonlinear/NonlinearFactorGraph.h"
14 
15 namespace curves {
16 template<int N>
17 class LinearInterpolationVectorSpaceCurve : public VectorSpaceCurve<N> {
18  public:
19  typedef VectorSpaceCurve<N> Parent;
20  typedef typename Parent::ValueType ValueType;
21  typedef typename Parent::DerivativeType DerivativeType;
22 
24  LinearInterpolationVectorSpaceCurve();
25  virtual ~LinearInterpolationVectorSpaceCurve();
26 
28  virtual void print(const std::string& str = "") const;
29 
31  virtual Time getMinTime() const;
32 
34  virtual Time getMaxTime() const;
35 
39  virtual void extend(const std::vector<Time>& times,
40  const std::vector<ValueType>& values,
41  std::vector<Key>* outKeys = NULL);
42 
47  virtual void fitCurve(const std::vector<Time>& times,
48  const std::vector<ValueType>& values,
49  std::vector<Key>* outKeys = NULL);
50 
52  virtual ValueType evaluate(Time time) const;
53 
61  virtual DerivativeType evaluateDerivative(Time time, unsigned derivativeOrder) const;
62 
64  virtual gtsam::Expression<ValueType> getValueExpression(const Time& time) const;
65 
66  virtual gtsam::Expression<DerivativeType> getDerivativeExpression(const Time& time, unsigned derivativeOrder) const;
67 
69  virtual void initializeGTSAMValues(gtsam::KeySet keys, gtsam::Values* values) const;
70 
72  virtual void initializeGTSAMValues(gtsam::Values* values) const;
73 
74  // updates the relevant curve coefficients from the GTSAM values structure
75  virtual void updateFromGTSAMValues(const gtsam::Values& values);
76 
77  virtual void clear();
78 
79  void addPriorFactors(gtsam::NonlinearFactorGraph* graph, Time priorTime) const;
80 
82  void transformCurve(const ValueType T);
83 
84  virtual Time getTimeAtKey(gtsam::Key key) const;
85 
86  private:
87  typedef Eigen::Matrix<double,N,1> Coefficient;
88  typedef typename LocalSupport2CoefficientManager<Coefficient>::TimeToKeyCoefficientMap TimeToKeyCoefficientMap;
89  typedef typename LocalSupport2CoefficientManager<Coefficient>::CoefficientIter CoefficientIter;
90  LocalSupport2CoefficientManager<Coefficient> manager_;
91 };
92 
93 } // namespace curves
94 
95 #include "LinearInterpolationVectorSpaceCurve-inl.hpp"
96 
97 #endif CURVES_LINEAR_INTERPOLATION_VECTOR_SPACE_CURVE_HPP
98 */