7 #ifndef _parameteric_curves_text_file_hpp
8 #define _parameteric_curves_text_file_hpp
17 template <
typename Numeric = double, Eigen::Index Dim = Eigen::Dynamic,
18 typename Point = Eigen::Matrix<Numeric, Dim, 1> >
23 typedef Eigen::Matrix<Numeric, Dim, Eigen::Dynamic>
pos_t;
24 typedef Eigen::Matrix<Numeric, Dim, Eigen::Dynamic>
vel_t;
25 typedef Eigen::Matrix<Numeric, Dim, Eigen::Dynamic>
acc_t;
40 Eigen::VectorXd::Index i = (Eigen::VectorXd::Index)std::floor(t /
timeStep);
45 const std::size_t& order)
const {
46 Eigen::VectorXd::Index i = (Eigen::VectorXd::Index)std::floor(t /
timeStep);
52 std::cerr <<
"Higher order derivatives not supported" << std::endl;
53 return point_t::Zero(
size);
59 Eigen::MatrixXd data =
61 if (data.cols() ==
size) {
62 std::cout << fileName <<
": setting derivatives to zero" << std::endl;
66 }
else if (data.cols() == 2 *
size) {
67 std::cout << fileName <<
": setting second derivative to zero"
72 }
else if (data.cols() == 3 *
size) {
77 std::cout <<
"Unexpected number of columns (expected " <<
size <<
" or "
78 << 2 *
size <<
" or " << 3 *
size <<
", found " << data.cols()
const Eigen::MatrixXd readMatrixFromFile(const std::string &filename)
Definition: file-io.hpp:12
Definition: abstract-curve.hpp:16
Eigen::Matrix< Numeric, 3, 1 > Point
Definition: effector_spline.h:28
double Numeric
Definition: effector_spline.h:26
Represents a curve of dimension Dim is Safe is false, no verification is made on the evaluation of th...
Definition: abstract-curve.hpp:21
time_t t_max
Definition: abstract-curve.hpp:65
time_t t_min
Definition: abstract-curve.hpp:64
Loads curve from file.
Definition: text-file.hpp:19
time_t timeStep
Definition: text-file.hpp:99
Eigen::Matrix< Numeric, Dim, Eigen::Dynamic > vel_t
Definition: text-file.hpp:24
Eigen::Matrix< Numeric, Dim, Eigen::Dynamic > acc_t
Definition: text-file.hpp:25
Eigen::Matrix< Numeric, Dim, Eigen::Dynamic > pos_t
Definition: text-file.hpp:23
acc_t accValues
Definition: text-file.hpp:98
virtual bool loadTextFile(const std::string &fileName)
Definition: text-file.hpp:58
Numeric num_t
Definition: text-file.hpp:22
point_t x_init
Definition: text-file.hpp:95
virtual bool setInitialPoint(const num_t &)
Definition: text-file.hpp:89
virtual bool setInitialPoint(const point_t &)
Definition: text-file.hpp:88
vel_t velValues
Definition: text-file.hpp:97
virtual const point_t operator()(const time_t &t) const
Definition: text-file.hpp:39
virtual const point_t derivate(const time_t &t, const std::size_t &order) const
Definition: text-file.hpp:44
std::size_t size
Definition: text-file.hpp:100
Point point_t
Definition: text-file.hpp:20
AbstractCurve< Numeric, Point > curve_abc_t
Definition: text-file.hpp:27
pos_t posValues
Definition: text-file.hpp:96
Numeric time_t
Definition: text-file.hpp:21
TextFile(const time_t &dt_, const std::size_t &size_)
Constructor.
Definition: text-file.hpp:32
~TextFile()
Destructor.
Definition: text-file.hpp:36
const point_t & getInitialPoint(void) const
Definition: text-file.hpp:91