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