# Ros-d2: A CLI for exporting .d2 files from ROS2 runtime launch configurations

**URL:** <https://discourse.openrobotics.org/t/ros-d2-a-cli-for-exporting-d2-files-from-ros2-runtime-launch-configurations/29010>\
**Category:** ROS General\
**Tags:** ros2\
**Created:** [December 30, 2022, 8:32am UTC](https://discourse.openrobotics.org/t/ros-d2-a-cli-for-exporting-d2-files-from-ros2-runtime-launch-configurations/29010 "2022-12-30T08:32:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrBlenny](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/mrblenny/32/10909_2.png) [@MrBlenny](https://discourse.openrobotics.org/u/MrBlenny)\
**Post date:** [December 30, 2022, 8:32am UTC](https://discourse.openrobotics.org/t/ros-d2-a-cli-for-exporting-d2-files-from-ros2-runtime-launch-configurations/29010/1 "2022-12-30T08:32:17Z")

</div>

[https://github.com/Greenroom-Robotics/ros-d2](https://github.com/Greenroom-Robotics/ros-d2)

[D2](https://d2lang.com/tour/intro/) is a tidy new diagramming language. `ros-d2` can be used to generate `.d2` files from a ROS2 environment (tested in galactic and humble). Why? I wanted to be able to make _pretty_ architectural diagrams and the first step was to be able to export our current ROS architecture. If this is useful to other people I’ll add some more features!

![ros-diagram-dagre-verbose](https://us1.discourse-cdn.com/flex022/uploads/ros/original/2X/0/0c80c3535c3fc7d207feac9358d8253eeb445b46.svg)

---

<div class="post-metadata">

**Author:** ![shonigmann](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/shonigmann/32/9634_2.png) [@shonigmann](https://discourse.openrobotics.org/u/shonigmann)\
**Post date:** [January 2, 2023, 12:00am UTC](https://discourse.openrobotics.org/t/ros-d2-a-cli-for-exporting-d2-files-from-ros2-runtime-launch-configurations/29010/2 "2023-01-02T00:00:13Z")

</div>

i can’t be the only one thinking there was a missed opportunity on the name… 😅

**R** os **2-D2** was right there!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/ros/original/2X/3/33e4075f9e0fca2977e4f1a4124525f43b6634f1.jpeg)

cool tool though!

---

<div class="post-metadata">

**Author:** ![lonebots](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/lonebots/32/35588_2.png) [@lonebots](https://discourse.openrobotics.org/u/lonebots)\
**Post date:** [January 2, 2023, 5:24am UTC](https://discourse.openrobotics.org/t/ros-d2-a-cli-for-exporting-d2-files-from-ros2-runtime-launch-configurations/29010/3 "2023-01-02T05:24:40Z")

</div>

Hi, I don’t if this doubt is relevant but is this in any way similar to **rqt** which is used to construct graph like these that include details about all the running nodes, topics and subscriptions?

---

<div class="post-metadata">

**Author:** ![MrBlenny](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/mrblenny/32/10909_2.png) [@MrBlenny](https://discourse.openrobotics.org/u/MrBlenny)\
**Post date:** [January 2, 2023, 6:05am UTC](https://discourse.openrobotics.org/t/ros-d2-a-cli-for-exporting-d2-files-from-ros2-runtime-launch-configurations/29010/4 "2023-01-02T06:05:33Z")

</div>

Yep. It is similar to [http://wiki.ros.org/rqt\_graph](http://wiki.ros.org/rqt_graph) which provides far more features than this for runtime introspection. I didn’t actually look at what sort of data structure rqt uses and if it can be exported… Maybe I should (although I’d like to avoid it as a dependency).

I was really after a simple, serialisable, themeable data format which is why I liked the look of .d2. Critically, I wanted to be able to write it by hand as part of the architecture/design step and potentially add integration tests which make sure the implementation matches the system design.

The data structure this produces is very simple and diffable. [ros-d2/example\_output/ros-diagram.d2 at main · Greenroom-Robotics/ros-d2 · GitHub](https://github.com/Greenroom-Robotics/ros-d2/blob/main/example_output/ros-diagram.d2)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/ros/original/3X/b/6/b607ee3cc8e908b1b613bd74a683d749fea635a1.svg) [@system](https://discourse.openrobotics.org/u/system)\
**Post date:** [February 1, 2023, 6:05am UTC](https://discourse.openrobotics.org/t/ros-d2-a-cli-for-exporting-d2-files-from-ros2-runtime-launch-configurations/29010/5 "2023-02-01T06:05:39Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
