DebugDrawerTopic Class Reference

The DebugDrawerTopic wraps a DebugDrawerInterfacePrx and provides a more useful interface than the Ice interface. More...

#include <RobotAPI/libraries/core/visualization/DebugDrawerTopic.h>

Classes

struct  Defaults
 Default values for drawing functions. More...
 
struct  VisuID
 A visualisation ID. More...
 

Public Member Functions

void clearAll (bool sleep=false)
 Clear all layers.
 
void clearColoredPointCloud (const VisuID &id)
 Forces the "deletion" of a point cloud by drawing an empty one.
 
void clearLayer (bool sleep=false)
 Clear the (set default) layer.
 
void clearLayer (const std::string &layer, bool sleep=false)
 Clear the given layer.
 
 DebugDrawerTopic (const DebugDrawerInterfacePrx &topic, const std::string &layer=DEFAULT_LAYER)
 Construct with given topic and optional layer.
 
 DebugDrawerTopic (const std::string &layer=DEFAULT_LAYER)
 Construct without topic, and optional layer.
 
void drawArrow (const VisuID &id, const Eigen::Vector3f &position, const Eigen::Vector3f &direction, float length, float width, const DrawColor &color=DEFAULTS.colorArrow, bool ignoreLengthScale=false)
 Draw an arrow with position (start) and direction.
 
void drawArrowFromTo (const VisuID &id, const Eigen::Vector3f &from, const Eigen::Vector3f &to, float width, const DrawColor &color=DEFAULTS.colorArrow, bool ignoreLengthScale=false)
 Draw an arrow with start and end.
 
void drawBox (const VisuID &id, const Eigen::Matrix4f &pose, const Eigen::Vector3f &extents, const DrawColor &color=DEFAULTS.colorBox, bool ignoreLengthScale=false)
 Draw a box.
 
void drawBox (const VisuID &id, const Eigen::Vector3f &position, const Eigen::Quaternionf &orientation, const Eigen::Vector3f &extents, const DrawColor &color=DEFAULTS.colorBox, bool ignoreLengthScale=false)
 Draw a box.
 
void drawBox (const VisuID &id, const VirtualRobot::BoundingBox &boundingBox, const DrawColor &color=DEFAULTS.colorBox, bool ignoreLengthScale=false)
 Draw an axis aligned bounding box.
 
void drawBox (const VisuID &id, const VirtualRobot::BoundingBox &boundingBox, const Eigen::Matrix4f &pose, const DrawColor &color=DEFAULTS.colorBox, bool ignoreLengthScale=false)
 Draw a locally axis aligned bounding box, transformed by the given pose.
 
void drawBoxEdges (const VisuID &id, const Eigen::Matrix32f &aabb, const Eigen::Matrix4f &pose, float width=DEFAULTS.boxEdgesWidth, const DrawColor &color=DEFAULTS.boxEdgesColor, bool ignoreLengthScale=false)
 Draw edges of a locally axis-aligned bounding box, transformed by the given pose (as a line set).
 
void drawBoxEdges (const VisuID &id, const Eigen::Matrix32f &aabb, float width=DEFAULTS.boxEdgesWidth, const DrawColor &color=DEFAULTS.boxEdgesColor, bool ignoreLengthScale=false)
 Draw edges of an axis aligned bounding box (as a line set).
 
void drawBoxEdges (const VisuID &id, const Eigen::Matrix4f &pose, const Eigen::Vector3f &extents, float width=DEFAULTS.boxEdgesWidth, const DrawColor &color=DEFAULTS.boxEdgesColor, bool ignoreLengthScale=false)
 Draw box edges (as a line set).
 
void drawBoxEdges (const VisuID &id, const Eigen::Vector3f &position, const Eigen::Quaternionf &orientation, const Eigen::Vector3f &extents, float width=DEFAULTS.boxEdgesWidth, const DrawColor &color=DEFAULTS.boxEdgesColor, bool ignoreLengthScale=false)
 Draw box edges (as a line set).
 
void drawBoxEdges (const VisuID &id, const VirtualRobot::BoundingBox &boundingBox, const Eigen::Matrix4f &pose, float width=DEFAULTS.boxEdgesWidth, const DrawColor &color=DEFAULTS.boxEdgesColor, bool ignoreLengthScale=false)
 Draw edges of a locally axis-aligned bounding box, transformed by the given pose (as a line set).
 
void drawBoxEdges (const VisuID &id, const VirtualRobot::BoundingBox &boundingBox, float width=DEFAULTS.boxEdgesWidth, const DrawColor &color=DEFAULTS.boxEdgesColor, bool ignoreLengthScale=false)
 Draw edges of an axis aligned bounding box (as a line set).
 
void drawCylinder (const VisuID &id, const Eigen::Vector3f &center, const Eigen::Quaternionf &orientation, float length, float radius, const DrawColor &color=DEFAULTS.colorCylinder, bool ignoreLengthScale=false)
 Draw a cylinder with center and orientation.
 
void drawCylinder (const VisuID &id, const Eigen::Vector3f &center, const Eigen::Vector3f &direction, float length, float radius, const DrawColor &color=DEFAULTS.colorCylinder, bool ignoreLengthScale=false)
 Draw a cylinder with center and direction.
 
