Skip to content

Commit

Permalink
Merge branch 'master' of github.com:proyan/parametric-curves into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed Dec 13, 2019
2 parents 84505dc + 3f811bb commit 8712870
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions include/parametric-curves/text-file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,33 @@ struct TextFile : public AbstractCurve<Numeric, Point> {
public:
virtual bool loadTextFile(const std::string& fileName) {
Eigen::MatrixXd data = parametriccurves::utils::readMatrixFromFile(fileName);
if (data.cols() != 3 * size) {
std::cout << "Unexpected number of columns (expected " << 3 * size << ", found " << data.cols() << ")\n";
if(data.cols()==size)
{
std::cout<<"Setting derivatives to zero"<<std::endl;
posValues = data;
velValues.setZero(size);
accValues.setZero(size);
}
else if (data.cols()==2*size)
{
posValues = data.leftCols(size);
velValues = data.rightCols(size);
accValues = accValues.setZero(size);
}
else if (data.cols()==3*size)
{
posValues = data.leftCols(size);
velValues = data.middleCols(size,size);
accValues = data.rightCols(size);
}
else
{
std::cout<<"Unexpected number of columns (expected "<<3*size<<", found "<<data.cols()<<")\n";
return false;
}

this->t_max = timeStep * (double)data.rows();
this->t_max = timeStep*(double)data.rows();
this->t_min = 0.0;

posValues = data.leftCols(size);
velValues = data.middleCols(size, size);
accValues = data.rightCols(size);

x_init = posValues.row(0);

return true;
}

Expand Down

0 comments on commit 8712870

Please sign in to comment.