Skip to content
Snippets Groups Projects
Commit 413a0f9f authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Update Class graph::Graph and graph::NodeSelector

parent abdb5ae2
No related branches found
No related tags found
No related merge requests found
......@@ -36,19 +36,50 @@ namespace hpp {
class HPP_MANIPULATION_DLLAPI Graph
{
public:
/// Create a new Graph.
static GraphPtr_t create()
{
Graph* ptr = new Graph;
GraphPtr_t shPtr (ptr);
ptr->init (shPtr);
return shPtr;
}
/// Create and insert a NodeSelector inside the graph.
NodeSelectorPtr_t createNodeSelector()
{
NodeSelectorPtr_t newNodeSelector = NodeSelector::create();
nodeSelectors_.push_back(newNodeSelector);
return newNodeSelector;
}
/// 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;
protected:
/// Initialization of the object.
void init (const GraphWkPtr_t& weak)
{
wkPtr_ = weak;
}
/// Constructor
Graph ()
{}
private:
/// This list contains a node selector for each end-effector.
set::list < NodeSelectorPtr_t > nodeSelectors_;
std::vector < NodeSelectorPtr_t > nodeSelectors_;
/// A set of constraints that will always be used, for example
/// stability constraints.
ConstraintPtr_t constraints_;
/// Weak pointer to itself.
GraphWkPtr_t wkPtr_;
}; // Class Graph
} // namespace graph
} // namespace manipulation
......
......@@ -28,6 +28,15 @@ namespace hpp {
class HPP_MANIPULATION_DLLAPI NodeSelector
{
public:
/// Create a new NodeSelector.
static NodeSelectorPtr_t create()
{
NodeSelector* ptr = new NodeSelector();
NodeSelectorPtr_t shPtr (ptr);
ptr->init (shPtr);
return shPtr;
}
/// Create a nodes with the constraints
NodePtr_t createNode (const ConstraintPtr_t& constraints)
{
......@@ -42,6 +51,17 @@ namespace hpp {
/// Select randomly an outgoing edge of the given node.
virtual EdgePtr_t chooseEdge(const NodePtr_t& node) const;
protected:
/// Initialization of the object.
void init (const GraphWkPtr_t& weak)
{
wkPtr_ = weak;
}
/// Constructor
NodeSelector ()
{}
private:
/// List of the states of one end-effector, ordered by priority.
std::vector< NodePtr_t > orderedStates_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment