A tool to dump the relationship of ROS nodes and ROS topics as JSON Graph Format.
- Supports ROS1
- Dumps the graph of ROS nodes and topics
- Filters the graph based on node or topic names
- Outputs the graph in JSON format using NetworkX
- Supports two graph types: node-to-node and node-to-topic
$ rgd
{
"directed": true,
"multigraph": false,
"graph": {},
"nodes": [
{
"label": "/talker",
"id": "/talker@node"
},
{
"label": "/listener",
"id": "/listener@node"
},
{
"label": "/rosout",
"id": "/rosout@node"
}
],
"links": [
{
"label": "/chatter",
"source": "/talker@node",
"target": "/listener@node"
},
{
"label": "/rosout",
"source": "/talker@node",
"target": "/rosout@node"
},
{
"label": "/rosout",
"source": "/listener@node",
"target": "/rosout@node"
}
]
}
- Python 3.8+
- ROS1
- poetry (for dependency management)
- ros-noetic-rospy-tutorials (for development)
-
Clone the repository:
$ git clone https://github.com/your-username/ros-graph-dump.git
-
Navigate to the project directory:
$ cd ros-graph-dump
-
Install rgd and dependencies using pip:
$ pip install .
To dump the ROS graph, use the following command:
rgd [--filter FILTER] [--output OUTPUT] [--graph-type GRAPH_TYPE]
--filter FILTER
: Filter the graph based on node or topic names (optional)--output OUTPUT
or-o OUTPUT
: Output file path. Use "-" for stdout (default).--graph-type GRAPH_TYPE
or-t GRAPH_TYPE
: Graph type: "nn" (node-to-node) or "nt" (node-to-topic). Default is "nt".
Examples:
# Dump the entire graph to stdout
rgd
# Dump the graph to a file
rgd --output graph.json
# Dump the node-to-node graph
rgd -t nn
# Dump the graph with a filter
rgd --filter /my_node
To run the tests, use the following command:
poetry run pytest tests
This project is licensed under the Apache License 2.0.