Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parametrizer->dof() returns undefined value #231

Open
maxpla3 opened this issue Apr 20, 2023 · 1 comment
Open

parametrizer->dof() returns undefined value #231

maxpla3 opened this issue Apr 20, 2023 · 1 comment

Comments

@maxpla3
Copy link

maxpla3 commented Apr 20, 2023

Calling parametrizer->dof() returns undefined value.

GeometricPathPtr geo_path       = std::make_shared<ToppRaGeometricPathWrapper>(path);
LinearConstraintPtrs lin_constr = FromConstraints(constraints);
algorithm::TOPPRA toppra_algo   = algorithm::TOPPRA(lin_constr, geo_path);

int dof_test_1 = geo_path->dof(); // yields 4

toppra_algo.computePathParametrization(0, 0);
const Vector& gridpoints = toppra_algo.getParameterizationData().gridpoints;
const Vector& vsquared   = toppra_algo.getParameterizationData().parametrization;

parametrizer_ = std::make_shared<parametrizer::ConstAccel>(geo_path, gridpoints, vsquared);

int dof_test_2 = geo_path->dof(); // yields -842150451

dof_test_1 equals 4 (correct value in the test scenario)

dof_test_2 equals -842150451

@maxpla3
Copy link
Author

maxpla3 commented Apr 20, 2023

Solutions:

Either override
int GeometricPath::dof() const { return m_dof; }
with
int Parametrizer::dof() const { return m_path->dof(); }

or (probably better, since this prevents uninitialized values) add

m_dof = path->dof();
m_configSize = path->configSize();

in the constructor Parametrizer(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant