Skip to content

01. How to Use

takeshi-iwanari edited this page Jul 30, 2022 · 21 revisions

Install and Run

Requirements

  • Ubuntu 20.04 (Not tested in Windows / Mac)
    • graphviz is required
  • optional: ROS 2 Galactic if you need runtime ROS graph analysis

Use pip (Recommended)

sudo apt install -y graphviz graphviz-dev
pip install dear-ros-node-viewer

dear_ros_node_viewer path-to-graph-file

Don't install but Run locally

sudo apt install graphviz graphviz-dev
git clone https://github.com/takeshi-iwanari/dear_ros_node_viewer.git
cd dear_ros_node_viewer
pip3 install -r requirements.txt

python3 main.py path-to-graph-file

On docker

docker run --rm -it -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix ubuntu:20.04
apt update
apt install -y wget
apt install -y python3-pip
apt install -y libgl1-mesa-dev
export LIBGL_ALWAYS_SOFTWARE=true
apt install -y graphviz graphviz-dev
pip install dear-ros-node-viewer
wget https://raw.githubusercontent.com/takeshi-iwanari/dear_ros_node_viewer/main/sample/architecture_autoware.yaml

dear_ros_node_viewer architecture_autoware.yaml

Operation Guide

  • Move graph area
    • Middle mouse button drag
  • Zoom in/out
    • Mouse scroll
    • Zoom function is tentative. Currently, zoom is based on graph center (it should be view center)
  • Highlight node connection
    • Click title bar (node name) on a node
    • Re-click the same node to disable highlight
  • Change font size
    • Menu -> Font
  • Omit display name
    • Menu -> NodeName, Edgename
  • Load running ROS graph (experimental)
    • Menu -> ROS -> Load Current Graph
  • Display executor and callback group information
    • Menu -> CARET -> Show callback
  • Display CARET path
    • Menu -> CARET -> PATH

Usage

usage: dear_ros_node_viewer [-h] [graph_file]

Dear RosNodeViewer: Visualize ROS2 Node Graph

positional arguments:
  graph_file  Graph file path. e.g. architecture.yaml(CARET) or rosgraph.dot(rqt_graph). default=architecture.yaml

optional arguments:
  -h, --help  show this help message and exit

Visualize architecture file

dear_ros_node_viewer path-to-architcture-file

e.g.
dear_ros_node_viewer ./architecture.yaml
  • To generate architecture file, please use CARET

Visualize dot file

dear_ros_node_viewer path-to-dot-file

e.g.
dear_ros_node_viewer ./rosgraph.dot
  • To generate dot file, please use rqt_graph
  • In case saving dot file in rqt_graph doesn't work, please refer to this issue

Visualize runtime ROS graph

dear_ros_node_viewer
  • Before starting Dear RosNodeViewr, set ROS environment
    • e.g. source /opt/ros/galactic/setup.bash
  • Click ROS -> Load Current Graph

Setting File

  • setting.json in the same directory as the graph file is used

Setting File Format

{
    "app_setting": {                           ### Settings for application
        "window_size": [1920, 1080],           # Default window size
        "font": "/usr/share/fonts/truetype/ubuntu/Ubuntu-C.ttf",   # Path to font
        "ignore_unconnected_nodes": true,      # Flag to ignore unconnected nodes 
        "ignore_node_list": [                  # Filter in regular expression (nodes to be ignored)
            "/node_a",
            "/module_a/.*"
        ],
        "ignore_topic_list": [                 # Filter in regular expression (topics to be ignored)
            "/tf",
            "/tf_static",
            "/diagnostics"
        ]
    },
    "group_setting": {                         ### Settings for node visualization
        "/sensing": {                          # Module name = The first part of node name
            "direction": "horizontal",         # How to connect nodes (horizontal/vertical)
            "offset": [0.0, 1.0, 2.5, 2.0],    # Position to place the module (x, y, w, h)
            "color": [128, 0, 128]             # Color for the module (r, g, b)
        },
        "/localization": {
            "direction": "horizontal",
            "offset": [0.0, 3.5, 2.5, 2.0],
            "color": [0, 0, 128]
        },
        "__others__": {
            "direction": "horizontal",
            "offset": [-0.5, -0.5, 1.0, 1.0],
            "color": [16, 64, 96]
        }
    }
}

About Node Layout

  • Nodes are basically automatically located
  • However, you may want to align rough layout by yourself, when a diagram becomes complicated
  • To achieve this, you can set offset for each module to assign a specific position, while nodes in a module are automatically located
    • the first part of a node name is treated as module name
  • If you don't need it, just remove all entries except for "__others__"

layout