9 toArmarx(
const Eigen::Vector3f&
v)
26 static armarx::DrawColor
27 toArmarx(
const semrel::DrawColor& color)
29 return armarx::DrawColor{color.r, color.g, color.b, color.a};
35 semrel::VisualizerInterface::setImplementation(
36 std::make_shared<ArmarXVisualizer>(debugDrawer));
53 drawer->clearLayer(layer);
58 const Eigen::Vector3f& start,
59 const Eigen::Vector3f& end,
61 semrel::DrawColor color)
64 id.layer,
id.name, toArmarx(start), toArmarx(end), lineWidth, toArmarx(color));
69 const Eigen::Vector3f& origin,
70 const Eigen::Vector3f& direction,
73 semrel::DrawColor color)
75 drawer->setArrowVisu(
id.layer,
86 const semrel::Box& box,
87 semrel::DrawColor color)
89 drawer->setBoxVisu(
id.layer,
91 toArmarx(box.getPosition(), box.getOrientation()),
92 toArmarx(box.getExtents()),
98 const semrel::Cylinder& cylinder,
99 semrel::DrawColor color)
101 drawer->setCylinderVisu(
id.layer,
103 toArmarx(cylinder.getPosition()),
104 toArmarx(cylinder.getAxisDirection()),
105 cylinder.getHeight(),
106 cylinder.getRadius(),
112 const semrel::Sphere& sphere,
113 semrel::DrawColor color)
115 drawer->setSphereVisu(
116 id.layer,
id.name, toArmarx(sphere.getPosition()), toArmarx(color), sphere.getRadius());
121 const std::vector<Eigen::Vector3f>& polygonPoints,
123 semrel::DrawColor colorInner,
124 semrel::DrawColor colorBorder)
126 armarx::PolygonPointList armarxPoints;
127 for (
const Eigen::Vector3f&
v : polygonPoints)
129 armarxPoints.push_back(toArmarx(
v));
132 drawer->setPolygonVisu(
id.layer,
135 toArmarx(colorInner),
136 toArmarx(colorBorder),
142 const semrel::TriMesh& mesh,
143 semrel::DrawColor color)
157 for (semrel::TriMesh::Triangle triangle : mesh.getTriangles())
159 semrel::VisuMetaInfo triID = id;
160 std::stringstream ss;
161 ss << triID.name <<
"_" << i;
162 triID.name = ss.str();
164 Eigen::Vector3f v0 = mesh.getVertex(triangle.v0);
165 Eigen::Vector3f v1 = mesh.getVertex(triangle.v1);
166 Eigen::Vector3f v2 = mesh.getVertex(triangle.v2);
167 std::vector<Eigen::Vector3f> points;
168 points.push_back(v0);
169 points.push_back(v1);
170 points.push_back(v2);
172 semrel::DrawColor inner = color;
182 const std::string& text,
183 const Eigen::Vector3f& position,
185 semrel::DrawColor color)
188 id.layer,
id.name, text, toArmarx(position), toArmarx(color),
int(roundf(size)));
193 const std::vector<Eigen::Vector3f>& cloud,
195 semrel::DrawColor color)
197 armarx::DrawColor armarxColor = toArmarx(color);
199 armarx::DebugDrawerColoredPointCloud ddPointcloud;
200 ddPointcloud.pointSize = pointSize;
202 for (
const Eigen::Vector3f&
v : cloud)
204 armarx::DebugDrawerColoredPointCloudElement el{
v(0),
v(1),
v(2), armarxColor};
205 ddPointcloud.points.push_back(el);
208 drawer->setColoredPointCloudVisu(
id.layer,
id.name, ddPointcloud);
213 "Visualization level: Determines what is shown in the debug drawer.\n"
214 "Possible values: live, verbose, result, user, disabled";
218 const std::string& propertyName,
219 semrel::VisuLevel defaultLevel,
220 const std::string& description)
223 .map(
"live", semrel::VisuLevel::LIVE_VISU)
224 .map(
"verbose", semrel::VisuLevel::VERBOSE)
225 .map(
"result", semrel::VisuLevel::RESULT)
226 .map(
"user", semrel::VisuLevel::USER)
227 .map(
"disabled", semrel::VisuLevel::DISABLED);
233 return defs.
getProperty<semrel::VisuLevel>(propertyName);