Hybrid A* Planner
 All Classes Namespaces Files Functions Variables Friends Pages
visualize.h
1 #ifndef VISUALIZE_H
2 #define VISUALIZE_H
3 
4 #include <ros/ros.h>
5 #include <tf/transform_datatypes.h>
6 #include <geometry_msgs/PoseStamped.h>
7 #include <geometry_msgs/PoseArray.h>
8 #include <visualization_msgs/MarkerArray.h>
9 
10 #include "gradient.h"
11 
12 #include "node3d.h"
13 #include "node2d.h"
14 namespace HybridAStar {
15 class Node3D;
16 class Node2D;
23 class Visualize {
24  public:
25  // ___________
26  // CONSTRUCTOR
29  // _________________
30  // TOPICS TO PUBLISH
31  pubNode3D = n.advertise<geometry_msgs::PoseStamped>("/visualizeNodes3DPose", 100);
32  pubNodes3D = n.advertise<geometry_msgs::PoseArray>("/visualizeNodes3DPoses", 100);
33  pubNodes3Dreverse = n.advertise<geometry_msgs::PoseArray>("/visualizeNodes3DPosesReverse", 100);
34  pubNodes3DCosts = n.advertise<visualization_msgs::MarkerArray>("/visualizeNodes3DCosts", 100);
35  pubNode2D = n.advertise<geometry_msgs::PoseStamped>("/visualizeNodes2DPose", 100);
36  pubNodes2D = n.advertise<geometry_msgs::PoseArray>("/visualizeNodes2DPoses", 100);
37  pubNodes2DCosts = n.advertise<visualization_msgs::MarkerArray>("/visualizeNodes2DCosts", 100);
38 
39  // CONFIGURE THE CONTAINER
40  poses3D.header.frame_id = "path";
41  poses3Dreverse.header.frame_id = "path";
42  poses2D.header.frame_id = "path";
43  }
44 
45  // CLEAR VISUALIZATION
47  void clear();
49  void clear2D() {poses2D.poses.clear();}
50 
51  // PUBLISH A SINGLE/ARRAY 3D NODE TO RViz
53  void publishNode3DPose(Node3D& node);
55  void publishNode3DPoses(Node3D& node);
56  // PUBLISH THE COST FOR A 3D NODE TO RViz
58  void publishNode3DCosts(Node3D* nodes, int width, int height, int depth);
59 
60  // PUBLISH A SINGEL/ARRAY 2D NODE TO RViz
62  void publishNode2DPose(Node2D& node);
64  void publishNode2DPoses(Node2D& node);
65  // PUBLISH THE COST FOR A 2D NODE TO RViz
67  void publishNode2DCosts(Node2D* nodes, int width, int height);
68 
69  private:
71  ros::NodeHandle n;
73  ros::Publisher pubNode3D;
75  ros::Publisher pubNodes3D;
77  ros::Publisher pubNodes3Dreverse;
79  ros::Publisher pubNodes3DCosts;
81  ros::Publisher pubNode2D;
83  ros::Publisher pubNodes2D;
85  ros::Publisher pubNodes2DCosts;
87  geometry_msgs::PoseArray poses3D;
89  geometry_msgs::PoseArray poses3Dreverse;
91  geometry_msgs::PoseArray poses2D;
92 
93 };
94 }
95 #endif // VISUALIZE_H
A three dimensional node class that is at the heart of the algorithm.
Definition: node3d.h:14
ros::NodeHandle n
A handle to the ROS node.
Definition: visualize.h:71
geometry_msgs::PoseArray poses2D
Array of poses describing 2D heuristic nodes.
Definition: visualize.h:91
void publishNode3DPose(Node3D &node)
Publishes a single node to RViz, usually the one currently being expanded.
Definition: visualize.cpp:37
ros::Publisher pubNode3D
Publisher for a single 3D node.
Definition: visualize.h:73
ros::Publisher pubNodes2DCosts
Publisher for an array of 2D cost with color gradient.
Definition: visualize.h:85
ros::Publisher pubNode2D
Publisher for a single 2D node.
Definition: visualize.h:81
void publishNode2DCosts(Node2D *nodes, int width, int height)
Publishes the minimum of the cost of all nodes in a 2D grid cell.
Definition: visualize.cpp:214
ros::Publisher pubNodes3D
Publisher for an array of 3D forward nodes.
Definition: visualize.h:75
A two dimensional node class used for the holonomic with obstacles heuristic.
Definition: node2d.h:14
ros::Publisher pubNodes3DCosts
Publisher for an array of 3D cost with color gradient.
Definition: visualize.h:79
void publishNode2DPoses(Node2D &node)
Publishes all expanded nodes to RViz.
Definition: visualize.cpp:104
void clear2D()
Clears the 2D visualization.
Definition: visualize.h:49
void publishNode3DPoses(Node3D &node)
Publishes all expanded nodes to RViz.
Definition: visualize.cpp:61
A class for visualizing the hybrid A* search.
Definition: visualize.h:23
geometry_msgs::PoseArray poses3D
Array of poses describing forward nodes.
Definition: visualize.h:87
ros::Publisher pubNodes3Dreverse
Publisher for an array of 3D reaward nodes.
Definition: visualize.h:77
void clear()
Clears the entire visualization.
Definition: visualize.cpp:6
void publishNode2DPose(Node2D &node)
Publishes a single node to RViz, usually the one currently being expanded.
Definition: visualize.cpp:88
ros::Publisher pubNodes2D
Publisher for an array of 2D nodes.
Definition: visualize.h:83
Visualize()
The default constructor initializing the visualization object and setting publishers for the same...
Definition: visualize.h:28
geometry_msgs::PoseArray poses3Dreverse
Array of poses describing reaward nodes.
Definition: visualize.h:89
void publishNode3DCosts(Node3D *nodes, int width, int height, int depth)
Publishes the minimum of the cost of all nodes in a 2D grid cell.
Definition: visualize.cpp:122