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

Wrong dimension for ResidualModelState.set_reference() #1157

Closed
ComePerrot opened this issue Aug 11, 2023 · 1 comment
Closed

Wrong dimension for ResidualModelState.set_reference() #1157

ComePerrot opened this issue Aug 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ComePerrot
Copy link

Hello,

I'm running into a bug when using the set_reference method of ResidualModelState on version 2.0.1:

void crocoddyl::ResidualModelStateTpl<Scalar>::set_reference(const VectorXs&) [with _Scalar = double; crocoddyl::ResidualModelStateTpl<Scalar>::VectorXs = Eigen::Matrix<double, -1, 1>] 151
Invalid argument: the state reference has wrong dimension (63 provided - it should be 62)

The same code was previously running without problems on release 1.9.0.

The dimension of the reference I'm providing doesn't match the one expected by Crocoddyl.
I believe there is an error in the check carried out in file state.hxx.
It should be:
static_cast<std::size_t>(reference.size()) != state_->get_nx()
instead of
static_cast<std::size_t>(reference.size()) != nr_

It fixes the issue in my case, where state_->get_nx() = nr_+1.

I haven't checked the other residuals, but I think this is the only one where this kind of problem would arise.

System

  • OS: Ubuntu 20.04
  • Crocoddyl version: 2.0.1
@ComePerrot ComePerrot added the bug Something isn't working label Aug 11, 2023
@cmastalli
Copy link
Member

Thanks for reporting this bug, @ComePerrot !

Above you can see the PR that solves it.
Need to create some unit test for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants