AStar.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 * @author Christian R. G. Dreher ( c dot dreher at kit dot edu )
18 * @date 2021
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
27
28#include "GlobalPlanner.h"
29
31{
32
33 /**
34 * @brief Parameters for AStar
35 *
36 */
38 {
39 float resampleDistance{200};
40
41 Algorithms algorithm() const override;
42 aron::data::DictPtr toAron() const override;
43
44 static AStarParams FromAron(const aron::data::DictPtr& dict);
45 };
46
48 {
49 public:
51
52 AStarImpl(const Params& params,
53 const core::GeneralConfig& generalConfig,
54 const std::optional<navigation::algorithms::Costmap>& costmap);
55
56 void updateCostmap(const std::optional<navigation::algorithms::Costmap>& costmap);
57
58 std::optional<GlobalPlannerResult> plan(const core::Pose& start, const core::Pose& goal);
59
60 protected:
61 std::vector<Eigen::Vector2f> postProcessPath(const std::vector<Eigen::Vector2f>& path);
62
63 private:
64 Params params;
65 std::optional<navigation::algorithms::Costmap> costmap_;
66 core::GeneralConfig generalConfig_;
67 };
68
69 /**
70 * @class AStar
71 * @ingroup Library-GlobalPlanner
72 *
73 * Implements the A* algorithm
74 */
75 class AStar : public GlobalPlanner
76 {
77 public:
79
80 AStar(const Params& params,
82 const core::Scene& ctx);
83 ~AStar() override = default;
84
85 std::optional<GlobalPlannerResult> plan(const core::Pose& goal) override;
86 std::optional<GlobalPlannerResult> plan(const core::Pose& start,
87 const core::Pose& goal) override;
88
89 private:
90 AStarImpl impl_;
91 };
92
93} // namespace armarx::navigation::global_planning
void updateCostmap(const std::optional< navigation::algorithms::Costmap > &costmap)
Definition AStar.cpp:110
std::optional< GlobalPlannerResult > plan(const core::Pose &start, const core::Pose &goal)
Definition AStar.cpp:134
AStarImpl(const Params &params, const core::GeneralConfig &generalConfig, const std::optional< navigation::algorithms::Costmap > &costmap)
Definition AStar.cpp:102
std::vector< Eigen::Vector2f > postProcessPath(const std::vector< Eigen::Vector2f > &path)
Definition AStar.cpp:123
std::optional< GlobalPlannerResult > plan(const core::Pose &goal) override
Definition AStar.cpp:84
AStar(const Params &params, const core::GeneralConfig &generalConfig, const core::Scene &ctx)
Definition AStar.cpp:72
GlobalPlanner(const core::GeneralConfig &generalConfig, const core::Scene &scene)
std::shared_ptr< Dict > DictPtr
Definition Dict.h:42
Eigen::Isometry3f Pose
Definition basic_types.h:31
This file is part of ArmarX.
Definition fwd.h:30
static AStarParams FromAron(const aron::data::DictPtr &dict)
Definition AStar.cpp:55
aron::data::DictPtr toAron() const override
Definition AStar.cpp:44
Algorithms algorithm() const override
Definition AStar.cpp:38