void drawCylinderFromTo (const VisuID &id, const Eigen::Vector3f &from, const Eigen::Vector3f &to, float radius, const DrawColor &color=DEFAULTS.colorCylinder, bool ignoreLengthScale=false)
 Draw a cylinder from start to end.
 
void drawFloor (const VisuID &id={"floor"}, const Eigen::Vector3f &at=Eigen::Vector3f::Zero(), const Eigen::Vector3f &up=Eigen::Vector3f::UnitZ(), float size=5, const DrawColor &color=DEFAULTS.colorFloor, bool ignoreLengthScale=false)
 Draw a quad representing the floor.
 
void drawLine (const VisuID &id, const Eigen::Vector3f &from, const Eigen::Vector3f &to, float width, const DrawColor &color=DEFAULTS.colorLine, bool ignoreLengthScale=false)
 Draw a line from start to end.
 
void drawLineSet (const VisuID &id, const DebugDrawerLineSet &lineSet, bool ignoreLengthScale=false)
 Draw a line set.
 
void drawLineSet (const VisuID &id, const std::vector< Eigen::Vector3f > &points, float width, const DrawColor &color=DEFAULTS.colorLine, bool ignoreLengthScale=false)
 Draw a set of lines with constant color.
 
void drawLineSet (const VisuID &id, const std::vector< Eigen::Vector3f > &points, float width, const DrawColor &colorA, const DrawColor &colorB, const std::vector< float > &intensitiesB, bool ignoreLengthScale=false)
 Draw a set of lines with constant color.
 
void drawPointCloud (const VisuID &id, const DebugDrawer24BitColoredPointCloud &pointCloud)
 Draw a 24 bit colored point cloud.
 
void drawPointCloud (const VisuID &id, const DebugDrawerColoredPointCloud &pointCloud)
 Draw a colored point cloud.
 
void drawPointCloud (const VisuID &id, const DebugDrawerPointCloud &pointCloud)
 Draw a non-colored point cloud.
 
template<class PointCloudT, class ColorFuncT>
void drawPointCloud (const VisuID &id, const PointCloudT &pointCloud, const ColorFuncT &colorFunc, float pointSize=DEFAULTS.pointCloudPointSize, bool ignoreLengthScale=false)
 Draw a colored point cloud with custom colors.
 
template<class PointCloudT>
void drawPointCloud (const VisuID &id, const PointCloudT &pointCloud, const DrawColor &color=DEFAULTS.colorPointCloud, float pointSize=DEFAULTS.pointCloudPointSize, bool ignoreLengthScale=false)
 Draw a unicolored point cloud.
 
template<class PointCloudT>
void drawPointCloudLabeled (const VisuID &id, const PointCloudT &pointCloud, float pointSize=DEFAULTS.pointCloudPointSize, bool ignoreLengthScale=false)
 Draw a colored point cloud with colors according to labels.
 
template<class PointCloudT>
void drawPointCloudRGBA (const VisuID &id, const PointCloudT &pointCloud, float pointSize=DEFAULTS.pointCloudPointSize, bool ignoreLengthScale=false)
 Draw a colored point cloud with RGBA information.
 
void drawPolygon (const VisuID &id, const std::vector< Eigen::Vector3f > &points, const DrawColor &colorFace, float lineWidth=0, const DrawColor &colorEdge=DEFAULTS.colorPolygonEdge, bool ignoreLengthScale=false)
 Draw a polygon.
 
void drawPose (const VisuID &id, const Eigen::Matrix4f &pose, bool ignoreLengthScale=false)
 Draw a pose (with the preset scale).
 
void drawPose (const VisuID &id, const Eigen::Matrix4f &pose, float scale, bool ignoreLengthScale=false)
 Draw a pose with the given scale.
 
void drawPose (const VisuID &id, const Eigen::Vector3f &pos, const Eigen::Quaternionf &ori, bool ignoreLengthScale=false)
 Draw a pose (with the preset scale).
 
void drawPose (const VisuID &id, const Eigen::Vector3f &pos, const Eigen::Quaternionf &ori, float scale, bool ignoreLengthScale=false)
 Draw a pose with the given scale.
 
void drawRobot (const VisuID &id, const std::string &robotFile, const std::string &armarxProject, armarx::DrawStyle drawStyle=armarx::DrawStyle::FullModel)
 Draw a robot.
 
void drawSphere (const VisuID &id, const Eigen::Vector3f &center, float radius, const DrawColor &color=DEFAULTS.colorSphere, bool ignoreLengthScale=false)
 Draw a sphere.
 
void drawText (const VisuID &id, const Eigen::Vector3f &position, const std::string &text, int size=10, const DrawColor color=DEFAULTS.colorText, bool ignoreLengthScale=false)
 Draw text at the specified position.
 
void drawTriMesh (const VisuID &id, const VirtualRobot::TriMeshModel &triMesh, const DrawColor &color={.5,.5,.5, 1}, bool ignoreLengthScale=false)
 Draw a TriMeshModel as DebugDrawerTriMesh.
 
void drawTriMeshAsPolygons (const VisuID &id, const VirtualRobot::TriMeshModel &trimesh, const DrawColor &colorFace=DEFAULTS.colorPolygonFace, float lineWidth=0, const DrawColor &colorEdge=DEFAULTS.colorPolygonEdge, bool ignoreLengthScale=false)
 Draw a TriMeshModel as individual polygons.
 
