definitions.hpp
Go to the documentation of this file.
1 
12 #ifndef STATEOBSERVATIONDEFINITIONSHPP
13 #define STATEOBSERVATIONDEFINITIONSHPP
14 
15 // #define STATEOBSERVATION_VERBOUS_CONSTRUCTORS
16 
17 #include <chrono>
18 #include <deque>
19 #include <stdexcept>
20 #include <vector>
21 
22 #ifdef STATEOBSERVATION_VERBOUS_CONSTRUCTORS
23 # include <iostream>
24 #endif
25 
26 #include <boost/assert.hpp>
27 #include <boost/timer/timer.hpp>
28 
29 #include <Eigen/Core>
30 #include <Eigen/Geometry>
31 
32 #ifndef M_PI
33 # include <boost/math/constants/constants.hpp>
34 # define M_PI boost::math::constants::pi<double>()
35 #endif
36 
37 #include <state-observation/api.h>
38 
39 // basic file operations
40 #include <fstream>
41 
42 namespace stateObservation
43 {
47 template<typename T>
48 struct isEigen
49 {
50  static constexpr bool value = std::is_base_of<Eigen::EigenBase<T>, T>::value;
51 };
52 
55 template<typename T>
56 struct isMatrix : std::false_type
57 {
58 };
59 
60 template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
61 struct isMatrix<Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>> : std::true_type
62 {
63 };
64 
65 template<typename T>
66 struct EigenType : std::enable_if<isEigen<T>::value, T>
67 {
68 };
69 
70 template<typename T>
71 struct MatrixType : std::enable_if<isMatrix<T>::value, T>
72 {
73 };
74 
76 typedef Eigen::VectorXd Vector;
77 
79 typedef Eigen::Matrix<double, 1, 1> Vector1;
80 
82 typedef Eigen::Matrix<double, 2, 1> Vector2;
83 
85 typedef Eigen::Vector3d Vector3;
86 
88 typedef Eigen::Matrix<double, 3, 1, Eigen::DontAlign> Vector3Unaligned;
89 
91 typedef Eigen::Vector4d Vector4;
92 
94 typedef Eigen::Matrix<double, 5, 1> Vector5;
95 
97 typedef Eigen::Matrix<double, 6, 1> Vector6;
98 
100 typedef Eigen::MatrixXd Matrix;
101 
103 typedef Eigen::Matrix<double, 1, 1> Matrix1;
104 
106 typedef Eigen::Matrix2d Matrix2;
107 
109 typedef Eigen::Matrix3d Matrix3;
110 
112 typedef Eigen::Matrix<double, 3, 3, Eigen::DontAlign> Matrix3Unaligned;
113 
115 typedef Eigen::Matrix4d Matrix4;
116 
118 typedef Eigen::Matrix<double, 5, 5> Matrix5;
119 
121 typedef Eigen::Matrix<double, 6, 6> Matrix6;
122 
124 typedef Eigen::Matrix<double, 12, 12> Matrix12;
125 
127 typedef Eigen::Quaterniond Quaternion;
128 
130 typedef Eigen::Quaternion<double, Eigen::DontAlign> QuaternionUnaligned;
131 
133 typedef Eigen::AngleAxis<double> AngleAxis;
134 
136 typedef Eigen::Rotation2D<double> Rotation2D;
137 
139 typedef long int TimeIndex;
140 typedef Index TimeSize;
141 
142 #ifndef NDEBUG
143 static const bool isDebug = true;
144 #else
145 static const bool isDebug = false;
146 #endif // NDEBUG
147 
148 template<int compileTimeRows = -1, int compileTimeCols = -1>
150 {
151 public:
152  template<typename CustomNullaryOp>
153  static const Eigen::CwiseNullaryOp<CustomNullaryOp, typename Eigen::Matrix<double, compileTimeRows, compileTimeCols>>
154  nullaryExp(const CustomNullaryOp & func, Index rows = compileTimeRows, Index cols = compileTimeCols)
155  {
157  (void)rows;
158  (void)cols;
159 
160  return Eigen::Matrix<double, compileTimeRows, compileTimeCols>::NullaryExpr(func);
161  }
162 };
163 
164 template<int compileTimeCols>
165 class FixOrDynMatrixToolsBySize<-1, compileTimeCols>
166 {
167 public:
168  template<typename CustomNullaryOp>
169  static const Eigen::CwiseNullaryOp<CustomNullaryOp, typename Eigen::Matrix<double, -1, compileTimeCols>> nullaryExp(
170  const CustomNullaryOp & func,
171  Index rows = -1,
172  Index cols = compileTimeCols)
173  {
174  return Eigen::Matrix<double, -1, compileTimeCols>::NullaryExpr(rows, cols, func);
175  }
176 };
177 
178 template<int compileTimeRows>
179 class FixOrDynMatrixToolsBySize<compileTimeRows, -1>
180 {
181 public:
182  template<typename CustomNullaryOp>
183  static const Eigen::CwiseNullaryOp<CustomNullaryOp, typename Eigen::Matrix<double, compileTimeRows, -1>> nullaryExp(
184  const CustomNullaryOp & func,
185  Index rows = compileTimeRows,
186  Index cols = -1)
187  {
188  return Eigen::Matrix<double, compileTimeRows, -1>::NullaryExpr(rows, cols, func);
189  }
190 };
191 
192 template<>
194 {
195 public:
196  template<typename CustomNullaryOp>
197  static const Eigen::CwiseNullaryOp<CustomNullaryOp, typename Eigen::Matrix<double, -1, -1>> nullaryExp(
198  const CustomNullaryOp & func,
199  Index rows = -1,
200  Index cols = -1)
201  {
202  return Eigen::Matrix<double, -1, -1>::NullaryExpr(rows, cols, func);
203  }
204 };
205 
206 template<typename MatrixT>
207 class FixOrDynMatrixTools : public FixOrDynMatrixToolsBySize<MatrixType<MatrixT>::type::RowsAtCompileTime,
208  MatrixType<MatrixT>::type::ColsAtCompileTime>
209 {
210 };
211 
214 template<typename T, const T defaultValue = T()>
216 {
217 public:
218  static const T v;
219 };
220 
221 template<typename T, const T defaultValue>
222 const T DebugItemDefaultValue<T, defaultValue>::v = defaultValue;
223 
224 namespace detail
225 {
227 
229 {
233 };
234 
235 template<errorType i = message, int dummy = 0>
237 {
238 };
239 
240 template<int dummy>
242 {
243 public:
244  static const char * v;
245 };
246 
247 template<int dummy>
249 {
250 public:
251  static const std::runtime_error v;
252 };
253 
254 template<int dummy>
256 {
257 public:
258  static const std::runtime_error * v;
259 };
260 
261 template<int dummy>
262 const char * DebugItemDefaultError<message, dummy>::v = "The Object is not initialized. \
263  If this happened during initialization then run command chckitm_set() \
264  to switch it to set. And if the initialization is incomplete, run \
265  chckitm_reset() afterwards.";
266 
267 template<int dummy>
268 const std::runtime_error DebugItemDefaultError<exception, dummy>::v =
269  std::runtime_error(DebugItemDefaultError<message>::v);
270 
271 template<int dummy>
273 
277 
278 void STATE_OBSERVATION_DLLAPI defaultSum(const Vector & stateVector, const Vector & tangentVector, Vector & sum);
279 void STATE_OBSERVATION_DLLAPI defaultDifference(const Vector & stateVector1,
280  const Vector & stateVector2,
281  Vector & difference);
282 
283 } // namespace detail
284 
287 template<typename T, typename defaultValue = DebugItemDefaultValue<T>, bool debug = true>
289 {
290 public:
291  DebugItem() : b_(defaultValue::v) {}
292  explicit DebugItem(const T & v) : b_(v) {}
293  inline T & operator=(T v)
294  {
295  return b_ = v;
296  }
297  inline operator T() const
298  {
299  return b_;
300  }
301  inline T set(const T & v)
302  {
303  return b_ = v;
304  }
305  T get() const
306  {
307  return b_;
308  }
309 
310 private:
311  T b_;
312 };
313 
315 template<typename T, typename defaultValue>
316 class DebugItem<T, defaultValue, false>
317 {
318 public:
320  explicit DebugItem(T) {}
321  inline T & operator=(T v)
322  {
324  return v;
325  }
326  inline operator T() const
327  {
328  return defaultValue::v;
329  }
330  inline T set(const T &)
331  {
332  return defaultValue::v;
333  }
334  T get() const
335  {
336  return defaultValue::v;
337  }
338 
339 private:
341  T b_;
342 };
343 
347 {
348  template<typename T>
349  static bool check(const T &)
350  {
351  return true;
352  }
353  template<typename T>
354  static bool checkAssert(const T &)
355  {
356  return true;
357  }
358  inline static constexpr char errorMessage[] = "";
359  using ExceptionT = std::runtime_error;
360 };
361 
372 template<typename T,
373  bool lazy = false,
374  bool alwaysCheck = false,
375  bool assertion = true,
376  bool eigenAlignedNew = false,
377  typename additionalChecker = EmptyChecker>
379 {
380 public:
382  CheckedItem(bool initialize = true);
383  explicit CheckedItem(const T &);
384  CheckedItem(const CheckedItem &);
385  virtual ~CheckedItem() {}
386 
387  inline CheckedItem & operator=(const CheckedItem &);
388  inline T & operator=(const T &);
389  inline operator T() const;
390  inline operator const T &() const;
391 
392  inline const T & chckitm_getValue() const;
393 
394  inline T & operator()();
395  inline const T & operator()() const;
396 
397  inline T & getRefUnchecked();
398  inline const T & getRefUnchecked() const;
399 
400  inline bool isSet() const;
401  inline void reset();
402 
404  inline void set(bool value);
405 
406  void setAssertMessage(std::string s);
408 
413  inline T & set();
414 
415 protected:
416  static const bool do_check_ = !lazy || isDebug;
417  static const bool do_assert_ = do_check_ && assertion;
418  static const bool do_exception_ = do_check_ && !assertion;
419 
423 
427 
428  bool chckitm_check_() const;
429  T v_;
430 
431 public:
432  EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(eigenAlignedNew)
433 };
434 
436 struct CheckNaN
437 {
438  template<typename T>
439  static bool check(const T & m)
440  {
441  return !m.hasNaN();
442  }
443  template<typename T>
444  static bool checkAssert(const T & m)
445  {
446  BOOST_ASSERT(check(m) && errorMessage);
447  return check(m);
448  }
449  inline static constexpr char errorMessage[] = "Matrix contains a NaN.";
450  using ExceptionT = std::runtime_error;
451 };
452 
459 
468 template<typename MatrixType = Matrix, bool lazy = false>
469 class IndexedMatrixT : protected DebugItem<bool, detail::defaultTrue, !lazy || isDebug>
470 {
472 
473 public:
475  IndexedMatrixT();
476 
478  IndexedMatrixT(const MatrixType & v, TimeIndex k);
479 
481  inline IndexedMatrixT & set(const MatrixType & v, TimeIndex k);
482 
484  inline void set(bool value = true);
485 
487  inline void setIndex(TimeIndex index);
488 
490  inline const MatrixType & operator()() const;
491 
493  inline MatrixType & operator()();
494 
496  inline TimeIndex getTime() const;
497 
499  inline bool isSet() const;
500 
502  inline void reset();
503 
504  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
505 
506 protected:
509  inline bool check_() const;
512 };
513 
518 
526 template<typename MatrixType = Matrix, typename Allocator = std::allocator<MatrixType>>
528 {
529 public:
532 
538 
539  typedef std::vector<MatrixType, Allocator> Array;
540 
544  inline void setValue(const MatrixType & v, TimeIndex k);
545 
547  inline void pushBack(const MatrixType & v);
548 
550  inline void popFront();
551 
553  inline MatrixType operator[](TimeIndex index) const;
554 
556  inline MatrixType & operator[](TimeIndex index);
557 
559  inline const MatrixType & front() const;
560 
562  inline MatrixType & front();
563 
565  inline const MatrixType & back() const;
566 
568  inline MatrixType & back();
569 
571  void truncateAfter(TimeIndex timeIndex);
572 
574  void truncateBefore(TimeIndex timeIndex);
575 
577  inline void resize(TimeSize i, const MatrixType & m = MatrixType());
578 
580  inline TimeIndex getLastIndex() const;
581 
584  inline TimeIndex getNextIndex() const;
585 
587  inline TimeIndex setLastIndex(int index);
588 
590  inline TimeIndex getFirstIndex() const;
591 
593  inline TimeIndex setFirstIndex(int index);
594 
595  inline TimeSize size() const;
596 
599  inline void reset();
600 
602  inline void clear();
603 
605  Array getArray() const;
606 
608  inline bool checkIndex(TimeIndex k) const;
609 
614  void readFromFile(const char * filename, Index rows, Index cols = 1, bool withTimeStamp = true);
615  void readFromFile(const std::string & filename, Index rows, Index cols = 1, bool withTimeStamp = true);
616 
621  void readVectorsFromFile(const std::string & filename, bool withTimeStamp = true);
622  void readVectorsFromFile(const char * filename, bool withTimeStamp = true);
623 
629  void writeInFile(const char * filename, bool clear = false, bool append = false);
630 
636  void writeInFile(const std::string & filename, bool clear = false, bool append = false);
637 
638 protected:
639  typedef std::deque<MatrixType, Allocator> Deque;
640 
643  inline void check_(TimeIndex time) const;
644 
647  inline void check_() const;
648 
651  inline void checkNext_(TimeIndex time) const;
652 
654 
656 };
657 
660 
661 namespace cst
662 {
663 constexpr double gravityConstant = 9.80665;
664 
666 const Vector gravity = gravityConstant * Vector3::UnitZ();
667 
669 constexpr double epsilonAngle = 1e-16;
670 
672 constexpr double epsilon1 = std::numeric_limits<double>::epsilon();
673 
674 } // namespace cst
675 
683 inline bool isApprox(double a, double b, double relativePrecision = cst::epsilon1);
684 
692 inline bool isApproxAbs(double a, double b, double absolutePrecision = cst::epsilon1);
693 
697 
698 namespace tools
699 {
700 struct STATE_OBSERVATION_DLLAPI SimplestStopwatch
701 {
703  using clock = typename std::conditional<std::chrono::high_resolution_clock::is_steady,
704  std::chrono::high_resolution_clock,
705  std::chrono::steady_clock>::type;
706  using time_ns = clock::time_point;
708 
709  inline void start()
710  {
711  startTime = clock::now();
712  }
713 
716  inline double stop()
717  {
718  auto elapsed = clock::now() - startTime;
719  return static_cast<double>(elapsed.count());
720  }
721 };
722 
723 std::string STATE_OBSERVATION_DLLAPI matrixToString(const Matrix & mat);
724 
725 std::string STATE_OBSERVATION_DLLAPI vectorToString(const Vector & v);
726 
727 Matrix STATE_OBSERVATION_DLLAPI stringToMatrix(const std::string & str, Index rows, Index cols);
728 
729 Vector STATE_OBSERVATION_DLLAPI stringToVector(const std::string & str, Index length);
730 
731 Vector STATE_OBSERVATION_DLLAPI stringToVector(const std::string & str);
732 } // namespace tools
733 
734 #include <state-observation/tools/definitions.hxx>
735 } // namespace stateObservation
736 
737 #endif // STATEOBSERVATIONDEFINITIONSHPP
stateObservation::IndexedMatrixT::isSet
bool isSet() const
Says whether the matrix is initialized or not.
stateObservation::Vector
Eigen::VectorXd Vector
Dynamic sized scalar vector.
Definition: definitions.hpp:76
stateObservation::IndexedVector3
IndexedMatrixT< Vector3 > IndexedVector3
Definition: definitions.hpp:516
stateObservation::isMatrix
Checks if a class is a specialization of Eigen::Matrix.
Definition: definitions.hpp:56
stateObservation::CheckedItem::exceptionPtr_
ExceptionPtr exceptionPtr_
Definition: definitions.hpp:426
stateObservation::FixOrDynMatrixToolsBySize::nullaryExp
static const Eigen::CwiseNullaryOp< CustomNullaryOp, typename Eigen::Matrix< double, compileTimeRows, compileTimeCols > > nullaryExp(const CustomNullaryOp &func, Index rows=compileTimeRows, Index cols=compileTimeCols)
Definition: definitions.hpp:154
stateObservation::detail::defaultSum
void STATE_OBSERVATION_DLLAPI defaultSum(const Vector &stateVector, const Vector &tangentVector, Vector &sum)
stateObservation::IndexedMatrixArrayT::setLastIndex
TimeIndex setLastIndex(int index)
Set the time index of the last element.
stateObservation::IndexedMatrixT::set
IndexedMatrixT & set(const MatrixType &v, TimeIndex k)
Set the value of the matrix and the time sample.
stateObservation::IndexedMatrixArrayT::writeInFile
void writeInFile(const char *filename, bool clear=false, bool append=false)
stateObservation::FixOrDynMatrixToolsBySize<-1, -1 >::nullaryExp
static const Eigen::CwiseNullaryOp< CustomNullaryOp, typename Eigen::Matrix< double, -1, -1 > > nullaryExp(const CustomNullaryOp &func, Index rows=-1, Index cols=-1)
Definition: definitions.hpp:197
stateObservation::CheckedItem::set
T & set()
stateObservation::IndexedMatrix3
IndexedMatrixT< Matrix3 > IndexedMatrix3
Definition: definitions.hpp:517
stateObservation::DebugItem< T, defaultValue, false >::DebugItem
DebugItem(T)
Definition: definitions.hpp:320
stateObservation::CheckedItem::ExceptionPtr
DebugItem< const std::exception *, detail::defaultExceptionAddr, do_exception_ > ExceptionPtr
Definition: definitions.hpp:422
stateObservation::Matrix4
Eigen::Matrix4d Matrix4
4x4 Scalar Matrix
Definition: definitions.hpp:115
stateObservation::cpu_timer
boost::timer::cpu_timer cpu_timer
Definition: definitions.hpp:695
stateObservation::CheckedItem::reset
void reset()
stateObservation::IndexedMatrixArrayT::getNextIndex
TimeIndex getNextIndex() const
stateObservation::DebugItemDefaultValue
Definition: definitions.hpp:215
stateObservation::MatrixType
Definition: definitions.hpp:71
stateObservation::isEigen
Checks if it is derived from EigenBase (the base class of all dense functions)
Definition: definitions.hpp:48
stateObservation::Matrix6
Eigen::Matrix< double, 6, 6 > Matrix6
6x6 Scalar Matrix
Definition: definitions.hpp:121
stateObservation::CheckedItem::setAssertMessage
void setAssertMessage(std::string s)
stateObservation::CheckedVector3
CheckedItem< Vector3, false, false, true, true, CheckNaN > CheckedVector3
Definition: definitions.hpp:456
stateObservation::detail::errorType
errorType
Definition: definitions.hpp:228
stateObservation::FixOrDynMatrixToolsBySize
Definition: definitions.hpp:149
stateObservation::CheckedItem::getRefUnchecked
T & getRefUnchecked()
stateObservation::IndexedMatrixT::reset
void reset()
Switch off the initalization flag, the value is no longer accessible.
stateObservation::IndexedMatrixT::getTime
TimeIndex getTime() const
Get the time index.
stateObservation::tools::SimplestStopwatch::clock
typename std::conditional< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock >::type clock
Definition: definitions.hpp:705
stateObservation::detail::defaultDifference
void STATE_OBSERVATION_DLLAPI defaultDifference(const Vector &stateVector1, const Vector &stateVector2, Vector &difference)
stateObservation::CheckedVector6
CheckedItem< Vector6, false, false, true, true, CheckNaN > CheckedVector6
Definition: definitions.hpp:457
stateObservation::CheckedItem::AssertMsg
DebugItem< const char *, detail::defaultErrorMSG, do_assert_ > AssertMsg
Definition: definitions.hpp:421
stateObservation::isApproxAbs
bool isApproxAbs(double a, double b, double absolutePrecision=cst::epsilon1)
checks if two scalars have approximately the same value up to a given absolute precision
stateObservation::CheckedItem::chckitm_getValue
const T & chckitm_getValue() const
stateObservation::isApprox
bool isApprox(double a, double b, double relativePrecision=cst::epsilon1)
checks if two scalars have approximately the same value up to a given relative precision
stateObservation::Vector2
Eigen::Matrix< double, 2, 1 > Vector2
2d Vector
Definition: definitions.hpp:82
stateObservation::Matrix5
Eigen::Matrix< double, 5, 5 > Matrix5
5x5 Scalar Matrix
Definition: definitions.hpp:118
stateObservation::DebugItem< T, defaultValue, false >::set
T set(const T &)
Definition: definitions.hpp:330
stateObservation::detail::message
@ message
Definition: definitions.hpp:230
stateObservation::EigenType
Definition: definitions.hpp:66
stateObservation::IndexedMatrixArrayT::resize
void resize(TimeSize i, const MatrixType &m=MatrixType())
resizes the array
stateObservation::IndexedVector
IndexedMatrixT< Vector > IndexedVector
Definition: definitions.hpp:515
stateObservation::IndexedVectorArray
IndexedMatrixArrayT< Vector > IndexedVectorArray
Definition: definitions.hpp:659
stateObservation::IndexedMatrixArrayT::setValue
void setValue(const MatrixType &v, TimeIndex k)
stateObservation::DebugItem::operator=
T & operator=(T v)
Definition: definitions.hpp:293
stateObservation::IndexedMatrixArrayT::reset
void reset()
stateObservation::cst::gravity
const Vector gravity
Gravity Vector along Z.
Definition: definitions.hpp:666
stateObservation::tools::vectorToString
std::string STATE_OBSERVATION_DLLAPI vectorToString(const Vector &v)
stateObservation::IndexedMatrixArrayT::truncateAfter
void truncateAfter(TimeIndex timeIndex)
removes all the elements with larger indexes than timeIndex
stateObservation::IndexedMatrixArrayT
This class describes a structure that enables to store array of matrices with time indexation.
Definition: definitions.hpp:527
stateObservation::IndexedMatrixArrayT::size
TimeSize size() const
stateObservation::TimeSize
Index TimeSize
Definition: definitions.hpp:140
stateObservation::CheckedItem::operator=
CheckedItem & operator=(const CheckedItem &)
stateObservation::detail::DebugItemDefaultError
Definition: definitions.hpp:236
stateObservation::detail::defaultException
DebugItemDefaultError< exception > defaultException
Definition: definitions.hpp:275
stateObservation::detail::DebugItemDefaultError< exceptionAddr, dummy >::v
static const std::runtime_error * v
Definition: definitions.hpp:258
stateObservation::CheckedItem::do_exception_
static const bool do_exception_
Definition: definitions.hpp:418
stateObservation::IndexedMatrixArrayT::Array
std::vector< MatrixType, Allocator > Array
Definition: definitions.hpp:539
stateObservation::IndexedMatrixArrayT::check_
void check_() const
stateObservation::CheckedItem::isSet
bool isSet() const
stateObservation::IndexedMatrixArrayT::operator[]
MatrixType operator[](TimeIndex index) const
gets the value with the given time index
stateObservation::DebugItem< T, defaultValue, false >::get
T get() const
Definition: definitions.hpp:334
stateObservation::detail::DebugItemDefaultError< message, dummy >::v
static const char * v
Definition: definitions.hpp:244
stateObservation::CheckedItem::isSet_
IsSet isSet_
Definition: definitions.hpp:424
stateObservation::Matrix
Eigen::MatrixXd Matrix
Dynamic sized Matrix.
Definition: definitions.hpp:100
stateObservation::DebugItem
Definition: definitions.hpp:288
stateObservation::Matrix2
Eigen::Matrix2d Matrix2
2D scalar Matrix
Definition: definitions.hpp:106
stateObservation::DebugItem< T, defaultValue, false >::operator=
T & operator=(T v)
Definition: definitions.hpp:321
stateObservation::tools::stringToVector
Vector STATE_OBSERVATION_DLLAPI stringToVector(const std::string &str, Index length)
stateObservation::CheckNaN
Additional checker that allows to check for the presence of NaN values in the item.
Definition: definitions.hpp:436
stateObservation::DebugItem::DebugItem
DebugItem()
Definition: definitions.hpp:291
stateObservation::DebugItem< T, defaultValue, false >::DebugItem
DebugItem()
Definition: definitions.hpp:319
stateObservation::TimeIndex
long int TimeIndex
Definition: definitions.hpp:139
stateObservation::IndexedMatrixT::v_
MatrixType v_
Definition: definitions.hpp:511
stateObservation::CheckedItem::setExceptionPtr
void setExceptionPtr(std::exception *e)
stateObservation::EmptyChecker::check
static bool check(const T &)
Definition: definitions.hpp:349
stateObservation::CheckedMatrix3
CheckedItem< Matrix3, false, false, true, true, CheckNaN > CheckedMatrix3
Definition: definitions.hpp:453
stateObservation::cpu_times
boost::timer::cpu_timer cpu_times
Definition: definitions.hpp:696
stateObservation::IndexedMatrixT::setIndex
void setIndex(TimeIndex index)
set the index of the matrix
stateObservation::DebugItem::get
T get() const
Definition: definitions.hpp:305
stateObservation::Matrix3
Eigen::Matrix3d Matrix3
3x3 Scalar Matrix
Definition: definitions.hpp:109
stateObservation::CheckNaN::checkAssert
static bool checkAssert(const T &m)
Definition: definitions.hpp:444
stateObservation::isEigen::value
static constexpr bool value
Definition: definitions.hpp:50
stateObservation::hrp2::m
constexpr double m
mass of the robot
Definition: hrp2.hpp:36
stateObservation::Vector5
Eigen::Matrix< double, 5, 1 > Vector5
5D vector
Definition: definitions.hpp:94
stateObservation::IndexedMatrixArrayT::checkIndex
bool checkIndex(TimeIndex k) const
checks whether the index is present in the array
stateObservation::DebugItemDefaultValue::v
static const T v
Definition: definitions.hpp:218
stateObservation::IndexedMatrixArrayT::IndexedMatrixArrayT
IndexedMatrixArrayT()
Default constructor.
stateObservation::IndexedMatrixT::check_
bool check_() const
stateObservation::IndexedMatrixArrayT::truncateBefore
void truncateBefore(TimeIndex timeIndex)
removes all the elements with smaller indexes than timeIndex
stateObservation::tools::SimplestStopwatch::start
void start()
Definition: definitions.hpp:709
stateObservation::Vector6
Eigen::Matrix< double, 6, 1 > Vector6
6D vector
Definition: definitions.hpp:97
stateObservation::Index
Eigen::Index Index
Definition: definitions.hpp:138
stateObservation::IndexedMatrixArrayT::back
const MatrixType & back() const
gets the last value
stateObservation::detail::defaultExceptionAddr
DebugItemDefaultError< exceptionAddr > defaultExceptionAddr
Definition: definitions.hpp:276
stateObservation::QuaternionUnaligned
Eigen::Quaternion< double, Eigen::DontAlign > QuaternionUnaligned
Quaternion Unaligned.
Definition: definitions.hpp:130
stateObservation::tools::SimplestStopwatch::stop
double stop()
Definition: definitions.hpp:716
stateObservation::IndexedMatrixT::operator()
const MatrixType & operator()() const
Get the matrix value (const version)
stateObservation::IndexedMatrixArrayT::Deque
std::deque< MatrixType, Allocator > Deque
Definition: definitions.hpp:639
stateObservation::EmptyChecker::errorMessage
static constexpr char errorMessage[]
Definition: definitions.hpp:358
stateObservation::AngleAxis
Eigen::AngleAxis< double > AngleAxis
Euler Axis/Angle representation of orientation.
Definition: definitions.hpp:133
stateObservation::detail::defaultTrue
DebugItemDefaultValue< bool, true > defaultTrue
Definition: definitions.hpp:226
stateObservation::CheckedItem
this is a structure allowing for automatically verifying that the item has been initialized or not....
Definition: definitions.hpp:378
stateObservation::CheckedItem::do_assert_
static const bool do_assert_
Definition: definitions.hpp:417
stateObservation::IndexedMatrixArrayT::clear
void clear()
Clears the vector but keeps the last index.
stateObservation::Vector3Unaligned
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vector3Unaligned
3D vector unaligned
Definition: definitions.hpp:88
stateObservation::auto_cpu_timer
boost::timer::auto_cpu_timer auto_cpu_timer
Definition: definitions.hpp:694
stateObservation::FixOrDynMatrixTools
Definition: definitions.hpp:207
stateObservation::IndexedMatrixArrayT::popFront
void popFront()
removes the first (oldest) element of the array
stateObservation::DebugItem::DebugItem
DebugItem(const T &v)
Definition: definitions.hpp:292
stateObservation::IndexedMatrixArray
IndexedMatrixArrayT< Matrix > IndexedMatrixArray
Definition: definitions.hpp:658
stateObservation::detail::DebugItemDefaultError< exception, dummy >::v
static const std::runtime_error v
Definition: definitions.hpp:251
stateObservation::FixOrDynMatrixToolsBySize< compileTimeRows, -1 >::nullaryExp
static const Eigen::CwiseNullaryOp< CustomNullaryOp, typename Eigen::Matrix< double, compileTimeRows, -1 > > nullaryExp(const CustomNullaryOp &func, Index rows=compileTimeRows, Index cols=-1)
Definition: definitions.hpp:183
stateObservation::CheckedMatrix6
CheckedItem< Matrix6, false, false, true, true, CheckNaN > CheckedMatrix6
Definition: definitions.hpp:454
stateObservation::IndexedMatrix
IndexedMatrixT< Matrix > IndexedMatrix
Definition: definitions.hpp:514
stateObservation::IndexedMatrixArrayT::readVectorsFromFile
void readVectorsFromFile(const std::string &filename, bool withTimeStamp=true)
stateObservation::IndexedMatrixArrayT::front
const MatrixType & front() const
gets the first value
stateObservation::CheckNaN::ExceptionT
std::runtime_error ExceptionT
Definition: definitions.hpp:450
stateObservation::Matrix12
Eigen::Matrix< double, 12, 12 > Matrix12
12x12 scalar Matrix
Definition: definitions.hpp:124
stateObservation::tools::SimplestStopwatch::startTime
time_ns startTime
Definition: definitions.hpp:707
stateObservation::IndexedMatrixArrayT::getArray
Array getArray() const
converts the array into a standard vector
stateObservation::cst::gravityConstant
constexpr double gravityConstant
Definition: definitions.hpp:663
stateObservation::cst::epsilon1
constexpr double epsilon1
number considered zero when compared to 1
Definition: definitions.hpp:672
stateObservation::Matrix3Unaligned
Eigen::Matrix< double, 3, 3, Eigen::DontAlign > Matrix3Unaligned
3x3 Scalar Matrix Unaligned
Definition: definitions.hpp:112
stateObservation::CheckedItem::operator()
T & operator()()
stateObservation::IndexedMatrixArrayT::checkNext_
void checkNext_(TimeIndex time) const
stateObservation::CheckNaN::check
static bool check(const T &m)
Definition: definitions.hpp:439
stateObservation::cst::epsilonAngle
constexpr double epsilonAngle
angles considered Zero
Definition: definitions.hpp:669
stateObservation::EmptyChecker
This structure is used as an additionalChecker for a CheckedItem that doesn't require additional test...
Definition: definitions.hpp:346
stateObservation::detail::defaultErrorMSG
DebugItemDefaultError< message > defaultErrorMSG
Definition: definitions.hpp:274
stateObservation::Vector3
Eigen::Vector3d Vector3
3D vector
Definition: definitions.hpp:85
stateObservation::detail::exceptionAddr
@ exceptionAddr
Definition: definitions.hpp:232
stateObservation::Quaternion
Eigen::Quaterniond Quaternion
Quaternion.
Definition: definitions.hpp:127
stateObservation::CheckedItem::IsSet
DebugItem< bool, detail::defaultTrue, do_check_ > IsSet
Definition: definitions.hpp:420
stateObservation::detail::exception
@ exception
Definition: definitions.hpp:231
stateObservation::Rotation2D
Eigen::Rotation2D< double > Rotation2D
2D rotations
Definition: definitions.hpp:136
stateObservation::CheckedItem::v_
T v_
this can throw(std::exception)
Definition: definitions.hpp:429
stateObservation::IndexedMatrixArrayT::setFirstIndex
TimeIndex setFirstIndex(int index)
set the time index of the first element
stateObservation::IndexedMatrixArrayT::pushBack
void pushBack(const MatrixType &v)
Pushes back the matrix to the array, the new value will take the next time.
stateObservation::tools::SimplestStopwatch::time_ns
clock::time_point time_ns
Definition: definitions.hpp:706
stateObservation::tools::matrixToString
std::string STATE_OBSERVATION_DLLAPI matrixToString(const Matrix &mat)
stateObservation::IndexedMatrixT
This class describes a structure composed by a matrix of a given size and a time-index parameter....
Definition: definitions.hpp:469
stateObservation
Definition: bidim-elastic-inv-pendulum-dyn-sys.hpp:20
stateObservation::CheckedMatrix12
CheckedItem< Matrix12, false, false, true, true, CheckNaN > CheckedMatrix12
Definition: definitions.hpp:455
stateObservation::tools::stringToMatrix
Matrix STATE_OBSERVATION_DLLAPI stringToMatrix(const std::string &str, Index rows, Index cols)
stateObservation::IndexedMatrixArrayT::v_
Deque v_
Definition: definitions.hpp:655
stateObservation::DebugItem::set
T set(const T &v)
Definition: definitions.hpp:301
stateObservation::IndexedMatrixArrayT::k_
TimeIndex k_
Definition: definitions.hpp:653
stateObservation::Vector4
Eigen::Vector4d Vector4
4D vector
Definition: definitions.hpp:91
stateObservation::IndexedMatrixT::IndexedMatrixT
IndexedMatrixT()
Default constructor.
stateObservation::CheckedItem::CheckedItem
CheckedItem(bool initialize=true)
The parameter initialize sets whether the isSet() parameter is initialized to false.
stateObservation::IndexedMatrixArrayT::getFirstIndex
TimeIndex getFirstIndex() const
Get the time index.
stateObservation::CheckedItem::assertMsg_
AssertMsg assertMsg_
Definition: definitions.hpp:425
stateObservation::CheckedItem::do_check_
static const bool do_check_
Definition: definitions.hpp:416
stateObservation::IndexedMatrixT::k_
TimeIndex k_
Definition: definitions.hpp:510
stateObservation::tools::SimplestStopwatch
Definition: definitions.hpp:700
stateObservation::EmptyChecker::ExceptionT
std::runtime_error ExceptionT
Definition: definitions.hpp:359
stateObservation::CheckedItem::chckitm_check_
bool chckitm_check_() const
stateObservation::CheckedItem::~CheckedItem
virtual ~CheckedItem()
Definition: definitions.hpp:385
stateObservation::IndexedMatrixArrayT::getLastIndex
TimeIndex getLastIndex() const
Get the time index.
stateObservation::IndexedMatrixArrayT::readFromFile
void readFromFile(const char *filename, Index rows, Index cols=1, bool withTimeStamp=true)
stateObservation::Matrix1
Eigen::Matrix< double, 1, 1 > Matrix1
1D scalar Matrix
Definition: definitions.hpp:103
stateObservation::FixOrDynMatrixToolsBySize<-1, compileTimeCols >::nullaryExp
static const Eigen::CwiseNullaryOp< CustomNullaryOp, typename Eigen::Matrix< double, -1, compileTimeCols > > nullaryExp(const CustomNullaryOp &func, Index rows=-1, Index cols=compileTimeCols)
Definition: definitions.hpp:169
stateObservation::CheckedQuaternion
CheckedItem< Quaternion, false, false, true, true > CheckedQuaternion
Definition: definitions.hpp:458
stateObservation::Vector1
Eigen::Matrix< double, 1, 1 > Vector1
1D Vector
Definition: definitions.hpp:79
stateObservation::CheckNaN::errorMessage
static constexpr char errorMessage[]
Definition: definitions.hpp:449
stateObservation::EmptyChecker::checkAssert
static bool checkAssert(const T &)
Definition: definitions.hpp:354