https://github.com/ar90n/ros-graph-dump
Dump rosgraph as json
https://github.com/ar90n/ros-graph-dump
json my-projects ros ros-noetic
Last synced: 5 months ago
JSON representation
Dump rosgraph as json
- Host: GitHub
- URL: https://github.com/ar90n/ros-graph-dump
- Owner: ar90n
- License: apache-2.0
- Created: 2024-05-08T14:28:36.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-06T02:23:53.000Z (almost 2 years ago)
- Last Synced: 2025-10-13T12:00:07.750Z (9 months ago)
- Topics: json, my-projects, ros, ros-noetic
- Language: Python
- Homepage:
- Size: 54.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ros-graph-dump
A tool to dump the relationship of ROS nodes and ROS topics as JSON Graph Format.
## Features
- Supports only ROS, not supports ROS2
- 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
## Output
```
$ 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"
}
]
}
```
## Requirements
- Python 3.8+
- ROS1
- poetry (for dependency management)
- ros-noetic-rospy-tutorials (for development)
## Installation
1. Clone the repository:
```
$ git clone https://github.com/your-username/ros-graph-dump.git
```
2. Navigate to the project directory:
```
$ cd ros-graph-dump
```
3. Install rgd and dependencies using pip:
```
$ pip install .
```
## Usage
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
```
## Running Tests
To run the tests, use the following command:
```
poetry run pytest tests
```
## License
This project is licensed under the Apache License 2.0.