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

[core] Do not enforce configuration bounds at init for spring-damper contact model. #654

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions core/src/engine/EngineMultiRobot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1128,14 +1128,21 @@ namespace jiminy
return hresult_t::ERROR_BAD_INPUT;
}

// Note that EPS allows to be very slightly out-of-bounds
if ((system.robot->mdlOptions_->joints.enablePositionLimit &&
/* Check that the initial configuration is not out-of-bounds if appropriate
Note that EPS allows to be very slightly out-of-bounds, which may occurs because of rounding errors. */
if ((system.robot->mdlOptions_->joints.enablePositionLimit && (contactModel_ == contactModel_t::CONSTRAINT) &&
((EPS < q.array() - system.robot->getPositionLimitMax().array()).any() ||
(EPS < system.robot->getPositionLimitMin().array() - q.array()).any())) ||
(system.robot->mdlOptions_->joints.enableVelocityLimit &&
(EPS < v.array().abs() - system.robot->getVelocityLimit().array()).any()))
(EPS < system.robot->getPositionLimitMin().array() - q.array()).any())))
{
PRINT_ERROR("The initial configuration or velocity is out-of-bounds for system '", system.name, "'.");
PRINT_ERROR("The initial configuration is out-of-bounds for system '", system.name, "'.");
return hresult_t::ERROR_BAD_INPUT;
}

// Check that the initial velocity is not out-of-bounds
if ((system.robot->mdlOptions_->joints.enableVelocityLimit &&
(system.robot->getVelocityLimit().array() < v.array().abs()).any()))
{
PRINT_ERROR("The initial velocity is out-of-bounds for system '", system.name, "'.");
return hresult_t::ERROR_BAD_INPUT;
}

Expand Down