diff --git a/CMakeLists.txt b/CMakeLists.txt index 490c2768f875123e5730278bf89d4b35e8e17525..0386563787b432c4b37d3b0b1aaa33151043e11f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,7 @@ SET (${PROJECT_NAME}_HEADERS include/hpp/manipulation/problem-solver.hh include/hpp/manipulation/device.hh include/hpp/manipulation/roadmap.hh + include/hpp/manipulation/roadmap-node.hh include/hpp/manipulation/manipulation-planner.hh include/hpp/manipulation/graph-path-validation.hh include/hpp/manipulation/graph-steering-method.hh diff --git a/include/hpp/manipulation/fwd.hh b/include/hpp/manipulation/fwd.hh index 58785d242af2b79c524360cb62c549ae38f73ac7..0455dbef8bd912788205e1e883b52357e1a1ffd8 100644 --- a/include/hpp/manipulation/fwd.hh +++ b/include/hpp/manipulation/fwd.hh @@ -51,6 +51,8 @@ namespace hpp { typedef Problem* ProblemPtr_t; HPP_PREDEF_CLASS (Roadmap); typedef boost::shared_ptr <Roadmap> RoadmapPtr_t; + HPP_PREDEF_CLASS (RoadmapNode); + typedef RoadmapNode* RoadmapNodePtr_t; typedef constraints::RelativeOrientation RelativeOrientation; typedef constraints::RelativePosition RelativePosition; typedef constraints::RelativeOrientationPtr_t RelativeOrientationPtr_t; diff --git a/include/hpp/manipulation/roadmap-node.hh b/include/hpp/manipulation/roadmap-node.hh new file mode 100644 index 0000000000000000000000000000000000000000..49745c362fbff8263944a667425e821e574549ea --- /dev/null +++ b/include/hpp/manipulation/roadmap-node.hh @@ -0,0 +1,84 @@ +// Copyright (c) 2014 CNRS +// Authors: Joseph Mirabel +// +// +// 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/>. + +#ifndef HPP_MANIPULATION_ROADMAP_NODE_HH +# define HPP_MANIPULATION_ROADMAP_NODE_HH + +# include <hpp/manipulation/config.hh> + +# include <hpp/core/node.hh> +# include <hpp/manipulation/fwd.hh> +# include <hpp/manipulation/graph/fwd.hh> + +namespace hpp { + namespace manipulation { + class HPP_MANIPULATION_DLLAPI RoadmapNode : public core::Node + { + public: + enum CachingSystem { + /// The caching system is disabled. The graph::Node containing this + /// node can be obtained by checking the constraints. + CACHE_DISABLED, + /// The chaching system is enabled and up to date. + CACHE_UP_TO_DATE, + /// The chaching system is enabled but the cache is not up to date. + CACHE_NEED_UPDATE + }; + + static CachingSystem defaultCachingSystem; + + RoadmapNode (const ConfigurationPtr_t& configuration) : + core::Node (configuration), + cacheSystem_ (defaultCachingSystem), + node_ () + {} + + RoadmapNode (const ConfigurationPtr_t& configuration, + ConnectedComponentPtr_t cc) : + core::Node (configuration, cc), + cacheSystem_ (defaultCachingSystem), + node_ () + {} + + CachingSystem cachingSystem () const + { + return cacheSystem_; + } + + /// Getter for the graph::Node. + graph::NodePtr_t graphNode () const + { + return node_; + } + + /// Setter for the graph::Node. + void graphNode (const graph::NodePtr_t& node) + { + if (cacheSystem_ != CACHE_DISABLED) cacheSystem_ = CACHE_UP_TO_DATE; + node_ = node; + } + + private: + CachingSystem cacheSystem_; + + graph::NodePtr_t node_; + }; + } // namespace manipulation +} // namespace hpp + +#endif // HPP_MANIPULATION_ROADMAP_NODE_HH diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a8eb9efa733b34dd9a705f0fd067618f110235fb..fc2f7f9fa35b4107f7fc1c740540eda3db116f9c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,7 @@ ADD_LIBRARY(${LIBRARY_NAME} SHARED manipulation-planner.cc problem-solver.cc roadmap.cc + roadmap-node.cc device.cc graph-path-validation.cc graph-steering-method.cc diff --git a/src/roadmap-node.cc b/src/roadmap-node.cc new file mode 100644 index 0000000000000000000000000000000000000000..5548de33fa41d6bac922161fd6f65e168a26fd3d --- /dev/null +++ b/src/roadmap-node.cc @@ -0,0 +1,23 @@ +// Copyright (c) 2015, 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/manipulation/roadmap-node.hh" + +namespace hpp { + namespace manipulation { + RoadmapNode::CachingSystem RoadmapNode::defaultCachingSystem = RoadmapNode::CACHE_DISABLED; + } // namespace manipulation +} // namespace hpp