Skip to main content

No project description provided

Project description

ros-launch-analyzer

概要

ros-launch-analyzerは、ROSのlaunchファイルの依存関係を分析してグラフを生成するツールです。

ROS1がインストールされていない環境で使うことを想定したツールのため、ROSに依存せずに動かせます。

(そのためROSがインストールされている環境ならば簡単にパスが見つかるようなパッケージも、見つかりにくいことがあります)

機能

  • launchファイル間の依存関係を解析
  • ROSノードの依存関係を解析
  • 依存関係をGraphvizを使ってグラフ化
  • シンプルグラフと詳細グラフの生成
  • ノード情報のCSV出力

インストール

pip install ros-launch-analyzer

実行方法

CLIとして

$ ros-launch-analyzer <launchファイルまたはディレクトリのパス> [--output <出力ファイル名>] [--ros-ws <ROSワークスペースのパス>]

解析対象の指定について:

  • ディレクトリを指定した場合: 指定されたディレクトリ以下の全ての .launch および .launch.xml ファイルを再帰的に検索し、それらのファイル間の依存関係(<include> タグによる参照)を全て解析します。間接的な依存関係も含まれます。

    # 例: mycobot_gazebo パッケージの launch ディレクトリ全体を解析
    $ ros-launch-analyzer catkin_ws/src/mycobot_ros/mycobot_gazebo/launch --ros-ws "$(pwd)/catkin_ws"
    
  • 単一のlaunchファイルを指定した場合: 指定された launch ファイルと、そのファイルが 直接 <include> タグで参照している launch ファイルのみ を対象として解析し、グラフを生成します。指定ファイルから見て2階層目以降の間接的な依存関係はグラフに含まれません。これは、特定のファイル周辺の直接的な依存関係に絞って確認したい場合に便利です。

    # 例: demo.launch とそれが直接 include するファイルのみを解析
    $ ros-launch-analyzer catkin_ws/src/mycobot_ros/mycobot_move_it_config/launch/demo.launch --ros-ws "$(pwd)/catkin_ws"
    

mycobot_rosのlaunchファイルを解析する例 (ディレクトリ指定)

$ cd /tmp
$ mkdir -p catkin_ws/src
$ git clone https://github.com/Tiryoh/mycobot_ros.git catkin_ws/src/mycobot_ros
$ ros-launch-analyzer catkin_ws/src/mycobot_ros/mycobot_gazebo/launch --ros-ws "$(pwd)/catkin_ws"

Pythonモジュールとして

from ros_launch_analyzer.analyzer import LaunchAnalyzer

# 解析器の初期化
analyzer = LaunchAnalyzer("/path/to/launch/dir", "/path/to/catkin_ws")

# launchファイルの解析
analyzer.parse_launch_file("/path/to/your.launch")

# グラフの生成
analyzer.create_graph("output_filename")
# または
analyzer.create_simple_graph("output_filename")  # シンプルグラフのみ
analyzer.create_full_graph("output_filename")    # 詳細グラフのみ

出力

以下のファイルを生成し出力します。
dotファイルはxdotVSCodeの拡張機能(Graphviz Interactive Preview)などで表示できます。
生成されたファイルはClaudeなどでdrawioのフォーマットに変換して使用すると便利です。

  • ros_nodes_graph_simple.dot
    • launchファイルの依存関係を表すGraphvizのdotファイル
  • ros_nodes_graph_simple.pdf
    • 上記のdotファイルをレンダリングしたPDF
  • ros_nodes_graph.dot
    • launchファイル(ROSパッケージも含む)の依存関係を表すGraphvizのdotファイル
  • ros_nodes_graph.pdf
    • 上記のdotファイルをレンダリングしたPDF
  • ros_nodes_graph_nodes.csv
    • launchファイルのノード名とパッケージ名を出力したCSVファイル

mycobot_rosを解析した結果

simpleグラフ
Image

fullグラフ
Image

simpleグラフをdrawioのフォーマット(flow.drawio.txt)に変換したもの
Image

必要条件

  • Python 3.8以上
  • Graphviz(システムにインストールされている必要があります)

ライセンス

本プロジェクトはMITライセンスのもとで公開されています。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ros_launch_analyzer-0.1.0.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ros_launch_analyzer-0.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file ros_launch_analyzer-0.1.0.tar.gz.

File metadata

  • Download URL: ros_launch_analyzer-0.1.0.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.11.0-21-generic

File hashes

Hashes for ros_launch_analyzer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2bef4188b2b6da1682e226d8ed7880feb7c862ab7b4637b65831642b7202c0f1
MD5 3e945321e673ad19bf272380cb985cef
BLAKE2b-256 9f3fc0a866ea55a948be902abdba6b83059c0032c287815cf4721483eec17b47

See more details on using hashes here.

File details

Details for the file ros_launch_analyzer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ros_launch_analyzer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.11.0-21-generic

File hashes

Hashes for ros_launch_analyzer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 686abdc5478710de07b2f15e726561e187cf3e12e60aa4b1169ce03da1f37f54
MD5 f326f0af2f2ed39950a00fc3d7614195
BLAKE2b-256 58d5861dbe17a365a1daedb36986eb783d42248e7d65dfc65ff35e9aa6e83bcb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page