void drawTriMeshAsPolygons (const VisuID &id, const VirtualRobot::TriMeshModel &trimesh, const Eigen::Matrix4f &pose, const DrawColor &colorFace=DEFAULTS.colorPolygonFace, float lineWidth=0, const DrawColor &colorEdge=DEFAULTS.colorPolygonEdge, bool ignoreLengthScale=false)
 Draw a TriMeshModel as individual polygons, transformed by the given pose.
 
void drawTriMeshAsPolygons (const VisuID &id, const VirtualRobot::TriMeshModel &trimesh, const std::vector< DrawColor > &faceColorsInner, float lineWidth=0, const DrawColor &colorEdge=DEFAULTS.colorPolygonEdge, bool ignoreLengthScale=false)
 Draw a TriMeshModel as individual polygons with individual face colors.
 
bool enabled () const
 Indicate whether visualization is enabled, i.e. a topic is set and enabled flag is set.
 
const std::string & getLayer () const
 Get the default layer (used if no layer is passed to a method).
 
float getLengthScale () const
 Get the scaling for positions, lengths and distances.
 
float getPoseScale () const
 Get the scale for pose visualization.
 
DebugDrawerInterfacePrx getTopic () const
 Get the topic.
 
void getTopic (ManagedIceObject &component, const std::string &topicNameOverride="")
 Get the topic by calling getTopic([topicName]) on the given component.
 
void offeringTopic (ManagedIceObject &component, const std::string &topicNameOverride="") const
 Call offeringTopic([topicName]) on the given component.
 
 operator bool () const
 Indicate whether visualization is enabled.
 
 operator const DebugDrawerInterfacePrx & () const
 
 operator DebugDrawerInterfacePrx & ()
 Conversion operator to DebugDrawerInterfacePrx.
 
DebugDrawerInterfacePrx & operator-> ()
 Pointer member access operator to access the raw debug drawer proxy.
 
const DebugDrawerInterfacePrx & operator-> () const
 
void removeArrow (const VisuID &id)
 Remove an arrow.
 
void removeBox (const VisuID &id)
 Remove a box.
 
void removeboxEdges (const VisuID &id)
 Remove box edges (as a line set).
 
void removeCylinder (const VisuID &id)
 Remove a cylinder.
 
void removeLine (const VisuID &id)
 Remove a line.
 
void removeLineSet (const VisuID &id)
 Remove a line set.
 
void removePolygon (const VisuID &id)
 Remove a polygon.
 
void removePose (const VisuID &id)
 Remove a pose.
 
void removeRobot (const VisuID &id)
 Remove a robot visualization.
 
void removeSphere (const VisuID &id)
 Remove a sphere.
 
void setEnabled (bool enabled)
 Set whether drawing is enabled.
 
void setLayer (const std::string &layer)
 Set the default layer (used if no layer is passed to a method).
 
void setLengthScale (float scale)
 Set the scale for positions, lengths and distances.
 
void setLengthScaleMetersToMillimeters ()
 Set the scale for positions, lengths and distances to 1000.
 
void setLengthScaleMillimetersToMeters ()
 Set the scale for positions, lengths and distances to 0.001.
 
void setPoseScale (float scale)
 Set the scale for pose visualization. This value will be used for all successive calls to drawPose().
 
void setPoseScaleMeters ()
 Set the pose scale to 0.001 (good when drawing in meters).
 
void setPoseScaleMillimeters ()
 Set the pose scale to 1 (good when drawing in millimeters).
 
template<typename DurationT>
void setShortSleepDuration (const DurationT &duration)
 Set the duration for "short sleeps".
 
void setTopic (const DebugDrawerInterfacePrx &topic)
 Set the topic.
 
void shortSleep ()
 Sleep for the shortSleepDuration. Useful after clearing.
 
template<typename DurationT>
void sleepFor (const DurationT &duration)
 If enabled, sleep for the given duration (e.g. a chrono duration).
 
void updateRobotColor (const VisuID &id, const DrawColor &color)
 Update / set the robot color.
 
void updateRobotConfig (const VisuID &id, const std::map< std::string, float > &config)
 Update / set the robot configuration (joint angles).
 
void updateRobotNodeColor (const VisuID &id, const std::string &nodeName, const DrawColor &color)
 Update / set the color of a robot node.
 
void updateRobotPose (const VisuID &id, const Eigen::Matrix4f &pose, bool ignoreScale=false)
 Update / set the robot pose.
 
void updateRobotPose (const VisuID &id, const Eigen::Vector3f &pos, const Eigen::Quaternionf &ori, bool ignoreScale=false)
 Update / set the robot pose.
 

Static Public Member Functions

static DrawColor getGlasbeyLUTColor (int id, float alpha=1.f)
 Get a color from the Glasbey look-up-table.
 
static DrawColor getGlasbeyLUTColor (std::size_t id, float alpha=1.f)
 
static DrawColor getGlasbeyLUTColor (uint32_t id, float alpha=1.f)
 
static Eigen::Vector3f hsv2rgb (const Eigen::Vector3f &hsv)
 Convert a HSV color RGB.
 
static Eigen::Vector3f rgb2hsv (const Eigen::Vector3f &rgb)
 Convert a RGB color to HSV.
 
