Visu.cpp
Go to the documentation of this file.
1 #include "Visu.h"
2 
4 
6 {
7  void
9  const std::string& id,
10  const Eigen::Matrix4f& locationGlobalPose) const
11  {
12  // Add global location to layer
13  layer.add(armarx::viz::Pose(id).pose(locationGlobalPose));
14  layer.add(armarx::viz::Arrow(id + "_dir")
15  .pose(locationGlobalPose)
16  .length(110)
17  .width(7.5)
18  .color(this->settings.framedLocationArrowColor));
19  }
20 
21  void
23  const std::string& id,
24  const Eigen::Matrix4f& locationGlobalPose,
25  const Eigen::Vector3f& extends) const
26  {
27  // Add global location to layer
28  layer.add(armarx::viz::Box(id)
29  .pose(locationGlobalPose)
30  .size(extends)
31  .color(this->settings.framedBoxedLocationColor));
32  }
33 
35  Visu::locationsToLayer(const std::string& layerName,
36  const std::map<std::string, FramedLocationData>& locationData) const
37  {
38  auto layer = arviz.layer(layerName);
39  for (auto& [id, data] : locationData)
40  {
41  if (data.extents.has_value())
42  {
43  addFramedBoxedLocationToLayer(layer, id, data.globalPose, data.extents.value());
44  }
45  else
46  {
47  addFramedLocationToLayer(layer, id, data.globalPose);
48  }
49  }
50  return layer;
51  }
52 
55  const std::string& layerName,
56  const std::map<std::string, Eigen::Matrix4f>& locationGlobalPoses) const
57  {
58  auto layer = arviz.layer(layerName);
59  for (auto& [id, pose] : locationGlobalPoses)
60  {
61  // Add global location to layer
62  addFramedLocationToLayer(layer, id, pose);
63  }
64  return layer;
65  }
66 
69  const std::string& layerName,
70  const std::map<std::string, std::pair<Eigen::Matrix4f, Eigen::Vector3f>>&
71  locationGlobalPosesAndExtends) const
72  {
73  auto layer = arviz.layer(layerName);
74  for (auto& [id, pair] : locationGlobalPosesAndExtends)
75  {
76  const auto& pose = pair.first;
77  const auto& extends = pair.second;
78 
79  // Add global location to layer
80  addFramedBoxedLocationToLayer(layer, id, pose, extends);
81  }
82  return layer;
83  }
84 } // namespace armarx::priorknowledge::util::location
armarx::priorknowledge::util::location::Visu::framedBoxedLocationsToLayer
viz::Layer framedBoxedLocationsToLayer(const std::string &layerName, const std::map< std::string, std::pair< Eigen::Matrix4f, Eigen::Vector3f >> &locationGlobalPosesAndExtends) const
Definition: Visu.cpp:68
armarx::priorknowledge::util::location::Visu::Settings::framedBoxedLocationColor
viz::Color framedBoxedLocationColor
Definition: Visu.h:57
armarx::priorknowledge::util::location::Visu::addFramedBoxedLocationToLayer
void addFramedBoxedLocationToLayer(viz::Layer &, const std::string &id, const Eigen::Matrix4f &locationGlobalPose, const Eigen::Vector3f &extends) const
Definition: Visu.cpp:22
armarx::viz::Arrow
Definition: Elements.h:198
armarx::priorknowledge::util::location::Visu::arviz
viz::Client & arviz
Definition: Visu.h:62
armarx::viz::Layer::add
void add(ElementT const &element)
Definition: Layer.h:29
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::viz::Box
Definition: Elements.h:51
armarx::viz::Pose
Definition: Elements.h:179
Visu.h
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::priorknowledge::util::location::Visu::settings
struct armarx::priorknowledge::util::location::Visu::Settings settings
armarx::priorknowledge::util::location::Visu::Settings::framedLocationArrowColor
viz::Color framedLocationArrowColor
Definition: Visu.h:54
armarx::priorknowledge::util::location::Visu::addFramedLocationToLayer
void addFramedLocationToLayer(viz::Layer &, const std::string &id, const Eigen::Matrix4f &locationGlobalPose) const
Definition: Visu.cpp:8
armarx::priorknowledge::util::location::Visu::locationsToLayer
viz::Layer locationsToLayer(const std::string &layerName, const std::map< std::string, FramedLocationData > &locationData) const
Definition: Visu.cpp:35
Logging.h
armarx::viz::Client::layer
Layer layer(std::string const &name) const
Definition: Client.cpp:73
armarx::priorknowledge::util::location
Definition: Visu.cpp:5
armarx::viz::Layer
Definition: Layer.h:12
armarx::priorknowledge::util::location::Visu::framedLocationsToLayer
viz::Layer framedLocationsToLayer(const std::string &layerName, const std::map< std::string, Eigen::Matrix4f > &locationGlobalPoses) const
Definition: Visu.cpp:54