From 97e31d0ed84b7b9912b479ab61e56d4fc98b6968 Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Thu, 24 Jan 2019 15:25:19 +0100 Subject: [PATCH] Add plugin manipulation-spline-gradient-based. --- CMakeLists.txt | 3 ++ plugins/CMakeLists.txt | 22 +++++++++++++++ plugins/spline-gradient-based.cc | 47 ++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 15 +++++++++- src/problem-solver.cc | 8 ------ 5 files changed, 86 insertions(+), 9 deletions(-) create mode 100644 plugins/CMakeLists.txt create mode 100644 plugins/spline-gradient-based.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 7da4fbc..b3c09fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,8 @@ SET(PROJECT_DESCRIPTION "Classes for manipulation planning.") SETUP_HPP_PROJECT() +LIST(APPEND PKG_CONFIG_ADDITIONAL_VARIABLES cmake_plugin) + # Activate test using UR5 if requested SET (TEST_UR5 FALSE CACHE BOOL "Activate tests using ur5") @@ -103,6 +105,7 @@ SET (${PROJECT_NAME}_HEADERS ) ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(plugins) ADD_SUBDIRECTORY(tests) # Add dependency toward hpp-manipulation library in pkg-config file. diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt new file mode 100644 index 0000000..43cd510 --- /dev/null +++ b/plugins/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright (c) 2019, Joseph Mirabel +# Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +# +# This file is part of hpp-manipulation. +# hpp-manipulation is free software: you can redistribute it +# and/or modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation, either version +# 3 of the License, or (at your option) any later version. +# +# hpp-manipulation is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Lesser Public License for more details. You should have +# received a copy of the GNU Lesser General Public License along with +# hpp-manipulation. If not, see <http://www.gnu.org/licenses/>. + +INCLUDE(${HPP_CORE_CMAKE_PLUGIN}) + +ADD_PLUGIN(manipulation-spline-gradient-based + SOURCES spline-gradient-based.cc + LINK_DEPENDENCIES ${PROJECT_NAME} ${PROJECT_NAME}-gpl hpp-core-gpl + PKG_CONFIG_DEPENDENCIES hpp-core) diff --git a/plugins/spline-gradient-based.cc b/plugins/spline-gradient-based.cc new file mode 100644 index 0000000..19634d3 --- /dev/null +++ b/plugins/spline-gradient-based.cc @@ -0,0 +1,47 @@ +// Copyright (c) 2019, Joseph Mirabel +// Authors: Joseph Mirabel (joseph.mirabel@laas.fr) +// +// This file is part of hpp-manipulation. +// hpp-manipulation is free software: you can redistribute it +// and/or modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation, either version +// 3 of the License, or (at your option) any later version. +// +// hpp-manipulation is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// hpp-manipulation. If not, see <http://www.gnu.org/licenses/>. + +#include <hpp/core/plugin.hh> +#include <hpp/core/problem-solver.hh> + +#include <hpp/manipulation/path-optimization/spline-gradient-based.hh> + +namespace hpp { + namespace manipulation { + class SplineGradientBasedPlugin : public core::ProblemSolverPlugin + { + public: + SplineGradientBasedPlugin () + : ProblemSolverPlugin ("SplineGradientBasedPlugin", "0.0") + {} + + protected: + virtual bool impl_initialize (core::ProblemSolverPtr_t ps) + { + // ps->pathOptimizers.add ("SplineGradientBased_cannonical1",pathOptimization::SplineGradientBased<core::path::CanonicalPolynomeBasis, 1>::createFromCore); + // ps->pathOptimizers.add ("SplineGradientBased_cannonical2",pathOptimization::SplineGradientBased<core::path::CanonicalPolynomeBasis, 2>::createFromCore); + // ps->pathOptimizers.add ("SplineGradientBased_cannonical3",pathOptimization::SplineGradientBased<core::path::CanonicalPolynomeBasis, 3>::createFromCore); + ps->pathOptimizers.add ("SplineGradientBased_bezier1",pathOptimization::SplineGradientBased<core::path::BernsteinBasis, 1>::createFromCore); + // ps->pathOptimizers.add ("SplineGradientBased_bezier2",pathOptimization::SplineGradientBased<core::path::BernsteinBasis, 2>::createFromCore); + ps->pathOptimizers.add ("SplineGradientBased_bezier3",pathOptimization::SplineGradientBased<core::path::BernsteinBasis, 3>::createFromCore); + + return true; + } + }; + } // namespace manipulation +} // namespace hpp + +HPP_CORE_DEFINE_PLUGIN(hpp::manipulation::SplineGradientBasedPlugin) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aca6483..23fb579 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,7 +47,6 @@ SET(SOURCES graph/dot.cc path-optimization/random-shortcut.cc - path-optimization/spline-gradient-based.cc path-optimization/enforce-transition-semantic.cc problem-target/state.cc @@ -73,3 +72,17 @@ IF(HPP_WHOLEBODY_STEP_FOUND) ENDIF(HPP_WHOLEBODY_STEP_FOUND) INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION lib) + +ADD_LIBRARY(${LIBRARY_NAME}-gpl SHARED + path-optimization/spline-gradient-based.cc + ) + +PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME}-gpl hpp-core) +PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME}-gpl hpp-statistics) +PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME}-gpl hpp-constraints) +IF(HPP_WHOLEBODY_STEP_FOUND) + PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME}-gpl hpp-wholebody-step) +ENDIF(HPP_WHOLEBODY_STEP_FOUND) +TARGET_LINK_LIBRARIES(${LIBRARY_NAME}-gpl ${LIBRARY_NAME} hpp-core-gpl) + +INSTALL(TARGETS ${LIBRARY_NAME}-gpl DESTINATION lib) diff --git a/src/problem-solver.cc b/src/problem-solver.cc index 28a5853..e2ed4d0 100644 --- a/src/problem-solver.cc +++ b/src/problem-solver.cc @@ -52,7 +52,6 @@ #include "hpp/manipulation/graph-optimizer.hh" #include "hpp/manipulation/graph-path-validation.hh" #include "hpp/manipulation/graph-node-optimizer.hh" -#include "hpp/manipulation/path-optimization/spline-gradient-based.hh" #include "hpp/manipulation/path-optimization/random-shortcut.hh" #include "hpp/manipulation/path-optimization/enforce-transition-semantic.hh" #include "hpp/manipulation/problem-target/state.hh" @@ -130,13 +129,6 @@ namespace hpp { pathProjectors.add ("RecursiveHermite", createPathProjector <core::pathProjector::RecursiveHermite>); - // pathOptimizers.add ("SplineGradientBased_cannonical1",pathOptimization::SplineGradientBased<core::path::CanonicalPolynomeBasis, 1>::createFromCore); - // pathOptimizers.add ("SplineGradientBased_cannonical2",pathOptimization::SplineGradientBased<core::path::CanonicalPolynomeBasis, 2>::createFromCore); - // pathOptimizers.add ("SplineGradientBased_cannonical3",pathOptimization::SplineGradientBased<core::path::CanonicalPolynomeBasis, 3>::createFromCore); - pathOptimizers.add ("SplineGradientBased_bezier1",pathOptimization::SplineGradientBased<core::path::BernsteinBasis, 1>::createFromCore); - // pathOptimizers.add ("SplineGradientBased_bezier2",pathOptimization::SplineGradientBased<core::path::BernsteinBasis, 2>::createFromCore); - pathOptimizers.add ("SplineGradientBased_bezier3",pathOptimization::SplineGradientBased<core::path::BernsteinBasis, 3>::createFromCore); - steeringMethods.add ("Graph-SteeringMethodStraight", steeringMethod::Graph::create <core::SteeringMethodStraight>); steeringMethods.add ("Graph-Straight", -- GitLab