template<class ColorT>
static DrawColor toDrawColor (const ColorT &color, float alpha=1, bool byteToFloat=false)
 Construct a DrawColor from the given color type.
 

Static Public Attributes

static const Defaults DEFAULTS = {}
 

Detailed Description

The DebugDrawerTopic wraps a DebugDrawerInterfacePrx and provides a more useful interface than the Ice interface.

The methods by DebugDrawerTopic take "raw" types, such as Eigen or PCL types, and take care of conversion to Ice variants or data structures. In addition, this class provides useful overloads for different use cases.

Drawing is enabled if the internal topic proxy is set and an optional enabled flag is set (true by default). All methods check whether drawing is enabled and do nothing if drawing is disabled. To disable visualization by this class completely, use setEnabled(true/false) or just do not set the topic. To check whether visualization is enabled, use enabled() or just convert *this to bool:

DebugDrawerTopic debugDrawer;
if (debugDrawer) // Equivalent: if (debugDrawer.enabled())
{
// Do stuff if visualization is enabled.
}
DebugDrawerTopic(const std::string &layer=DEFAULT_LAYER)
Construct without topic, and optional layer.
Definition DebugDrawerTopic.cpp:45

The DebugDrawerTopic allows to set a layer on constructor or via setLayer(). This layer will be used if none is passed to a drawing method. If no layer is passed or set, DebugDrawerTopic::DEFAULT_LAYER is used.

Initialisation by Offering and Getting Topic

A DebugDrawerTopic needs an underlying DebugDrawerInterfacePrx topic proxy. This proxy can be passed on construction or set via setTopic(). In a component (or any other ManagedIceObject), DebugDrawerTopic provides convenience functions to register and fetch the topics.

In onInitComponent() (or equivalent method), call:

debugDrawer.offeringTopic(*this);
void offeringTopic(ManagedIceObject &component, const std::string &topicNameOverride="") const
Call offeringTopic([topicName]) on the given component.
Definition DebugDrawerTopic.cpp:80

In onConnectComponent() (or equivalent), call:

debugDrawer.getTopic(*this);
DebugDrawerInterfacePrx getTopic() const
Get the topic.
Definition DebugDrawerTopic.cpp:62

where *this is a ManagedIceObject.

This will call this->offeringTopic("...") and this->getTopic("...") with the correct topic name (DebugDrawerTopic::TOPIC_NAME) and enable the DebugDrawerTopic.

Scaling

DebugDrawerTopic supports length scaling and pose scaling.

If a length scale is set, all visualizations will be scaled up or down by this value. This scaling affects positions, sizes / extents, and distances / lengths. This is useful when drawing quantities of different sources using different scalings (such as meters vs millimeters). Length scale can be set via setPoseScale() or the short hands setPoseScaleMetersToMillimeters() and setPoseScaleMillimetersToMeters().

All applicable methods offer a final argument called ignoreLengthScaling (false by default, expect for robots, see below), which can be set to true to ignore the set length scale for this method call.

Note
Robots are always drawn in their native size (the DebugDrawerInterface offers no size scaling for robots). (That is, robots are drawn in millimeters most of the time.)

In addition, this class allows to set a pose scale, which will be used for all drawn poses (if no other value is passed to drawPose()). This is useful when working with geometries scaled in meters, in which case a pose scale of 0.001 can be used.

Argument Pattern

All drawing methods take a VisuID as first argument, which specifies the name of the visualization and the layer to draw on. There are different ways to specify the first argument. For example, to specify a only the name for a pose, pass just the name:

Eigen::Matrix4f pose = Eigen::Matrix4f::Identity();
std::string name = "pose";
debugDrawer.drawPose(name, pose);
debugDrawer.drawPose({name}, pose); // equivalent to the line above
void drawPose(const VisuID &id, const Eigen::Matrix4f &pose, bool ignoreLengthScale=false)
Draw a pose (with the preset scale).
Definition DebugDrawerTopic.cpp:705

This will draw a pose on the preset layer (i.e. the layer passed to the constructor or set via setLayer(), or "debug" by default). To specify both name and layer of a single visualization, pass both in an initializer list:

Eigen::Matrix4f pose = Eigen::Matrix4f::Identity();
std::string layer = "layer";
std::string name = "pose";
debugDrawer.drawPose({layer, name}, pose);

After the VisuID, usually the essential geometric parameters follow, (e.g. position, size, length, point list, ...), depending on the type of visualization. Finally, decorative parameters like colors and width can be passed. Most of the time, they have sensible default values and can be omitted for quick-and-dirty drawing.

(Added methods should adhere to this pattern.)

See also
DebugDrawerTopic::VisuID

Constructor & Destructor Documentation

◆ DebugDrawerTopic() [1/2]

DebugDrawerTopic ( const std::string & layer = DEFAULT_LAYER)

Construct without topic, and optional layer.

◆ DebugDrawerTopic() [2/2]

DebugDrawerTopic ( const DebugDrawerInterfacePrx & topic,
const std::string & layer = DEFAULT_LAYER )

Construct with given topic and optional layer.

Member Function Documentation

◆ clearAll()

void clearAll ( bool sleep = false)

Clear all layers.

Parameters
sleepIf true, do a short sleep clearing.

