Skip to content

01. How to Use

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

Requirements

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

Install and Run

sudo apt install graphviz graphviz-dev
pip3 install -r requirements.txt
python3 main.py architecture.yaml

# or, use the following to specify setting file
python3 main.py architecture.yaml --setting_file setting.json

# or, install it
pip3 install ./
dear_ros_node_viewer architecture.yaml

How to Operate

  • 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 -> Node Name, Edge name
  • Analyze and read running ROS graph (experimental)
    • Menu -> Graph -> Running ROS

Options

usage: main.py [-h] [--setting_file SETTING_FILE] [graph_file]

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
  --setting_file SETTING_FILE
                        default=setting.json

Visualize architecture file

python3 main.py path-to-architcture.yaml

e.g.
python3 main.py architecture.yaml
  • To generate architecture file, please use CARET

Visualize dot file

python3 main.py path-to-rosgraph.dot

e.g.
python3 main.py 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 (experimental)

python3 main.py
  • Before starting Dear RosNodeViewr, set ROS environment
    • e.g. source /opt/ros/galactic/setup.bash
  • Click Graph -> Running ROS

Setting File

How to Apply Setting File

python3 main.py --setting_file path-to-setting-file

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 
    },
    "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

Clone this wiki locally