diff --git a/CMakeLists.txt b/CMakeLists.txt index 7da4fbca6d59a3d29706f6a5bd2635d90a5b0960..b3c09fd0ce62a7d0f7e752c48eb5c9e39b96c5b0 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 0000000000000000000000000000000000000000..43cd510111f9edd08f4d425c0d92893ccdaafe47 --- /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 0000000000000000000000000000000000000000..19634d3a8e8daddd606736d0abe827e6c88c2090 --- /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 aca6483826da17dbf7743f6cb1cbe5d143730c6a..23fb579dffb2bd83f38cf610e9fa4db7e11496a1 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 28a5853c622e6fafd0f3a96e5ffb50bacd1335b0..e2ed4d0b03dbb24a1197efb0db4f47b25bdd5477 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",