4 #include "API/Roadmap/node.hpp"
5 #include "API/Roadmap/edge.hpp"
6 #include "API/Trajectory/trajectory.hpp"
88 std::vector<Node*> getSortedNodes()
const;
89 std::vector<Node*> getNotTrajNodes()
const;
106 std::vector<Edge*>
getEdges()
const;
108 std::vector<Edge*>
getEdges(std::tr1::shared_ptr<Configuration> q,
bool from=
false);
119 unsigned int getNumberOfCompco()
const;
159 void setName(std::string Name);
249 Node* getRandomNodeNearTraj();
250 void updateSepareNodes(
Node* n);
251 void separateNodes();
252 std::map<double, Node*> getNodesOnTraj(
Node* near,
bool neighbour =
false);
253 std::vector<Node*> getKNodesOnTraj(
Node* near, uint k);
254 void sortNodes(
double init = -1);
263 Edge *
addEdge(
Node * source,
Node * target,
bool compute_length =
true,
double length = 0.,
264 bool compute_cost =
true,
double cost = 0.);
280 void addEdges(
Node * N1,
Node * N2,
bool computeLength =
true,
double length = 0.,
281 bool computeCost =
true,
double cost = 0.);
334 void addNodes(std::vector<Node*> N,
double maxDist);
410 static void sortNodesByDist(std::vector<Node*>& nodes, confPtr_t config);
417 int distConfigChoice);
419 std::vector<Node *> kNearestNeighbours(
unsigned k, confPtr_t conf);
465 int mergeComp(
Node* CompCo1,
Node* CompCo2,
double DistNodes,
bool compute_edge_cost);
540 BGL_Vertex findVertexDescriptor(
Node* N);
541 BGL_Edge findEdgeDescriptor(
Edge* E);
542 void saveBGLGraphToDotFile(
const std::string& filename);
543 BGL_Graph& get_BGL_Graph() {
return m_BoostGraph; }
548 void resetConnections();
550 unsigned int getNbScc();
551 std::vector<std::vector<Node*> > getStronglyConnectedComponents();
552 std::vector<double> sortSCC(
unsigned int id,
Node *N1,
bool forward);
555 void connectScc(
unsigned int i,
unsigned int j);
556 bool mergeScc(
unsigned int i,
unsigned int j);
564 void unsetDescriptors();
565 void drawEdge(BGL_Vertex v1, BGL_Vertex v2);
566 void drawNode(BGL_Vertex v);
568 void deleteGraphStruct();
569 void updateCompcoFromStruct();
570 void freeResources();
571 static bool compareEdges(
Edge* E1,
Edge* E2);
572 static bool compareNodes(
Node* N1,
Node* N2);
579 BGL_Graph m_BoostGraph;
583 bool m_graphChanged;
bool m_initBGL;
585 std::vector<Node*> m_Nodes;
586 std::vector<Node*> m_SortedNodes;
587 std::vector<Node*> m_tempTrajNodes;
588 std::vector<Node*> m_TrajNodes;
589 std::vector<Node*> m_NotTrajNodes;
590 std::vector<Node*> m_NeighbourNodes;
592 std::vector<Edge*> m_Edges;
593 std::vector<ConnectedComponent*> m_Comp;
596 std::map<node*, Node*> m_NodesTable;
601 std::map<Node*,bool> m_UpdateList;
604 std::vector<std::vector<Node*> > m_StronglyConnectedComponents;
606 std::vector<std::vector<bool> > m_Scc_TransitiveClosure;
610 extern Graph* API_activeGraph;
Node * insertConfigurationAsNode(std::tr1::shared_ptr< Configuration > q, Node *from, double step)
Link a Configuration to a Node for the RRT Planner.
Definition: graph.cpp:789
Node * getLastNode()
obtient le dernier Node ajouté au Graph
Definition: graph.cpp:649
ConnectedComponent * getConnectedComponent(int ith) const
Get Compco.
Definition: graph.cpp:2017
Definition: compco.hpp:23
Node * searchConf(Configuration &q)
Gets the node that corresponds to a configuration.
Definition: graph.cpp:685
void mergeComponents(Node *N1, Node *N2)
Merge the connected components to which N1 and N2 belong.
Definition: graph.cpp:1961
bool checkAllEdgesValid()
Recompute All Edges Valid.
Definition: graph.cpp:2277
Node * randomNodeFromComp(Node *comp)
Gets Random node in the connected component.
Definition: graph.cpp:1706
Edge * isEdgeInGraph(Node *N1, Node *N2)
Looks if two Node make an edge in the Graph.
Definition: graph.cpp:1058
Classe représentant un Node d'un Graph.
Definition: node.hpp:39
void createRandConfs(int NMAX)
crée des Node à des Configurations aléatoires
Definition: graph.cpp:1656
API::Trajectory * extractTreeShortestPath(Node *initN, Node *endN)
Return a trajectory (i.e. the shortest path) from initN to endN, using parenthood in a tree...
Definition: graph.cpp:2371
graph * getGraphStruct() const
Creates a p3d_graph from Boost Graph.
Definition: graph.cpp:519
Edge * addEdge(Node *source, Node *target, bool compute_length=true, double length=0., bool compute_cost=true, double cost=0.)
ajoute un Edge au Graph
Definition: graph.cpp:1074
void removeEdge(Edge *E)
Remove edge.
Definition: graph.cpp:1260
Classe représentant un chemin local.
Definition: localpath.hpp:15
unsigned int getNumberOfNodes()
obtient le nombre de Node dans le Graph
Definition: graph.cpp:539
std::vector< Node * > KNearestWeightNeighbour(confPtr_t q, int K, double radius, bool weighted, int distConfigChoice)
K Nearest Weighted Neighbors in graph.
Definition: graph.cpp:1826
void mergeCheck()
teste si des composantes connexes doivent être merger et le fait le cas échéant
Definition: graph.cpp:2103
void removeCompco(ConnectedComponent *CompCo)
Delete the compco.
Definition: graph.cpp:2152
bool isInGraph(Node *N)
vérifie si un node est dans le Graph
Definition: graph.cpp:1378
bool linkNodeAndMerge(Node *node1, Node *node2)
Link 2 nodes and merge them.
Definition: graph.cpp:1638
bool linkToAllNodes(Node *N)
lie un Node à tous les autres Nodes visibles
Definition: graph.cpp:1576
void addCycles(Node *node, double step)
ajoute des Edges formant des cycles dans le Graph
Definition: graph.cpp:2215
API::Trajectory * extractBestTrajSoFar(confPtr_t qi, confPtr_t qf)
Extract best traj from qi that is closest to q_f.
Definition: graph.cpp:2298
void addNodes(std::vector< Node * > N, double maxDist)
ajoute des Node s'ils sont à moins d'une distance max du Graph
Definition: graph.cpp:1366
Node * nearestWeightNeighbour(Node *compco, confPtr_t C, bool weighted, int distConfigChoice)
obtient le plus proche voisin d'une composante connexe
Definition: graph.cpp:1915
std::vector< ConnectedComponent * > getConnectedComponents() const
Get Compcos.
Definition: graph.cpp:623
Classe représentant une Edge d'un Graph.
Definition: edge.hpp:24
std::vector< Node * > getNodes() const
obtient le vecteur des Node du Graph
Definition: graph.cpp:573
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
Node * insertExtremalNode(Node *node)
insert un Node de type ISOLATE
Definition: graph.cpp:709
std::pair< bool, std::vector< Node * > > extractBestNodePathSoFar(confPtr_t qi, confPtr_t qf)
Extract best vector of nodes from qi that is closest to q_f.
Definition: graph.cpp:2324
Node * insertNode(Node *node)
insert un Node dans le Graph
Definition: graph.cpp:700
void removeNode(Node *node)
Remove the given node from the graph.
Definition: graph.cpp:1308
int rebuildCompcoFromBoostGraph()
Rebuild the connected component using the strongly connected component algo from the BGL...
Definition: graph.cpp:2046
Robot * getRobot() const
obtient le Robot pour lequel le Graph est créé
Definition: graph.cpp:529
void sortEdges()
trie les Edges en fonction de leur longueur
Definition: graph.cpp:881
void addEdges(Node *N1, Node *N2, bool computeLength=true, double length=0., bool computeCost=true, double cost=0.)
ajoute deux Edge au Graph
Definition: graph.cpp:1139
bool equal(Graph *G)
teste si deux Graph sont égaux en comparant leur listNode
Definition: graph.cpp:669
std::vector< Node * > neighborsInBall(confPtr_t conf, double radius)
Return the nodes whose configurations are within a ball (in the C-space) having the given radius and ...
Definition: graph.cpp:1892
bool checkConnectedComponents()
Check C and C++ Connected Components.
Definition: graph.cpp:2184
std::vector< Node * > extractAStarShortestNodePaths(Node *initN, Node *endN)
Return the shortest path (as a list of nodes) from initN to endN, using A*.
Definition: graph.cpp:2486
double getAStarShortestPathLength(confPtr_t initC, confPtr_t endC)
Return the lenght of the shortest path (using A*) in the graph between initC and endC Return P3D_HUDG...
Definition: graph.cpp:2627
Node * getNode(unsigned int i) const
Get Node ith node in Graph.
Definition: graph.hpp:94
bool linkNode(Node *N)
lie un Node au Graph
Definition: graph.cpp:1391
void connectScc(unsigned int i, unsigned int j)
Adds an edge in the transitive closure of the graph of the strongly connected components from strongl...
Definition: graph.cpp:3105
API::Trajectory * extractBestTraj(confPtr_t qi, confPtr_t qf)
Extract best traj.
Definition: graph.cpp:2678
unsigned int getNumberOfEdges() const
obtient le nombre de Node dans le Graph
Definition: graph.cpp:556
int mergeComp(Node *CompCo1, Node *CompCo2, double DistNodes, bool compute_edge_cost)
merge deux composantes connexes
Definition: graph.cpp:1978
Definition: trajectory.hpp:40
void setRobot(Robot *R)
sets the Robot of the Graph
Definition: graph.cpp:204
Edge * getEdge(unsigned int i) const
Returns the ith edge.
Definition: graph.hpp:114
bool linkNodeCompMultisol(Node *N, ConnectedComponent *compPt)
Links a node to a compco with multisol.
Definition: graph.cpp:1436
void updateSortedNodes(Node *node)
trie les Nodes en fonction de leur distance à la position du robot via la trajectoire courante ...
Definition: graph.cpp:890
API::Trajectory * extractAStarShortestPath(Node *initN, Node *endN)
Return a trajectory (i.e. the shortest path) from initN to endN, using A*.
Definition: graph.cpp:2601
void recomputeCost()
Recompute the Graph cost (Edges and Nodes)
Definition: graph.cpp:2261
bool isGraphChanged()
return the value of the Change flag
Definition: graph.hpp:42
void setName()
modifie le nom du Graph; un nom standard est alors mis
Definition: graph.cpp:659
std::vector< Edge * > getEdges() const
obtient le vecteur des Edge du Graph
Definition: graph.cpp:588
std::vector< double > computeDijkstraShortestPaths(Node *n)
Compute the lengths of all the shortest paths having for source the node n, using Dijkstra...
Definition: graph.cpp:2402
void sortNodesByDist(Node *N)
Sort nodes against one given node.
Definition: graph.cpp:866
bool areNodesLinked(Node *node1, Node *node2, double &dist)
Function that computes if a node is linked to another node.
Definition: graph.cpp:1585
bool equalName(Graph *G)
teste si deux Graph ont le même nom
Definition: graph.cpp:674
bool linkNodeWithoutDist(Node *N)
Lie un node au Graph sans prendre en compte la distance max.
Definition: graph.cpp:1406
void createCompco(Node *node)
New Compco.
Definition: graph.cpp:2009
Classe représentant une Configuration d'un Robot.
Definition: configuration.hpp:25
void addScc(Node *node)
Adds the singleton {node} to the list of the strongly connected components.
Definition: graph.cpp:3066
std::map< node *, Node * > getNodesTable()
obtient la table des noeuds du Graph
Definition: graph.cpp:628
std::vector< Node * > getNodesInTheCompCo(Node *node)
Vector of nodes in the same compco.
Definition: graph.cpp:2033
void addOrientedEdge(Node *N1, Node *N2, localPathPtr_t path)
Add the oriented edge N1->N2.
Definition: graph.cpp:1209
std::string getName()
obtient le nom du Graph
Definition: graph.cpp:654
bool mergeScc(unsigned int i, unsigned int j)
Merges strongly connected component (scc) of index i with scc of idex j.
Definition: graph.cpp:3154
void removeEdges(Node *N1, Node *N2)
Remove the edges between the nodes N1 and N2.
Definition: graph.cpp:1272
void addNode(Node *node)
Add the given node to the storing structure of the graph (without creating any link).
Definition: graph.cpp:719
void initMotionPlanning(node *start, node *goal)
Init Motion planning problem.
Definition: graph.cpp:2804
bool linkNodeAtDist(Node *N)
Lie un Node au Graph en prenant en compte la distance max.
Definition: graph.cpp:1531
void setGraph(graph *G)
stocke la structure p3d_graph
Definition: graph.cpp:524
bool connectNodeToCompco(Node *node, Node *compco)
Function that trys to connect a node to a given connected component.
Definition: graph.cpp:1717
bool areSccConnected(unsigned int i, unsigned int j)
Returns true if in the transitive closure of the graph of the strongly connected components, the strongly connected component (scc) of index i is connected to the scc j.
Definition: graph.cpp:3093
Node * getCompco(unsigned int ith)
Get Ith Compco.
Definition: graph.cpp:2025