Skip to content

Commit 3868f0f

Browse files
committed
refactor(topology_example): add detailed JSON configuration reference and update simple.json structure
1 parent 7f6eec5 commit 3868f0f

2 files changed

Lines changed: 152 additions & 1 deletion

File tree

topology_example/README.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# topology JSON 設定リファレンス
2+
3+
このディレクトリの JSON は、以下の自動生成スクリプトで実行スクリプトへ変換されます。
4+
5+
- parse_json/generate_exec_scripts.py
6+
7+
## 1. ルートキー
8+
9+
| キー | 必須 || 既定値 | 説明 |
10+
|---|---|---|---|---|
11+
| eval_time | 任意 | number | 60 | 計測時間 (秒)。publisher/subscriber/intermediate に渡される。 |
12+
| period_ms | 任意 | number | 100 | publish 周期 (ms)。publisher/intermediate に渡される。 |
13+
| qos | 任意 | object | - | QoS 設定オブジェクト。未指定時は各項目に既定値。 |
14+
| hosts | 必須 | array | - | ホスト定義の配列。 |
15+
16+
### qos オブジェクト
17+
18+
| キー | 必須 || 既定値 | 説明 |
19+
|---|---|---|---|---|
20+
| history | 任意 | string | KEEP_LAST | QoS history。 |
21+
| depth | 任意 | number | 1 | QoS depth。 |
22+
| reliability | 任意 | string | RELIABLE | QoS reliability。 |
23+
24+
## 2. hosts 配下
25+
26+
### host エントリ
27+
28+
| キー | 必須 || 説明 |
29+
|---|---|---|---|
30+
| host_name | 必須 | string | 生成されるファイル名のベースになるホスト名。 |
31+
| nodes | 必須 | array | ノード定義の配列。 |
32+
33+
### node エントリ
34+
35+
| キー | 必須 || 説明 |
36+
|---|---|---|---|
37+
| node_name | 必須 | string | ROS ノード名。 |
38+
| publisher | 条件付き必須 | array | Publisher として動かす場合に指定。 |
39+
| subscriber | 条件付き必須 | array | Subscriber として動かす場合に指定。 |
40+
| intermediate | 条件付き必須 | array | Intermediate として動かす場合に指定。 |
41+
42+
補足:
43+
- 1つの node に publisher / subscriber / intermediate を複数併用することは可能です。
44+
- ただし intermediate は配列の先頭要素 only を実行に使用します。
45+
46+
### publisher 配列要素
47+
48+
| キー | 必須 || 説明 |
49+
|---|---|---|---|
50+
| topic_name | 必須 | string | Publish するトピック名。 |
51+
52+
### subscriber 配列要素
53+
54+
| キー | 必須 || 説明 |
55+
|---|---|---|---|
56+
| topic_name | 必須 | string | Subscribe するトピック名。 |
57+
58+
### intermediate 配列要素
59+
60+
| キー | 必須 || 説明 |
61+
|---|---|---|---|
62+
| publisher | 必須 | array | 中継先 publish 用 topic 定義。 |
63+
| subscriber | 必須 | array | 中継元 subscribe 用 topic 定義。 |
64+
65+
publisher / subscriber の配列要素は、上記と同じく topic_name が必須です。
66+
67+
## 3. 現状の実装で未使用のキー
68+
69+
以下を JSON に書いても、現在の generate_exec_scripts.py では実行コマンド生成に使われません。
70+
71+
- 各 publisher エントリ内の payload_size
72+
- 各 publisher エントリ内の period_ms
73+
- ルートの rmw (RMW はコマンドライン引数 --rmw で指定)
74+
75+
実行時の payload size は環境変数 PAYLOAD_SIZE (既定 64) を使用します。
76+
77+
## 4. 最小テンプレート
78+
79+
```json
80+
{
81+
"hosts": [
82+
{
83+
"host_name": "host1",
84+
"nodes": [
85+
{
86+
"node_name": "pub1",
87+
"publisher": [
88+
{ "topic_name": "topic_a" }
89+
]
90+
}
91+
]
92+
},
93+
{
94+
"host_name": "host2",
95+
"nodes": [
96+
{
97+
"node_name": "sub1",
98+
"subscriber": [
99+
{ "topic_name": "topic_a" }
100+
]
101+
}
102+
]
103+
}
104+
]
105+
}
106+
```
107+
108+
## 5. 推奨テンプレート
109+
110+
```json
111+
{
112+
"eval_time": 60,
113+
"period_ms": 100,
114+
"qos": {
115+
"history": "KEEP_LAST",
116+
"depth": 1,
117+
"reliability": "RELIABLE"
118+
},
119+
"hosts": [
120+
{
121+
"host_name": "host1",
122+
"nodes": [
123+
{
124+
"node_name": "pub1",
125+
"publisher": [
126+
{ "topic_name": "topic_a" }
127+
]
128+
}
129+
]
130+
},
131+
{
132+
"host_name": "host2",
133+
"nodes": [
134+
{
135+
"node_name": "sub1",
136+
"subscriber": [
137+
{ "topic_name": "topic_a" }
138+
]
139+
}
140+
]
141+
}
142+
]
143+
}
144+
```

topology_example/simple.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
2+
"eval_time": 120,
3+
"period_ms": 50,
4+
"qos": {
5+
"history": "KEEP_ALL",
6+
"depth": 10,
7+
"reliability": "BEST_EFFORT"
8+
},
29
"hosts": [
310
{
411
"host_name": "host1",
@@ -68,4 +75,4 @@
6875
]
6976
}
7077
]
71-
}
78+
}

0 commit comments

Comments
 (0)