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);
239 semrel::VisualizerInterface::setMinimumVisuLevel(getVisualizationLevel(defs, propertyName));
Default component property definition container.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Abstract PropertyUser class.
Property< PropertyType > getProperty(const std::string &name)
Property creation and retrieval.
virtual void drawCylinder(semrel::VisuMetaInfo id, const semrel::Cylinder &cylinder, semrel::DrawColor color) override
virtual void drawLine(semrel::VisuMetaInfo id, const Eigen::Vector3f &start, const Eigen::Vector3f &end, float lineWidth, semrel::DrawColor color) override
virtual void clearLayer(const std::string &layer) override
virtual void drawPointCloud(semrel::VisuMetaInfo id, const std::vector< Eigen::Vector3f > &cloud, float pointSize, semrel::DrawColor color) override
virtual void drawPolygon(semrel::VisuMetaInfo id, const std::vector< Eigen::Vector3f > &polygonPoints, float lineWidth, semrel::DrawColor colorInner, semrel::DrawColor colorBorder) override
virtual void drawTriMesh(semrel::VisuMetaInfo id, const semrel::TriMesh &mesh, semrel::DrawColor color) override
virtual void clearAll() override
virtual void drawText(semrel::VisuMetaInfo id, const std::string &text, const Eigen::Vector3f &position, float size, semrel::DrawColor color) override
virtual void drawBox(semrel::VisuMetaInfo id, const semrel::Box &box, semrel::DrawColor color) override
virtual void drawArrow(semrel::VisuMetaInfo id, const Eigen::Vector3f &origin, const Eigen::Vector3f &direction, float length, float width, semrel::DrawColor color) override
ArmarXVisualizer(armarx::DebugDrawerInterfacePrx const &debugDrawer)
virtual void drawSphere(semrel::VisuMetaInfo id, const semrel::Sphere &sphere, semrel::DrawColor color) override
static void setAsImplementation(const armarx::DebugDrawerInterfacePrx &debugDrawer)
Quaternion< float, 0 > Quaternionf
const std::string visualizationLevelDescription
const std::string visualizationLevelName
semrel::VisuLevel getVisualizationLevel(armarx::PropertyUser &defs, const std::string &propertyName=defaults::visualizationLevelName)
void defineVisualizationLevel(armarx::ComponentPropertyDefinitions &defs, const std::string &propertyName=defaults::visualizationLevelName, semrel::VisuLevel defaultLevel=semrel::VisuLevel::RESULT, const std::string &description=defaults::visualizationLevelDescription)
void setMinimumVisuLevel(armarx::PropertyUser &defs, const std::string &propertyName=defaults::visualizationLevelName)
IceInternal::Handle< Vector3 > Vector3Ptr
IceInternal::Handle< Pose > PosePtr
IceInternal::Handle< Quaternion > QuaternionPtr
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface > DebugDrawerInterfacePrx