From 32a63470ea11fde090a45fadcc52e0721647d7b6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 21:35:28 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- include/hpp/core/continuous-validation.hh | 4 +++- .../hpp/core/path-optimization/quadratic-program.hh | 3 ++- src/continuous-validation.cc | 6 ++++-- src/path-optimization/quadratic-program.cc | 3 +-- src/path-optimization/spline-gradient-based.cc | 3 +-- tests/test-continuous-validation.cc | 12 ++++++------ 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/hpp/core/continuous-validation.hh b/include/hpp/core/continuous-validation.hh index ed77ca64..e560a90d 100644 --- a/include/hpp/core/continuous-validation.hh +++ b/include/hpp/core/continuous-validation.hh @@ -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); diff --git a/include/hpp/core/path-optimization/quadratic-program.hh b/include/hpp/core/path-optimization/quadratic-program.hh index 5254367a..0355cc0d 100644 --- a/include/hpp/core/path-optimization/quadratic-program.hh +++ b/include/hpp/core/path-optimization/quadratic-program.hh @@ -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); /// \} diff --git a/src/continuous-validation.cc b/src/continuous-validation.cc index 5753dcc8..1c58972c 100644 --- a/src/continuous-validation.cc +++ b/src/continuous-validation.cc @@ -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; @@ -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; diff --git a/src/path-optimization/quadratic-program.cc b/src/path-optimization/quadratic-program.cc index 4a39b6bf..46ea101b 100644 --- a/src/path-optimization/quadratic-program.cc +++ b/src/path-optimization/quadratic-program.cc @@ -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."); diff --git a/src/path-optimization/spline-gradient-based.cc b/src/path-optimization/spline-gradient-based.cc index 58728af7..29a8bf2e 100644 --- a/src/path-optimization/spline-gradient-based.cc +++ b/src/path-optimization/spline-gradient-based.cc @@ -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 diff --git a/tests/test-continuous-validation.cc b/tests/test-continuous-validation.cc index 65f2082c..c801e716 100644 --- a/tests/test-continuous-validation.cc +++ b/tests/test-continuous-validation.cc @@ -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; @@ -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; @@ -497,22 +497,22 @@ BOOST_AUTO_TEST_CASE(avoid_infinite_loop_spline) { // create steering method ProblemPtr_t problem = Problem::create(robot); typedef steeringMethod::Spline 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 order = { 1 }; + std::vector 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));