AStarPlanner.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <optional>
5#include <vector>
6
7#include <VirtualRobot/VirtualRobot.h>
8
12
13#include "Node.h"
14
16{
17
18 class Grid
19 {
20 public:
21 Grid(int rows, int cols, int orientations, const Costmap3D& costmap);
22 void clear();
23 Node& getNode(int row, int col, int orientation);
24 static bool fulfillsConstraints(const Node& n, const Costmap3D& costmap);
25
26 private:
27 void initialize(int rows, int cols, int orientations, const Costmap3D& costmap);
28 std::unique_ptr<Node[]> data_ = nullptr;
29 int rows;
30 int cols;
31 int orientations;
32 };
33
34 /**
35 * The A* planner (3D version including orientation dimension)
36 */
38 {
39 public:
40 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41
43
45
46 std::vector<core::Pose2D> plan(const core::Pose2D& start,
47 const core::Pose2D& goal) /* override */;
48
49 private:
50 float heuristic(const Node& n1, const Node& n2);
51 Node& closestNode(const core::Pose2D& pose);
52
53 Costs costs(const Node& n1, const Node& n2) const;
54
55 float computeObstacleDistance(const Eigen::Vector2f& pos,
56 VirtualRobot::RobotPtr& robot) const;
57
58 private:
59 const Costmap3D costmap3d;
60
61 std::optional<Grid> grid;
62
64 };
65} // namespace armarx::navigation::algorithms::orientation_aware
AStarPlanner(const Costmap3D &costmap, io::AStarWithOrientationParams params)
std::vector< core::Pose2D > plan(const core::Pose2D &start, const core::Pose2D &goal)
Grid(int rows, int cols, int orientations, const Costmap3D &costmap)
static bool fulfillsConstraints(const Node &n, const Costmap3D &costmap)
Node & getNode(int row, int col, int orientation)
A Node can store data to all valid neighbors (successors) and a precessor.
Definition Node.h:55
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
Eigen::Isometry2f Pose2D
Definition basic_types.h:34