ArVizDrawer.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @author Fabian Reister ( fabian dot reister at kit dot edu )
17  * @date 2021
18  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19  * GNU General Public License
20  */
21 
22 #pragma once
23 
24 #include <string>
25 #include <vector>
26 
27 #include <SimoxUtility/color/Color.h>
28 #include <VirtualRobot/VirtualRobot.h>
29 
33 
36 
38 {
39 
41  {
42  public:
43  using Points = std::vector<Eigen::Vector2f>;
44 
45  struct Parameters
46  {
47  bool drawCircles = true;
48  bool drawConvexHulls = true;
49  bool drawEllipsoids = true;
50  bool drawChains = true;
51  };
52 
53  ArVizDrawer(armarx::viz::Client& arviz, const Parameters& parameters) :
54  arviz(arviz), parameters(parameters)
55  {
56  }
57 
58  void draw(const std::vector<Features>& features,
59  const std::string& frame,
60  const Eigen::Isometry3f& globalSensorPose);
61 
63  const Eigen::Isometry3f& globalSensorPose,
64  const simox::Color& color);
65 
66  void draw(const std::string& layerName,
67  const Circle& circle,
68  const Eigen::Isometry3f& robotGlobalPose,
69  const simox::Color& color);
70 
71  void draw(const std::string& layerName,
72  const VirtualRobot::MathTools::ConvexHull2D& robotHull,
73  const Eigen::Isometry3f& robotGlobalPose,
74  const simox::Color& color = simox::Color::red(100, 80));
75 
76  private:
77  void drawCircles(const std::vector<Features>& features,
78  const std::string& frame,
79  const Eigen::Isometry3f& globalSensorPose);
80  void drawCircle(viz::Layer& layer,
81  const Circle& circle,
82  const Eigen::Isometry3f& globalSensorPose,
83  const simox::Color& color);
84 
85  void drawConvexHulls(const std::vector<Features>& features,
86  const std::string& frame,
87  const Eigen::Isometry3f& globalSensorPose);
88  void drawConvexHull(viz::Layer& layer,
89  const VirtualRobot::MathTools::ConvexHull2D& hull,
90  const Eigen::Isometry3f& globalSensorPose,
91  const simox::Color& color);
92 
93  void drawEllipsoids(const std::vector<Features>& features,
94  const std::string& frame,
95  const Eigen::Isometry3f& globalSensorPose);
96 
97  void drawEllipsoid(viz::Layer& layer,
98  const Ellipsoid& ellipsoid,
99  const Eigen::Isometry3f& globalSensorPose);
100 
101  void drawChains(const std::vector<Features>& features,
102  const std::string& frame,
103  const Eigen::Isometry3f& globalSensorPose);
104  void drawChain(viz::Layer& layer,
105  const Points& chain,
106  const Eigen::Isometry3f& globalSensorPose);
107 
108  armarx::viz::Client arviz;
109 
110  const Parameters parameters;
111  };
112 } // namespace armarx::navigation::components::laser_scanner_feature_extraction
Client.h
armarx::armem::laser_scans::LaserScanStamped
Definition: types.h:40
armarx::navigation::components::laser_scanner_feature_extraction::ArVizDrawer::ArVizDrawer
ArVizDrawer(armarx::viz::Client &arviz, const Parameters &parameters)
Definition: ArVizDrawer.h:53
Layer.h
types.h
armarx::skills::gui::Parameters
aron::data::DictPtr Parameters
Definition: SkillManagerWrapper.h:21
armarx::navigation::components::laser_scanner_feature_extraction::ArVizDrawer::Points
std::vector< Eigen::Vector2f > Points
Definition: ArVizDrawer.h:43
EnclosingEllipsoid.h
FeatureExtractor.h
Color
uint32_t Color
RGBA color.
Definition: color.h:8
armarx::navigation::components::laser_scanner_feature_extraction::ArVizDrawer::Parameters::drawConvexHulls
bool drawConvexHulls
Definition: ArVizDrawer.h:48
armarx::navigation::memory::Ellipsoid
Definition: types.h:33
armarx::navigation::components::laser_scanner_feature_extraction::ArVizDrawer::Parameters::drawEllipsoids
bool drawEllipsoids
Definition: ArVizDrawer.h:49
armarx::navigation::components::laser_scanner_feature_extraction::ArVizDrawer::Parameters::drawCircles
bool drawCircles
Definition: ArVizDrawer.h:47
armarx::navigation::memory::Circle
Definition: types.h:40
armarx::red
QColor red()
Definition: StyleSheets.h:78
armarx::navigation::components::laser_scanner_feature_extraction::ArVizDrawer
Definition: ArVizDrawer.h:40
armarx::navigation::components::laser_scanner_feature_extraction::ArVizDrawer::Parameters
Definition: ArVizDrawer.h:45
armarx::viz::Client
Definition: Client.h:117
armarx::navigation::components::laser_scanner_feature_extraction
Definition: ArVizDrawer.cpp:28
armarx::viz::Layer
Definition: Layer.h:12
armarx::navigation::components::laser_scanner_feature_extraction::ArVizDrawer::Parameters::drawChains
bool drawChains
Definition: ArVizDrawer.h:50
armarx::navigation::components::laser_scanner_feature_extraction::ArVizDrawer::draw
void draw(const std::vector< Features > &features, const std::string &frame, const Eigen::Isometry3f &globalSensorPose)
Definition: ArVizDrawer.cpp:32