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 <aspect/configurable.h>
32#include <aspect/tf.h>
33#include <core/threading/mutex.h>
34#include <core/threading/thread.h>
35#include <plugins/ros/aspect/ros.h>
36
37namespace ros {
38class Publisher;
39}
40
42 public fawkes::Thread,
46{
47public:
49
50 virtual void init();
51 virtual void loop();
52 virtual void finalize();
53
54 virtual void visualize(const std::string & frame_id,
55 Eigen::Vector4f & table_centroid,
56 Eigen::Vector4f & normal,
57 V_Vector4f & table_hull_vertices,
58 V_Vector4f & table_model_vertices,
59 V_Vector4f & good_table_hull_edges,
60 M_Vector4f & centroids,
61 M_Vector4f & cylinder_params,
62 std::map<unsigned int, double> & obj_confidence,
63 std::map<unsigned int, signed int> &best_obj_guess) noexcept;
64
65private:
66 void triangulate_hull();
67
68private:
69 fawkes::Mutex mutex_;
70 std::string frame_id_;
71 Eigen::Vector4f table_centroid_;
72 Eigen::Vector4f normal_;
73 V_Vector4f table_hull_vertices_;
74 V_Vector4f table_model_vertices_;
75 V_Vector4f good_table_hull_edges_;
76 V_Vector4f table_triangle_vertices_;
77 M_Vector4f centroids_;
78 M_Vector4f cylinder_params_;
79 std::map<unsigned int, double> obj_confidence_;
80 std::map<unsigned int, signed int> best_obj_guess_;
81 ros::Publisher * vispub_;
82#ifdef USE_POSEPUB
83 ros::Publisher *posepub_;
84#endif
85 size_t last_id_num_;
86
87 bool cfg_show_frustrum_;
88 float cfg_horizontal_va_;
89 float cfg_vertical_va_;
90 bool cfg_show_cvxhull_vertices_;
91 bool cfg_show_cvxhull_line_highlighting_;
92 bool cfg_show_cvxhull_vertex_ids_;
93 unsigned int cfg_duration_;
94 bool cfg_cylinder_fitting_;
95 std::string cfg_base_frame_;
96
97public:
98 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
99};
100
101#endif
Base class for virtualization thread.
std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > V_Vector4f
Aligned vector of vectors/points.
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.
Send Marker messages to rviz.
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
virtual void finalize()
Finalize the thread.
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, M_Vector4f &centroids, M_Vector4f &cylinder_params, std::map< unsigned int, double > &obj_confidence, std::map< unsigned int, signed int > &best_obj_guess) noexcept
Visualize the given data.
Thread aspect to access configuration data.
Definition: configurable.h:33
Mutex mutual exclusion lock.
Definition: mutex.h:33
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
Thread class encapsulation of pthreads.
Definition: thread.h:46
Thread aspect to access the transform system.
Definition: tf.h:39