◆ clearColoredPointCloud()

void clearColoredPointCloud ( const VisuID & id)

Forces the "deletion" of a point cloud by drawing an empty one.

◆ clearLayer() [1/2]

void clearLayer ( bool sleep = false)

Clear the (set default) layer.

Parameters
sleepIf true, do a short sleep clearing.

◆ clearLayer() [2/2]

void clearLayer ( const std::string & layer,
bool sleep = false )

Clear the given layer.

Parameters
sleepIf true, do a short sleep clearing.

◆ drawArrow()

void drawArrow ( const VisuID & id,
const Eigen::Vector3f & position,
const Eigen::Vector3f & direction,
float length,
float width,
const DrawColor & color = DEFAULTS.colorArrow,
bool ignoreLengthScale = false )

Draw an arrow with position (start) and direction.

◆ drawArrowFromTo()

void drawArrowFromTo ( const VisuID & id,
const Eigen::Vector3f & from,
const Eigen::Vector3f & to,
float width,
const DrawColor & color = DEFAULTS.colorArrow,
bool ignoreLengthScale = false )

Draw an arrow with start and end.

◆ drawBox() [1/4]

void drawBox ( const VisuID & id,
const Eigen::Matrix4f & pose,
const Eigen::Vector3f & extents,
const DrawColor & color = DEFAULTS.colorBox,
bool ignoreLengthScale = false )

Draw a box.

◆ drawBox() [2/4]

void drawBox ( const VisuID & id,
const Eigen::Vector3f & position,
const Eigen::Quaternionf & orientation,
const Eigen::Vector3f & extents,
const DrawColor & color = DEFAULTS.colorBox,
bool ignoreLengthScale = false )

Draw a box.

◆ drawBox() [3/4]

void drawBox ( const VisuID & id,
const VirtualRobot::BoundingBox & boundingBox,
const DrawColor & color = DEFAULTS.colorBox,
bool ignoreLengthScale = false )

Draw an axis aligned bounding box.

◆ drawBox() [4/4]

void drawBox ( const VisuID & id,
const VirtualRobot::BoundingBox & boundingBox,
const Eigen::Matrix4f & pose,
const DrawColor & color = DEFAULTS.colorBox,
bool ignoreLengthScale = false )

Draw a locally axis aligned bounding box, transformed by the given pose.

◆ drawBoxEdges() [1/6]

void drawBoxEdges ( const VisuID & id,
const Eigen::Matrix32f & aabb,
const Eigen::Matrix4f & pose,
float width = DEFAULTS.boxEdgesWidth,
const DrawColor & color = DEFAULTS.boxEdgesColor,
bool ignoreLengthScale = false )

Draw edges of a locally axis-aligned bounding box, transformed by the given pose (as a line set).

◆ drawBoxEdges() [2/6]

void drawBoxEdges ( const VisuID & id,
const Eigen::Matrix32f & aabb,
float width = DEFAULTS.boxEdgesWidth,
const DrawColor & color = DEFAULTS.boxEdgesColor,
bool ignoreLengthScale = false )

Draw edges of an axis aligned bounding box (as a line set).

◆ drawBoxEdges() [3/6]

void drawBoxEdges ( const VisuID & id,
const Eigen::Matrix4f & pose,
const Eigen::Vector3f & extents,
float width = DEFAULTS.boxEdgesWidth,
const DrawColor & color = DEFAULTS.boxEdgesColor,
bool ignoreLengthScale = false )

Draw box edges (as a line set).

◆ drawBoxEdges() [4/6]

void drawBoxEdges ( const VisuID & id,
const Eigen::Vector3f & position,
const Eigen::Quaternionf & orientation,
const Eigen::Vector3f & extents,
float width = DEFAULTS.boxEdgesWidth,
const DrawColor & color = DEFAULTS.boxEdgesColor,
bool ignoreLengthScale = false )

Draw box edges (as a line set).

◆ drawBoxEdges() [5/6]

void drawBoxEdges ( const VisuID & id,
const VirtualRobot::BoundingBox & boundingBox,
const Eigen::Matrix4f & pose,
float width = DEFAULTS.boxEdgesWidth,
const DrawColor & color = DEFAULTS.boxEdgesColor,
bool ignoreLengthScale = false )

Draw edges of a locally axis-aligned bounding box, transformed by the given pose (as a line set).

◆ drawBoxEdges() [6/6]

void drawBoxEdges ( const VisuID & id,
const VirtualRobot::BoundingBox & boundingBox,
float width = DEFAULTS.boxEdgesWidth,
const DrawColor & color = DEFAULTS.boxEdgesColor,
bool ignoreLengthScale = false )

Draw edges of an axis aligned bounding box (as a line set).

◆ drawCylinder() [1/2]

void drawCylinder ( const VisuID & id,
const Eigen::Vector3f & center,
const Eigen::Quaternionf & orientation,
float length,
float radius,
const DrawColor & color = DEFAULTS.colorCylinder,
bool ignoreLengthScale = false )

Draw a cylinder with center and orientation.

An identity orientation represents a cylinder with an axis aligned to the Y-axis.

Parameters
lengthThe full length (not half-length).

◆ drawCylinder() [2/2]

