Fawkes API  Fawkes Development Version
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  M_Vector4f &centroids,
62  M_Vector4f &cylinder_params,
63  std::map<unsigned int, double> &obj_confidence,
64  std::map<unsigned int, signed int>& best_obj_guess) throw();
65 
66  private:
67  void triangulate_hull();
68 
69  private:
70  fawkes::Mutex mutex_;
71  std::string frame_id_;
72  Eigen::Vector4f table_centroid_;
73  Eigen::Vector4f normal_;
74  V_Vector4f table_hull_vertices_;
75  V_Vector4f table_model_vertices_;
76  V_Vector4f good_table_hull_edges_;
77  V_Vector4f table_triangle_vertices_;
78  M_Vector4f centroids_;
79  M_Vector4f cylinder_params_;
80  std::map<unsigned int, double> obj_confidence_;
81  std::map<unsigned int, signed int> best_obj_guess_;
82  ros::Publisher *vispub_;
83 #ifdef USE_POSEPUB
84  ros::Publisher *posepub_;
85 #endif
86  size_t last_id_num_;
87 
88  bool cfg_show_frustrum_;
89  float cfg_horizontal_va_;
90  float cfg_vertical_va_;
91  bool cfg_show_cvxhull_vertices_;
92  bool cfg_show_cvxhull_line_highlighting_;
93  bool cfg_show_cvxhull_vertex_ids_;
94  unsigned int cfg_duration_;
95  bool cfg_cylinder_fitting_;
96  std::string cfg_base_frame_;
97  public:
98  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
99 };
100 
101 
102 #endif
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
Thread class encapsulation of pthreads.
Definition: thread.h:42
Base class for virtualization thread.
Thread aspect to access the transform system.
Definition: tf.h:42
Definition: act_thread.h:37
Thread aspect to access configuration data.
Definition: configurable.h:35
std::map< unsigned int, Eigen::Vector4f, std::less< unsigned int >, Eigen::aligned_allocator< std::pair< const unsigned int, Eigen::Vector4f > > > M_Vector4f
aligned map of vectors.
Mutex mutual exclusion lock.
Definition: mutex.h:32
Send Marker messages to rviz.