Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 4, 2023
1 parent 91311af commit 32a6347
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
4 changes: 3 additions & 1 deletion include/hpp/core/continuous-validation.hh
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ class HPP_CORE_DLLAPI ContinuousValidation : public PathValidation,
void breakDistance(value_type distance);

/// TODO
value_type distanceLowerBoundThreshold() const { return distanceLowerBoundThr_; }
value_type distanceLowerBoundThreshold() const {
return distanceLowerBoundThr_;
}

/// TODO
void distanceLowerBoundThreshold(value_type distance);
Expand Down
3 changes: 2 additions & 1 deletion include/hpp/core/path-optimization/quadratic-program.hh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ struct QuadraticProgram {
/// \param ce equality constraints
/// \param ci inequality constraints: \f$ ci.J * x \ge ci.b \f$
/// \note \ref computeLLT must have been called before.
double solve(const LinearConstraint& ce, const LinearConstraint& ci, bool& ok);
double solve(const LinearConstraint& ce, const LinearConstraint& ci,
bool& ok);

/// \}

Expand Down
6 changes: 4 additions & 2 deletions src/continuous-validation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ void ContinuousValidation::removeObstacleFromJoint(
void ContinuousValidation::breakDistance(value_type distance) {
assert(distance >= 0);
if (distance <= distanceLowerBoundThr_) {
throw std::invalid_argument("Break distance must be strictly greater than "
throw std::invalid_argument(
"Break distance must be strictly greater than "
"the distance lower bound threshold.");
}
breakDistance_ = distance;
Expand All @@ -272,7 +273,8 @@ void ContinuousValidation::breakDistance(value_type distance) {
void ContinuousValidation::distanceLowerBoundThreshold(value_type distance) {
assert(distance >= 0);
if (distance >= breakDistance_) {
throw std::invalid_argument("Distance lower bound threshold must be "
throw std::invalid_argument(
"Distance lower bound threshold must be "
"strictly smaller than the break distance.");
}
distanceLowerBoundThr_ = distance;
Expand Down
3 changes: 1 addition & 2 deletions src/path-optimization/quadratic-program.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ void QuadraticProgram::computeLLT() {
}

double QuadraticProgram::solve(const LinearConstraint& ce,
const LinearConstraint& ci,
bool& ok) {
const LinearConstraint& ci, bool& ok) {
if (ce.J.rows() > ce.J.cols())
throw std::runtime_error(
"The QP is over-constrained. QuadProg cannot handle it.");
Expand Down
3 changes: 1 addition & 2 deletions src/path-optimization/spline-gradient-based.cc
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,7 @@ PathVectorPtr_t SplineGradientBased<_PB, _SO>::optimize(
QPc.computeLLT();
bool qpSolved;
QPc.solve(collisionReduced, boundConstraintReduced, qpSolved);
if (!qpSolved)
return this->buildPathVector(splines);
if (!qpSolved) return this->buildPathVector(splines);

while (!(noCollision && minimumReached) && !this->shouldStop()) {
// 6.1
Expand Down
12 changes: 6 additions & 6 deletions tests/test-continuous-validation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ using hpp::core::CollisionValidation;
using hpp::core::Configuration_t;
using hpp::core::ConfigurationShooterPtr_t;
using hpp::core::ConfigValidationPtr_t;
using hpp::core::value_type;
using hpp::core::matrix_t;
using hpp::core::PathPtr_t;
using hpp::core::PathValidationPtr_t;
Expand All @@ -70,11 +69,12 @@ using hpp::core::ProblemPtr_t;
using hpp::core::size_type;
using hpp::core::SteeringMethodPtr_t;
using hpp::core::ValidationReportPtr_t;
using hpp::core::value_type;
using hpp::core::vector_t;
using hpp::core::configurationShooter::Uniform;
using hpp::core::continuousCollisionChecking::Progressive;
using hpp::core::continuousValidation::Dichotomy;
using hpp::core::continuousValidation::DichotomyPtr_t;
using hpp::core::continuousCollisionChecking::Progressive;
using hpp::core::pathValidation::createDiscretizedCollisionChecking;
using hpp::core::steeringMethod::Straight;

Expand Down Expand Up @@ -497,22 +497,22 @@ BOOST_AUTO_TEST_CASE(avoid_infinite_loop_spline) {
// create steering method
ProblemPtr_t problem = Problem::create(robot);
typedef steeringMethod::Spline<hpp::core::path::BernsteinBasis, 3> SMSpline_t;
SMSpline_t::Ptr_t sm (SMSpline_t::create(problem));
SMSpline_t::Ptr_t sm(SMSpline_t::create(problem));
Configuration_t q1(robot->configSize()), q2(robot->configSize());
PathPtr_t path;
bool ok;

// Calculate shift
std::vector<int> order = { 1 };
std::vector<int> order = {1};
matrix_t D1(robot->numberDof(), 1), D2(robot->numberDof(), 1);

q1 << -1, 0;
q2 << 1.1, 0;
D1 << 0, -1;
D2 << 0, 1;
D2 << 0, 1;
path = sm->steer(q1, order, D1, q2, order, D2, 1.0);
BOOST_REQUIRE_EQUAL(path->length(), 1.0);
value_type shift = - path->eval(0.5, ok)[1];
value_type shift = -path->eval(0.5, ok)[1];

// create path validation objects
DichotomyPtr_t dichotomy(Dichotomy::create(robot, 0));
Expand Down

0 comments on commit 32a6347

Please sign in to comment.