void drawCylinder ( const VisuID & id,
const Eigen::Vector3f & center,
const Eigen::Vector3f & direction,
float length,
float radius,
const DrawColor & color = DEFAULTS.colorCylinder,
bool ignoreLengthScale = false )

Draw a cylinder with center and direction.

Parameters
lengthThe full length (not half-length).

◆ drawCylinderFromTo()

void drawCylinderFromTo ( const VisuID & id,
const Eigen::Vector3f & from,
const Eigen::Vector3f & to,
float radius,
const DrawColor & color = DEFAULTS.colorCylinder,
bool ignoreLengthScale = false )

Draw a cylinder from start to end.

◆ drawFloor()

void drawFloor ( const VisuID & id = {"floor"},
const Eigen::Vector3f & at = Eigen::Vector3f::Zero(),
const Eigen::Vector3f & up = Eigen::Vector3f::UnitZ(),
float size = 5,
const DrawColor & color = DEFAULTS.colorFloor,
bool ignoreLengthScale = false )

Draw a quad representing the floor.

Parameters
atthe quad'S center
upthe up direction (normal of the floor plane)
sizethe quad's edge length

◆ drawLine()

void drawLine ( const VisuID & id,
const Eigen::Vector3f & from,
const Eigen::Vector3f & to,
float width,
const DrawColor & color = DEFAULTS.colorLine,
bool ignoreLengthScale = false )

Draw a line from start to end.

◆ drawLineSet() [1/3]

void drawLineSet ( const VisuID & id,
const DebugDrawerLineSet & lineSet,
bool ignoreLengthScale = false )

Draw a line set.

◆ drawLineSet() [2/3]

void drawLineSet ( const VisuID & id,
const std::vector< Eigen::Vector3f > & points,
float width,
const DrawColor & color = DEFAULTS.colorLine,
bool ignoreLengthScale = false )

Draw a set of lines with constant color.

Parameters
pointsList of start and end points [ s1, e1, s2, e2, ..., sn, en ].

◆ drawLineSet() [3/3]

void drawLineSet ( const VisuID & id,
const std::vector< Eigen::Vector3f > & points,
float width,
const DrawColor & colorA,
const DrawColor & colorB,
const std::vector< float > & intensitiesB,
bool ignoreLengthScale = false )

Draw a set of lines with constant color.

Parameters
pointsList of start and end points [ s1, e1, s2, e2, ..., sn, en ].
colorsList of line colors [ c1, c2, ..., cn ].

◆ drawPointCloud() [1/5]

void drawPointCloud ( const VisuID & id,
const DebugDrawer24BitColoredPointCloud & pointCloud )

Draw a 24 bit colored point cloud.

◆ drawPointCloud() [2/5]

void drawPointCloud ( const VisuID & id,
const DebugDrawerColoredPointCloud & pointCloud )

Draw a colored point cloud.

◆ drawPointCloud() [3/5]

void drawPointCloud ( const VisuID & id,
const DebugDrawerPointCloud & pointCloud )

Draw a non-colored point cloud.

◆ drawPointCloud() [4/5]

template<class PointCloudT, class ColorFuncT>
void drawPointCloud ( const VisuID & id,
const PointCloudT & pointCloud,
const ColorFuncT & colorFunc,
float pointSize = DEFAULTS.pointCloudPointSize,
bool ignoreLengthScale = false )

Draw a colored point cloud with custom colors.

pointCloud must be iterable and its elements must provide members x, y, z. The color of a point is specified by colorFunc, which must be a callable taking an element of pointCloud and returning its color as armarx::DrawColor.

◆ drawPointCloud() [5/5]

template<class PointCloudT>
void drawPointCloud ( const VisuID & id,
const PointCloudT & pointCloud,
const DrawColor & color = DEFAULTS.colorPointCloud,
float pointSize = DEFAULTS.pointCloudPointSize,
bool ignoreLengthScale = false )

Draw a unicolored point cloud.

pointCloud must be iterable and its elements must provide members x, y, z.

◆ drawPointCloudLabeled()

template<class PointCloudT>
void drawPointCloudLabeled ( const VisuID & id,
const PointCloudT & pointCloud,
float pointSize = DEFAULTS.pointCloudPointSize,
bool ignoreLengthScale = false )

Draw a colored point cloud with colors according to labels.

pointCloud must be iterable and its elements must provide members x, y, z, label.

◆ drawPointCloudRGBA()

template<class PointCloudT>
void drawPointCloudRGBA ( const VisuID & id,
const PointCloudT & pointCloud,
float pointSize = DEFAULTS.pointCloudPointSize,
bool ignoreLengthScale = false )

Draw a colored point cloud with RGBA information.

pointCloud must be iterable and its elements must provide members x, y, z, r, g, b, a.

◆ drawPolygon()

void drawPolygon ( const VisuID & id,
const std::vector< Eigen::Vector3f > & points,
const DrawColor & colorFace,
float lineWidth = 0,
const DrawColor & colorEdge = DEFAULTS.colorPolygonEdge,
bool ignoreLengthScale = false )

Draw a polygon.

◆ drawPose() [1/4]

void drawPose ( const VisuID & id,
const Eigen::Matrix4f & pose,
bool ignoreLengthScale = false )

Draw a pose (with the preset scale).

◆ drawPose() [2/4]

