From 4438a189de9b95da55c4cd72998ecadb5aa127e1 Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Wed, 9 Jul 2014 18:30:47 +0200 Subject: [PATCH] Update constraint graph interface. --- include/hpp/manipulation/graph/fwd.hh | 7 +++++++ include/hpp/manipulation/graph/graph.hh | 8 ++++++-- include/hpp/manipulation/graph/node-selector.hh | 7 +++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/hpp/manipulation/graph/fwd.hh b/include/hpp/manipulation/graph/fwd.hh index 5902917e..22cb327c 100644 --- a/include/hpp/manipulation/graph/fwd.hh +++ b/include/hpp/manipulation/graph/fwd.hh @@ -18,15 +18,22 @@ # define HPP_MANIPULATION_GRAPH_FWD_HH #include <hpp/util/pointer.hh> +#include <vector> namespace hpp { namespace manipulation { namespace graph { + HPP_PREDEF_CLASS (Graph); HPP_PREDEF_CLASS (Node); HPP_PREDEF_CLASS (Edge); HPP_PREDEF_CLASS (NodeSelector); + typedef boost::shared_ptr < Graph > GraphPtr_t; + typedef boost::shared_ptr < Node > NodePtr_t; typedef boost::shared_ptr < Edge > EdgePtr_t; typedef boost::shared_ptr < NodeSelector > NodeSelectorPtr_t; + typedef std::vector < NodePtr_t > Nodes_t; + typedef std::vector < EdgePtr_t > Edges_t; + typedef std::vector < NodeSelectorPtr_t > NodeSelectors_t; typedef hpp::core::ConstraintSet ConstraintSet_t; typedef hpp::core::ConstraintSetPtr_t ConstraintSetPtr_t; diff --git a/include/hpp/manipulation/graph/graph.hh b/include/hpp/manipulation/graph/graph.hh index 5ff9e4a1..22a00515 100644 --- a/include/hpp/manipulation/graph/graph.hh +++ b/include/hpp/manipulation/graph/graph.hh @@ -14,7 +14,6 @@ // 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_GRAPHGRAPH_HH # define HPP_MANIPULATION_GRAPHGRAPH_HH @@ -30,6 +29,11 @@ namespace hpp { class HPP_MANIPULATION_DLLAPI Graph { public: + /// Returns the states of a configuration. + virtual Nodes_t getNode(const Configuration_t config) const; + + /// Select randomly outgoing edges of the given nodes. + virtual Edges_t chooseEdge(const Nodes_t& node) const; private: /// This list contains a node selector for each end-effector. @@ -38,7 +42,7 @@ namespace hpp { /// A set of constraints that will always be used, for example /// stability constraints. ConstraintSetPtr_t constraints_; - } + }; // Class Graph } // namespace graph } // namespace manipulation } // namespace hpp diff --git a/include/hpp/manipulation/graph/node-selector.hh b/include/hpp/manipulation/graph/node-selector.hh index b507cfcd..e8a27570 100644 --- a/include/hpp/manipulation/graph/node-selector.hh +++ b/include/hpp/manipulation/graph/node-selector.hh @@ -29,12 +29,15 @@ namespace hpp { { public: /// Returns the state of a configuration. - virtual Node getState(const Configuration_t config) const; + virtual NodePtr_t getNode(const Configuration_t config) const; + + /// Select randomly an outgoing edge of the given node. + virtual EdgePtr_t chooseEdge(const NodePtr_t& node) const; private: /// List of the states of one end-effector, ordered by priority. std::vector< NodeWkPtr_t > orderedStates_; - }; // + }; // Class NodeSelector } // namespace graph } // namespace manipulation } // namespace hpp -- GitLab