curve_constraint.h
Go to the documentation of this file.
1 
8 #ifndef _CLASS_CURVE_CONSTRAINT
9 #define _CLASS_CURVE_CONSTRAINT
10 
11 #include <functional>
12 #include <vector>
13 
14 #include "MathDefs.h"
15 #include "serialization/archive.hpp"
16 #include "serialization/eigen-matrix.hpp"
17 
18 namespace ndcurves {
19 template <typename Point>
20 struct curve_constraints : serialization::Serializable {
21  typedef Point point_t;
22  curve_constraints(const size_t dim = 3)
23  : init_vel(point_t::Zero(dim)),
24  init_acc(point_t::Zero(dim)),
25  init_jerk(point_t::Zero(dim)),
26  end_vel(point_t::Zero(dim)),
27  end_acc(point_t::Zero(dim)),
28  end_jerk(point_t::Zero(dim)),
29  dim_(dim) {}
30 
32  : init_vel(other.init_vel),
33  init_acc(other.init_acc),
34  init_jerk(other.init_jerk),
35  end_vel(other.end_vel),
36  end_acc(other.end_acc),
37  end_jerk(other.end_jerk),
38  dim_(other.dim_) {}
39 
43  virtual bool operator==(const curve_constraints& other) const {
44  return dim_ == other.dim_ && init_vel == other.init_vel &&
45  init_acc == other.init_acc && init_jerk == other.init_jerk &&
46  end_vel == other.end_vel && end_acc == other.end_acc &&
47  end_jerk == other.end_jerk;
48  }
49 
53  virtual bool operator!=(const curve_constraints& other) const {
54  return !(*this == other);
55  }
56 
57  virtual ~curve_constraints() {}
64  size_t dim_;
65 
66  // Serialization of the class
68  template <class Archive>
69  void serialize(Archive& ar, const unsigned int version) {
70  if (version) {
71  // Do something depending on version ?
72  }
73  ar& boost::serialization::make_nvp("init_vel", init_vel);
74  ar& boost::serialization::make_nvp("init_acc", init_acc);
75  ar& boost::serialization::make_nvp("init_jerk", init_jerk);
76  ar& boost::serialization::make_nvp("end_vel", end_vel);
77  ar& boost::serialization::make_nvp("end_acc", end_acc);
78  ar& boost::serialization::make_nvp("end_jerk", end_jerk);
79  ar& boost::serialization::make_nvp("dim", dim_);
80  }
81 };
82 } // namespace ndcurves
83 #endif //_CLASS_CUBICZEROVELACC
Definition: bernstein.h:20
Point point_t
Definition: curve_constraint.h:21
friend class boost::serialization::access
Definition: curve_constraint.h:67
curve_constraints(const size_t dim=3)
Definition: curve_constraint.h:22
virtual bool operator==(const curve_constraints &other) const
Check if actual curve_constraints and other are equal.
Definition: curve_constraint.h:43
point_t end_jerk
Definition: curve_constraint.h:63
size_t dim_
Definition: curve_constraint.h:64
curve_constraints(const curve_constraints &other)
Definition: curve_constraint.h:31
point_t init_acc
Definition: curve_constraint.h:59
virtual bool operator!=(const curve_constraints &other) const
Check if actual curve_constraint and other are different.
Definition: curve_constraint.h:53
point_t end_acc
Definition: curve_constraint.h:62
Eigen::Matrix< Numeric, Eigen::Dynamic, 1 > Point
Definition: effector_spline.h:28
void serialize(Archive &ar, const unsigned int version)
Definition: curve_constraint.h:69
point_t init_vel
Definition: curve_constraint.h:58
point_t end_vel
Definition: curve_constraint.h:61
Definition: curve_constraint.h:20
virtual ~curve_constraints()
Definition: curve_constraint.h:57
point_t init_jerk
Definition: curve_constraint.h:60