void drawPose ( const VisuID & id,
const Eigen::Matrix4f & pose,
float scale,
bool ignoreLengthScale = false )

Draw a pose with the given scale.

◆ drawPose() [3/4]

void drawPose ( const VisuID & id,
const Eigen::Vector3f & pos,
const Eigen::Quaternionf & ori,
bool ignoreLengthScale = false )

Draw a pose (with the preset scale).

◆ drawPose() [4/4]

void drawPose ( const VisuID & id,
const Eigen::Vector3f & pos,
const Eigen::Quaternionf & ori,
float scale,
bool ignoreLengthScale = false )

Draw a pose with the given scale.

◆ drawRobot()

void drawRobot ( const VisuID & id,
const std::string & robotFile,
const std::string & armarxProject,
armarx::DrawStyle drawStyle = armarx::DrawStyle::FullModel )

Draw a robot.

Afterwards, updateRobot*() methods can be used with the same VisuID.

Parameters
robotFileThe robot file. Either an absolute path, or a path relative to the data directory of the ArmarX project specified by armarxProject.
armarxProjectThe name of the ArmarX project keeping the robot model.
drawStyleThe draw style (full or collision model).

◆ drawSphere()

void drawSphere ( const VisuID & id,
const Eigen::Vector3f & center,
float radius,
const DrawColor & color = DEFAULTS.colorSphere,
bool ignoreLengthScale = false )

Draw a sphere.

◆ drawText()

void drawText ( const VisuID & id,
const Eigen::Vector3f & position,
const std::string & text,
int size = 10,
const DrawColor color = DEFAULTS.colorText,
bool ignoreLengthScale = false )

Draw text at the specified position.

Parameters
sizethe text size (in pixels, not affected by length scaling)

◆ drawTriMesh()

void drawTriMesh ( const VisuID & id,
const VirtualRobot::TriMeshModel & triMesh,
const DrawColor & color = {.5, .5, .5, 1},
bool ignoreLengthScale = false )

Draw a TriMeshModel as DebugDrawerTriMesh.

◆ drawTriMeshAsPolygons() [1/3]

void drawTriMeshAsPolygons ( const VisuID & id,
const VirtualRobot::TriMeshModel & trimesh,
const DrawColor & colorFace = DEFAULTS.colorPolygonFace,
float lineWidth = 0,
const DrawColor & colorEdge = DEFAULTS.colorPolygonEdge,
bool ignoreLengthScale = false )

Draw a TriMeshModel as individual polygons.

◆ drawTriMeshAsPolygons() [2/3]

void drawTriMeshAsPolygons ( const VisuID & id,
const VirtualRobot::TriMeshModel & trimesh,
const Eigen::Matrix4f & pose,
const DrawColor & colorFace = DEFAULTS.colorPolygonFace,
float lineWidth = 0,
const DrawColor & colorEdge = DEFAULTS.colorPolygonEdge,
bool ignoreLengthScale = false )

Draw a TriMeshModel as individual polygons, transformed by the given pose.

◆ drawTriMeshAsPolygons() [3/3]

void drawTriMeshAsPolygons ( const VisuID & id,
const VirtualRobot::TriMeshModel & trimesh,
const std::vector< DrawColor > & faceColorsInner,
float lineWidth = 0,
const DrawColor & colorEdge = DEFAULTS.colorPolygonEdge,
bool ignoreLengthScale = false )

Draw a TriMeshModel as individual polygons with individual face colors.

◆ enabled()

bool enabled ( ) const

Indicate whether visualization is enabled, i.e. a topic is set and enabled flag is set.

◆ getGlasbeyLUTColor() [1/3]

DrawColor getGlasbeyLUTColor ( int id,
float alpha = 1.f )
static

Get a color from the Glasbey look-up-table.

◆ getGlasbeyLUTColor() [2/3]

DrawColor getGlasbeyLUTColor ( std::size_t id,
float alpha = 1.f )
static

◆ getGlasbeyLUTColor() [3/3]

DrawColor getGlasbeyLUTColor ( uint32_t id,
float alpha = 1.f )
static

◆ getLayer()

const std::string & getLayer ( ) const

Get the default layer (used if no layer is passed to a method).

◆ getLengthScale()

float getLengthScale ( ) const

Get the scaling for positions, lengths and distances.

◆ getPoseScale()

float getPoseScale ( ) const

Get the scale for pose visualization.

◆ getTopic() [1/2]

DebugDrawerInterfacePrx getTopic ( ) const

Get the topic.

◆ getTopic() [2/2]

void getTopic ( ManagedIceObject & component,
const std::string & topicNameOverride = "" )

Get the topic by calling getTopic([topicName]) on the given component.

Parameters
componentThe component (*this when called from a component).
topicNameOverrideOptional override for the topic name. If left empty (default), uses the standard topic name (see TOPIC_NAME).

◆ hsv2rgb()

Eigen::Vector3f hsv2rgb ( const Eigen::Vector3f & hsv)
static

Convert a HSV color RGB.

Parameters
HSVcolor as [h, s, v] with h in [0 deg, 360 deg] and s, v in [0, 1].
Returns
RGB color as [r, g, b] with r, g, b in [0, 1].

◆ offeringTopic()

void offeringTopic ( ManagedIceObject & component,
const std::string & topicNameOverride = "" ) const

