GraphVisualizer

A widget used to visualize an undirected graph and draw it to a debug layer.

This widget implements the ice interface GraphVisualizerInterface and therefore can be provided with an undirected graph.

The graph is drawn to a debug layer and a scene located in the widget. The widget has tables containing information about the nodes and edges. Nodes on the debug layer are visualized as coordinate systems. Nodes on the scene are visualized as circles. Edges on the debug layer and scene are visualized with lines.

Nodes can be added with

addNode(const ::armarx::FramedPoseBasePtr& p)

and are identified with the string stored in p.

Edges can be added with

addEdge(const ::std::string& fst, const ::std::string& snd)

and are identified with {fst,snd}. fst and snd have to be the names of already existing nodes. The order of fst and snd does not matter.

The existence can be checked with the following methods:

hasNode(const ::std::string& name)
hasEdge(const ::std::string& fst, const ::std::string& snd)

All edges (the whole graph) can be deleted with:

clearEdges()
clearGraph()

If the graph has to be redrawn to the debug layer, use

redraw()

Edges and nodes have four states: {selected, not selected}X{highlighted, not highlighted}

Selection affects the width of lines and the size of nodes. Selected lines are thicker and nodes have an increased size. Selection can be toggled by double clicking the element in the table or the scene.

Highlighting affects the color. If not highlighted, elements are blue. If highlighted, elements are green. (nodes drawn on a debug layer can't change color) The highlight can be set and cleared with the functions:

highlightNode(const ::std::string& name, bool highlighted)
highlightEdge(const ::std::string& fst, const ::std::string& snd, bool highlighted)
resetHilight()

The graph used in the following examples can be created with the following code:

static ::armarx::FramedPosePtr table {new ::armarx::FramedPose{Eigen::Vector3f{3400.f,7300.f,1000.f}, "table" }};
static ::armarx::FramedPosePtr fridge {new ::armarx::FramedPose{Eigen::Vector3f{2150.f,7750.f,1000.f}, "fridge" }};
static ::armarx::FramedPosePtr sink {new ::armarx::FramedPose{Eigen::Vector3f{2500.f,9700.f,1000.f}, "sink" }};
static ::armarx::FramedPosePtr hub2 {new ::armarx::FramedPose{Eigen::Vector3f{3750.f,5150.f,5000.f}, "hub2" }};
static ::armarx::FramedPosePtr hub1 {new ::armarx::FramedPose{Eigen::Vector3f{2900.f,8000.f,1000.f}, "hub1" }};
static ::armarx::FramedPosePtr hub3 {new ::armarx::FramedPose{Eigen::Vector3f{3400.f,2200.f,1000.f}, "hub3" }};
static ::armarx::FramedPosePtr hub4 {new ::armarx::FramedPose{Eigen::Vector3f{1900.f,3000.f,1000.f}, "hub4" }};
static ::armarx::FramedPosePtr counter{new ::armarx::FramedPose{Eigen::Vector3f{1890.f,4050.f,1000.f}, "counter"}};
//prx is a proxy passing the commands to the plugin
//add nodes
prx->addNode(table);
prx->addNode(fridge);
prx->addNode(sink);
prx->addNode(hub2);
prx->addNode(hub1);
prx->addNode(hub3);
prx->addNode(hub4);
prx->addNode(counter);
//add edges
prx->addEdge("hub1","hub2");
prx->addEdge("hub1","table");
prx->addEdge("hub1","sink");
prx->addEdge("hub1","fridge");
prx->addEdge("hub2","hub3");
prx->addEdge("hub3","hub4");
prx->addEdge("hub4","counter");
//highlight a node and an edge
prx->highlightEdge("hub2","hub3");
prx->highlightNode("table");
The config dialog for the plugin.

You can set the topic of the used debug drawer and the used debug layer.

The graph drawn to the debug layer.
The plugin's ui.

The ui has 5 sections

  1. Display options for the graph.
    • a. Rotate the graph clockwise
    • b. Rotate the graph counter clockwise
    • c. Zoom factor for the graph
    • d. Rotate and zoom the graph to display most of it. (The rotation is a multiple of pi/4)
  2. Is the scene containing the graph
  3. The table of nodes.
  4. The table of edges.
  5. Triggers a repaint for the debug layer.
  • A) Shows a highlighted and selected node
  • B) Shows a selected edge
  • C) Shows a highlighted edge
  • D) Shows a node. (no highlight or selection)
  • E) Shows the tool tip of an edge.
See also
GraphVisualizerGuiPlugin
armarx::VariantType::FramedPose
const VariantTypeId FramedPose
Definition: FramedPose.h:37
armarx::FramedPosePtr
IceInternal::Handle< FramedPose > FramedPosePtr
Definition: FramedPose.h:250