GraphBuilder.h
Go to the documentation of this file.
1 /**
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @author Fabian Reister ( fabian dot reister at kit dot edu )
17  * @date 2021
18  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19  * GNU General Public License
20  */
21 
22 #pragma once
23 
24 #include <cstdint>
25 #include <vector>
26 
27 #include <SemanticObjectRelations/Shapes/Shape.h>
31 
33 {
34 
35 
37  {
38  public:
39  void initialize(const core::Pose& pose);
40 
41  // const std::vector<core::Graph::VertexDescriptor>& activeVertices() const;
42 
43  void connect(const core::Pose& pose, const client::GlobalPlanningStrategy& strategy);
44 
45 
46  // which type to choose? this is a sequence of chains
47 
48  /**
49  * @brief
50  *
51  * @param routes
52  * @param strategy strategy on how to connect the last vertex and the routes
53  */
54  void connect(const std::vector<core::Graph::VertexDescriptor>& routes,
55  const client::GlobalPlanningStrategy& strategy);
56  void connect(const std::vector<core::GraphPath>& routes,
57  const client::GlobalPlanningStrategy& strategy);
58  // void connect(const core::Pose& pose, const client::GlobalPlanningStrategy& strategy);
59 
60  const core::Graph& getGraph() const;
61 
62  std::optional<core::Graph::ConstVertex> startVertex;
63 
64  core::Graph::VertexDescriptor goalVertex() const;
65 
66  core::Pose goalPose() const;
67 
68  private:
69  // void addEdge(const std::vector<core::Graph::VertexDescriptor>& sources,
70  // const std::vector<core::Graph::VertexDescriptor>& targets);
71 
72  void validate(auto&& vertices) const;
73 
74  semrel::ShapeID addOrGetVertex(const core::Graph::VertexAttrib& attributes);
75  std::optional<semrel::ShapeID>
76  getVertexByAttributes(const core::Graph::VertexAttrib& attributes);
77 
78  std::vector<semrel::ShapeID> activeVertices_;
79 
80  core::Graph graph;
81 
82  int64_t vertexIdCnt = -1;
83  };
84 
85 } // namespace armarx::navigation::server
armarx::navigation::server::GraphBuilder::getGraph
const core::Graph & getGraph() const
Definition: GraphBuilder.cpp:232
armarx::navigation::core::Pose
Eigen::Isometry3f Pose
Definition: basic_types.h:31
armarx::navigation::server::GraphBuilder::goalVertex
core::Graph::VertexDescriptor goalVertex() const
Definition: GraphBuilder.cpp:239
armarx::navigation::server::GraphBuilder::initialize
void initialize(const core::Pose &pose)
Definition: GraphBuilder.cpp:25
events.h
armarx::navigation::server
This file is part of ArmarX.
Definition: EventPublishingInterface.h:10
PathBuilder.h
armarx::navigation::server::GraphBuilder
Definition: GraphBuilder.h:36
armarx::navigation::server::GraphBuilder::startVertex
std::optional< core::Graph::ConstVertex > startVertex
Definition: GraphBuilder.h:62
armarx::navigation::core::Graph
Definition: Graph.h:88
armarx::navigation::server::GraphBuilder::goalPose
core::Pose goalPose() const
Definition: GraphBuilder.cpp:246
armarx::navigation::server::GraphBuilder::connect
void connect(const core::Pose &pose, const client::GlobalPlanningStrategy &strategy)
Definition: GraphBuilder.cpp:47
Graph.h
armarx::navigation::client::GlobalPlanningStrategy
GlobalPlanningStrategy
Definition: types.h:27