Call offeringTopic([topicName]) on the given component.

Parameters
componentThe component (*this when called from a component).
topicNameOverrideOptional override for the topic name. If left empty (default), uses the standard topic name (see TOPIC_NAME).

◆ operator bool()

operator bool ( ) const

Indicate whether visualization is enabled.

See also
enabled()

◆ operator const DebugDrawerInterfacePrx &()

operator const DebugDrawerInterfacePrx & ( ) const

◆ operator DebugDrawerInterfacePrx &()

operator DebugDrawerInterfacePrx & ( )

Conversion operator to DebugDrawerInterfacePrx.

◆ operator->() [1/2]

DebugDrawerInterfacePrx & operator-> ( )

Pointer member access operator to access the raw debug drawer proxy.

◆ operator->() [2/2]

const DebugDrawerInterfacePrx & operator-> ( ) const

◆ removeArrow()

void removeArrow ( const VisuID & id)

Remove an arrow.

◆ removeBox()

void removeBox ( const VisuID & id)

Remove a box.

◆ removeboxEdges()

void removeboxEdges ( const VisuID & id)

Remove box edges (as a line set).

◆ removeCylinder()

void removeCylinder ( const VisuID & id)

Remove a cylinder.

◆ removeLine()

void removeLine ( const VisuID & id)

Remove a line.

◆ removeLineSet()

void removeLineSet ( const VisuID & id)

Remove a line set.

◆ removePolygon()

void removePolygon ( const VisuID & id)

Remove a polygon.

◆ removePose()

void removePose ( const VisuID & id)

Remove a pose.

◆ removeRobot()

void removeRobot ( const VisuID & id)

Remove a robot visualization.

◆ removeSphere()

void removeSphere ( const VisuID & id)

Remove a sphere.

◆ rgb2hsv()

Eigen::Vector3f rgb2hsv ( const Eigen::Vector3f & rgb)
static

Convert a RGB color to HSV.

Parameters
rgbRGB color as [r, g, b] with r, g, b in [0, 1].
Returns
HSV color as [h, s, v] with h in [0 deg, 360 deg] and s, v in [0, 1].

◆ setEnabled()

void setEnabled ( bool enabled)

Set whether drawing is enabled.

Visualization is only truly enabled if the topic is set.

◆ setLayer()

void setLayer ( const std::string & layer)

Set the default layer (used if no layer is passed to a method).

◆ setLengthScale()

void setLengthScale ( float scale)

Set the scale for positions, lengths and distances.

◆ setLengthScaleMetersToMillimeters()

void setLengthScaleMetersToMillimeters ( )

Set the scale for positions, lengths and distances to 1000.

◆ setLengthScaleMillimetersToMeters()

void setLengthScaleMillimetersToMeters ( )

Set the scale for positions, lengths and distances to 0.001.

◆ setPoseScale()

void setPoseScale ( float scale)

Set the scale for pose visualization. This value will be used for all successive calls to drawPose().

◆ setPoseScaleMeters()

void setPoseScaleMeters ( )

Set the pose scale to 0.001 (good when drawing in meters).

◆ setPoseScaleMillimeters()

void setPoseScaleMillimeters ( )

Set the pose scale to 1 (good when drawing in millimeters).

◆ setShortSleepDuration()

template<typename DurationT>
void setShortSleepDuration ( const DurationT & duration)

Set the duration for "short sleeps".

◆ setTopic()

void setTopic ( const DebugDrawerInterfacePrx & topic)

Set the topic.

◆ shortSleep()

void shortSleep ( )

Sleep for the shortSleepDuration. Useful after clearing.

◆ sleepFor()

template<typename DurationT>
void sleepFor ( const DurationT & duration)

If enabled, sleep for the given duration (e.g. a chrono duration).

◆ toDrawColor()

template<class ColorT>
DrawColor toDrawColor ( const ColorT & color,
float alpha = 1,
bool byteToFloat = false )
static

Construct a DrawColor from the given color type.

The used color type must have members named r, g and b. Applicable types include:

  • pcl::RGB (byteToFloat = true)
  • armarx::DrawColor (useful to get a color with a different alpha)
Parameters
alphathe alpha (default: 1)
byteToFloatIf true, scale from range [0, 255] to [0, 1]

◆ updateRobotColor()

void updateRobotColor ( const VisuID & id,
const DrawColor & color )

Update / set the robot color.

◆ updateRobotConfig()

void updateRobotConfig ( const VisuID & id,
const std::map< std::string, float > & config )

Update / set the robot configuration (joint angles).

◆ updateRobotNodeColor()

void updateRobotNodeColor ( const VisuID & id,
const std::string & nodeName,
const DrawColor & color )

Update / set the color of a robot node.

◆ updateRobotPose() [1/2]

void updateRobotPose ( const VisuID & id,
const Eigen::Matrix4f & pose,
bool ignoreScale = false )

Update / set the robot pose.

◆ updateRobotPose() [2/2]

void updateRobotPose ( const VisuID & id,
const Eigen::Vector3f & pos,
const Eigen::Quaternionf & ori,
bool ignoreScale = false )

Update / set the robot pose.

Member Data Documentation

◆ DEFAULTS

const DebugDrawerTopic::Defaults DEFAULTS = {}
static

The documentation for this class was generated from the following files: