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, float clearance);
22 void clear();
23 Node& getNode(int row, int col, int orientation);
24 static bool fulfillsConstraints(const Node& n, const Costmap3D& costmap, float clearance = 0.0f);
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 float clearance;
33 };
34
35 /**
36 * The A* planner (3D version including orientation dimension)
37 */
39 {
40 public:
41 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
42
44
46
47 std::vector<core::Pose2D> plan(const core::Pose2D& start,
48 const core::Pose2D& goal) /* override */;
49
50 private:
51 float heuristic(const Node& n1, const Node& n2);
52 Node& closestNode(const core::Pose2D& pose);
53
54 Costs costs(const Node& n1, const Node& n2) const;
55
56 float computeObstacleDistance(const Eigen::Vector2f& pos,
57 VirtualRobot::RobotPtr& robot) const;
58
59 private:
60 const Costmap3D costmap3d;
61
62 std::optional<Grid> grid;
63
65 };
66} // 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, float clearance)
static bool fulfillsConstraints(const Node &n, const Costmap3D &costmap, float clearance=0.0f)
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