ISMVisualization.h
Go to the documentation of this file.
1 
18 #include <visualization_msgs/Marker.h>
19 #include <visualization_msgs/MarkerArray.h>
20 
21 #include <string>
22 #include <set>
23 #include <utility>
24 
25 #include <boost/shared_ptr.hpp>
26 
27 #include <tf/transform_listener.h>
28 
29 #include <Eigen/Core>
30 
31 #include <ISM/RecognitionResult.hpp>
32 
33 #include "QuadGrid.h"
34 
35 namespace Visualization {
36  static const int ID_PTU_FOV = 0;
37  static const int ID_TESSELLATED_SPHERE = 1;
38  static const int ID_SAMPLES_2D = 2;
39  static const int ID_SAMPLES_3D = 3;
40  static const int ID_QUADS = 20000;
41 
42  static const int GRID_SCALE = 0.005;
43  static const int TS_RADIUS = 0.5:
44 
45  class ISMVisualization {
46 
47  private:
48  // The grid containing the votes
49  QuadGridPtr grid;
50 
51  // Resolution for the tesselated sphere
52  double quad_pan_deg;
53  double quad_tilt_deg;
54 
55  // Publishers for vsualization markers
56  ros::Publisher ismPublisher;
57  ros::Publisher arrowPublisher;
58  ros::Publisher tsPublisher;
59  ros::Publisher qgPublisher;
60  ros::Publisher fovPublisher;
61  ros::Publisher samples2dPublisher;
62  ros::Publisher samples3dPublisher;
63 
64  public:
65  ISMVisualization();
66  ~ISMVisualization();
67 
68  // Draw tesselated sphere as grid
69  void drawTesselatedSphere(float panMin, float panMax, float tiltMin, float tiltMax);
70 
71  // Draws extent of camera view with current PTU state
72  void drawFoV(float pan, float tilt, float foVX, float foVY);
73 
74  // Draws relations and so on in one recognized scene given as parameter
75  void drawRecognitionResult(ISM::RecognitionResultPtr result, int level, ISM::PointPtr parentPoint, std::string prefix, unsigned char action);
76 
77  // Draws color coded quad ratings
78  void drawQuads(float panMin, float panMax, float tiltMin, float tiltMax);
79 
80  // Draws object position samples in 3D space and their projection on tesselated sphere
81  void drawSamples();
82 
83  // Draw arrows from scene reference to object position votes for objects belonging to scene and not found until yet
84  void drawUnfoundObjectsVotes();
85 
86  private:
87 
88  // Adds the given distance to the z-Axis of the point
89  ISM::PointPtr applyLevelToPoint(ISM::PointPtr p, int level);
90 
91  // Creates a visualization message that draws a point as sphere
92  visualization_msgs::Marker pointToSphere(ISM::PointPtr point, unsigned char action);
93 
94  // Creates a visualization message that draws a line between points
95  visualization_msgs::Marker lineBetweenPoints(ISM::PointPtr point1, ISM::PointPtr point2, unsigned char action);
96 
97  // Creates a visualization message that draws an arrow between points
98  visualization_msgs::Marker arrowBetweenPoints(const ISM::PointPtr& point1, const ISM::PointPtr& point2, unsigned char action);
99 
100  // Creates a visualization message that draws an arrow between points
101  visualization_msgs::Marker arrowBetweenPoints2(const ISM::PointPtr& point1, const ISM::PointPtr& point2);
102 
103  // Creates a geometry message containing a point. Helper function for methods above.
104  geometry_msgs::Point pointToPointMsg(ISM::PointPtr point);
105 
106  // Creates the appropriate color for a given confidence level
107  std_msgs::ColorRGBA confidenceToColor(double confidence);
108 
109  // Calculates the angle to the PTU.
110  geometry_msgs::Point angleToPTU(float pan, float tilt, float r);
111 
112  // Returns the Quaternion that belongs to the given angle
113  tf::Quaternion angleToQuaternion(float pan, float tilt);
114 
115  // ???
116  Eigen::Vector2f getQuadExtent(Eigen::Vector2f pos, float r, float panSize = 5, float tiltSize = 5);
117  };
118 
120 }
static const int ID_SAMPLES_3D
static const int ID_PTU_FOV
action
static const int ID_SAMPLES_2D
static const int GRID_SCALE
boost::shared_ptr< ISMVisualization > ISMVisualizationPtr
static const int ID_TESSELLATED_SPHERE
static const int TS_RADIUS
static const int ID_QUADS


asr_psm_visualizations
Author(s): Gehrung Joachim, Meißner Pascal
autogenerated on Sat Nov 9 2019 03:49:13