Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
visualization_thread.h
1 
2 /***************************************************************************
3  * visualization_thread.h - Visualization via rviz
4  *
5  * Created: Fri Nov 11 00:11:23 2011
6  * Copyright 2011 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __PLUGINS_PERCEPTION_TABLETOP_OBJECTS_VISUALIZATION_THREAD_H_
23 #define __PLUGINS_PERCEPTION_TABLETOP_OBJECTS_VISUALIZATION_THREAD_H_
24 
25 #ifndef HAVE_VISUAL_DEBUGGING
26 # error TabletopVisualizationThread was disabled by build flags
27 #endif
28 
29 #include "visualization_thread_base.h"
30 
31 #include <core/threading/thread.h>
32 #include <core/threading/mutex.h>
33 #include <aspect/tf.h>
34 #include <aspect/configurable.h>
35 #include <plugins/ros/aspect/ros.h>
36 
37 namespace ros {
38  class Publisher;
39 }
40 
43  public fawkes::Thread,
46  public fawkes::ROSAspect
47 {
48  public:
50 
51  virtual void init();
52  virtual void loop();
53  virtual void finalize();
54 
55  virtual void visualize(const std::string &frame_id,
56  Eigen::Vector4f &table_centroid,
57  Eigen::Vector4f &normal,
58  V_Vector4f &table_hull_vertices,
59  V_Vector4f &table_model_vertices,
60  V_Vector4f &good_table_hull_edges,
61  V_Vector4f &centroids) throw();
62 
63  private:
64  void triangulate_hull();
65 
66  private:
67  fawkes::Mutex mutex_;
68  std::string frame_id_;
69  Eigen::Vector4f table_centroid_;
70  Eigen::Vector4f normal_;
71  V_Vector4f table_hull_vertices_;
72  V_Vector4f table_model_vertices_;
73  V_Vector4f good_table_hull_edges_;
74  V_Vector4f table_triangle_vertices_;
75  V_Vector4f centroids_;
76  ros::Publisher *vispub_;
77 #ifdef USE_POSEPUB
78  ros::Publisher *posepub_;
79 #endif
80  size_t last_id_num_;
81 
82  bool cfg_show_frustrum_;
83  float cfg_horizontal_va_;
84  float cfg_vertical_va_;
85  bool cfg_show_cvxhull_vertices_;
86  bool cfg_show_cvxhull_line_highlighting_;
87  bool cfg_show_cvxhull_vertex_ids_;
88  unsigned int cfg_duration_;
89  public:
90  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
91 };
92 
93 
94 #endif
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
virtual void loop()
Code to execute in the thread.
std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > V_Vector4f
Aligned vector of vectors/points.
Thread class encapsulation of pthreads.
Definition: thread.h:42
Base class for virtualization thread.
Thread aspect to access the transform system.
Definition: tf.h:38
virtual void init()
Initialize the thread.
Thread aspect to access configuration data.
Definition: configurable.h:35
virtual void visualize(const std::string &frame_id, Eigen::Vector4f &table_centroid, Eigen::Vector4f &normal, V_Vector4f &table_hull_vertices, V_Vector4f &table_model_vertices, V_Vector4f &good_table_hull_edges, V_Vector4f &centroids)
Visualize the given data.
virtual void finalize()
Finalize the thread.
Mutex mutual exclusion lock.
Definition: mutex.h:32
Send Marker messages to rviz.