AStarPlanner.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include <VirtualRobot/VirtualRobot.h>
6
8
9#include "Node.h"
10
12{
13
14 /**
15 * The A* planner
16 */
17 class AStarPlanner //: public Planner2D
18 {
19 public:
20 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
21
22 AStarPlanner(const algorithms::Costmap& costmap);
23
24 std::vector<Eigen::Vector2f> plan(const Eigen::Vector2f& start,
25 const Eigen::Vector2f& goal) /* override */;
26
27 private:
28 float heuristic(const NodePtr& n1, const NodePtr& n2);
29 void createUniformGrid();
30 bool fulfillsConstraints(const NodePtr& n);
31 NodePtr closestNode(const Eigen::Vector2f& v);
32
33 float costs(const NodePtr& a, const NodePtr& b) const;
34
35 float computeObstacleDistance(const Eigen::Vector2f& pos,
36 VirtualRobot::RobotConstPtr& robot) const;
37
38 private:
39 const algorithms::Costmap costmap;
40
41 std::vector<std::vector<NodePtr>> grid;
42
43 const float obstacleDistanceWeightFactor = 0.5;
44
45 const float maxObstacleDistance = 1500; // [mm]
46 };
47} // namespace armarx::navigation::algorithm::astar
std::vector< Eigen::Vector2f > plan(const Eigen::Vector2f &start, const Eigen::Vector2f &goal)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW AStarPlanner(const algorithms::Costmap &costmap)
std::shared_ptr< Node > NodePtr
Definition Node.h:11