Skip to content

Commit a522a24

Browse files
authored
Merge pull request #1192 from tier4/update-diagnostic-agg
feat(diagnostic_graph_aggregator): update documents and tools
2 parents b08c2c7 + 49ac701 commit a522a24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+647
-248
lines changed

system/diagnostic_graph_aggregator/CMakeLists.txt

+10-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,17 @@ ament_auto_add_executable(converter
2222
)
2323
target_include_directories(converter PRIVATE src/common)
2424

25-
ament_auto_add_executable(tool
26-
src/tool/tool.cpp
25+
ament_auto_add_executable(tree
26+
src/tool/tree.cpp
27+
src/tool/utils/loader.cpp
2728
)
28-
target_include_directories(tool PRIVATE src/common)
29+
target_include_directories(tree PRIVATE src/common)
30+
31+
ament_auto_add_executable(plantuml
32+
src/tool/plantuml.cpp
33+
src/tool/utils/loader.cpp
34+
)
35+
target_include_directories(plantuml PRIVATE src/common)
2936

3037
if(BUILD_TESTING)
3138
get_filename_component(RESOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/test/files ABSOLUTE)

system/diagnostic_graph_aggregator/README.md

+24-11
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,33 @@ This feature breaks the generality of the graph and may be changed to a plugin o
5353

5454
## Examples
5555

56-
- [example_0.yaml](./example/example_0.yaml)
57-
- [example_1.yaml](./example/example_1.yaml)
58-
- [example_2.yaml](./example/example_2.yaml)
56+
This is an example of a diagnostic graph configuration. The configuration can be split into multiple files.
57+
58+
- [main.yaml](./example/graph/main.yaml)
59+
- [module1.yaml](./example/graph/module1.yaml)
60+
- [module2.yaml](./example/graph/module2.yaml)
61+
62+
```bash
63+
ros2 launch diagnostic_graph_aggregator example-main.launch.xml
64+
```
65+
66+
You can reuse the graph by making partial edits. For example, disable hardware checks for simulation.
67+
68+
- [edit.yaml](./example/graph/edit.yaml)
5969

6070
```bash
61-
ros2 launch diagnostic_graph_aggregator example.launch.xml
71+
ros2 launch diagnostic_graph_aggregator example-edit.launch.xml
6272
```
6373

74+
## Debug tools
75+
76+
- [dump](./doc/tool/dump.md)
77+
- [converter](./doc/tool/converter.md)
78+
- [tree](./doc/tool/tree.md)
79+
6480
## Graph file format
6581

66-
- [GraphFile](./doc/format/graph-file.md)
67-
- [Path](./doc/format/path.md)
68-
- [Node](./doc/format/node.md)
69-
- [Diag](./doc/format/diag.md)
70-
- [Unit](./doc/format/unit.md)
71-
- [And](./doc/format/and.md)
72-
- [Or](./doc/format/or.md)
82+
- [graph](./doc/format/graph.md)
83+
- [path](./doc/format/path.md)
84+
- [node](./doc/format/node.md)
85+
- [edit](./doc/format/edit.md)

system/diagnostic_graph_aggregator/doc/format/and.md

-11
This file was deleted.

system/diagnostic_graph_aggregator/doc/format/diag.md

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Edit
2+
3+
The `edit` is a base object that edits the existing diagnostic graph.
4+
Any derived object can be used where a edit object is required.
5+
6+
## Format
7+
8+
| Name | Type | Required | Description |
9+
| ------ | -------- | -------- | ------------------------------------------------- |
10+
| `type` | `string` | yes | The string indicating the type of derived object. |
11+
12+
## Derived objects
13+
14+
- [remove](./edit/remove.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Remove
2+
3+
The `remove` object is a edit that removes other nodes.
4+
5+
## Format
6+
7+
| Name | Type | Required | Description |
8+
| ------ | -------- | -------- | ---------------------------------------- |
9+
| `type` | `string` | yes | Specify `remove` when using this object. |
10+
| `path` | `string` | yes | The path of the node to remove. |

system/diagnostic_graph_aggregator/doc/format/graph-file.md

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Graph
2+
3+
The graph object is the top level structure that makes up the configuration file.
4+
5+
## Format
6+
7+
| Name | Type | Required | Description |
8+
| ------- | -------------------------------------- | -------- | ------------------------------------------------- |
9+
| `files` | <code>list\[[path](./path.md)\]</code> | no | List of path objects for importing subgraphs. |
10+
| `nodes` | <code>list\[[node](./node.md)\]</code> | no | List of node objects that make up the graph. |
11+
| `edits` | <code>list\[[edit](./edit.md)\]</code> | no | List of edit objects to partially edit the graph. |
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
# Node
22

3-
Node is a base object that makes up the diagnostic graph.
3+
The `node` is a base object that makes up the diagnostic graph.
4+
Any derived object can be used where a node object is required.
45

56
## Format
67

7-
| Name | Type | Required | Description |
8-
| ---- | ------ | -------- | ------------------------------------------- |
9-
| type | string | yes | Node type. See derived objects for details. |
8+
| Name | Type | Required | Description |
9+
| ------ | -------- | -------- | ------------------------------------------------- |
10+
| `type` | `string` | yes | The string indicating the type of derived object. |
11+
| `path` | `string` | no | Any string to reference from other nodes. |
12+
13+
## Derived objects
14+
15+
- [diag](./node/diag.md)
16+
- [and](./node/and.md)
17+
- [or](./node/or.md)
18+
- [remapping](./node/remap.md)
19+
- warn-to-ok
20+
- warn-to-error
21+
- [constant](./node/const.md)
22+
- ok
23+
- warn
24+
- error
25+
- stale
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# And
2+
3+
The `and` object is a node that is evaluated as the maximum error level of the input nodes.
4+
Note that error level `stale` is treated as `error`.
5+
6+
## Format
7+
8+
| Name | Type | Required | Description |
9+
| ------ | -------------------------------------- | -------- | ------------------------------------------------------------ |
10+
| `type` | <code>string</code> | yes | Specify `and` or `short-circuit-and` when using this object. |
11+
| `list` | <code>list\[[node](../node.md)]</code> | yes | List of input node objects. |
12+
13+
## Short-circuit evaluation
14+
15+
!!! warning
16+
17+
The`short-circuit-and` is work in progress (WIP).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Constant
2+
3+
The constant object is a node with a fixed error level.
4+
5+
## Format
6+
7+
| Name | Type | Required | Description |
8+
| ------ | -------- | -------- | ------------------------------------------- |
9+
| `type` | `string` | yes | Specify error level when using this object. |
10+
11+
## Error levels
12+
13+
The supported error levels are as follows.
14+
15+
- `ok`
16+
- `warn`
17+
- `error`
18+
- `stale`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Diag
2+
3+
The `diag` object is a node that refers to a specific status within the source diagnostics.
4+
5+
## Format
6+
7+
| Name | Type | Required | Description |
8+
| ------ | -------- | -------- | -------------------------------------- |
9+
| `type` | `string` | yes | Specify `diag` when using this object. |
10+
| `diag` | `string` | yes | The name of the diagnostic status. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Link
2+
3+
The `link` object is a node that refers to other nodes.
4+
5+
## Format
6+
7+
| Name | Type | Required | Description |
8+
| ------ | -------- | -------- | -------------------------------------- |
9+
| `type` | `string` | yes | Specify `link` when using this object. |
10+
| `link` | `string` | yes | The path of the node to reference. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Or
2+
3+
The `or` object is a node that is evaluated as the minimum error level of the input nodes.
4+
Note that error level `stale` is treated as `error`.
5+
6+
## Format
7+
8+
| Name | Type | Required | Description |
9+
| ------ | -------------------------------------- | -------- | ------------------------------------ |
10+
| `type` | <code>string</code> | yes | Specify `or` when using this object. |
11+
| `list` | <code>list\[[node](../node.md)]</code> | yes | List of input node objects. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Constant
2+
3+
!!! warning
4+
5+
This object is under development. It may be removed in the future.
6+
7+
The remapping object is a node that converts error levels.
8+
9+
## Format
10+
11+
| Name | Type | Required | Description |
12+
| ------ | -------------------------------------- | -------- | ---------------------------------------------------- |
13+
| `type` | `string` | yes | Specify remapping type when using this object. |
14+
| `list` | <code>list\[[node](../node.md)]</code> | yes | List of input node objects. The list size must be 1. |
15+
16+
## Remapping types
17+
18+
The supported remapping types are as follows.
19+
20+
- `warn-to-ok`
21+
- `warn-to-error`

system/diagnostic_graph_aggregator/doc/format/or.md

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# Path
22

3-
Path is an object that indicates the path of the file to include.
3+
The path object specifies the file path of the subgraph to be imported.
4+
The structure of the subgraph file should be [graph object](./graph.md).
45

56
## Format
67

7-
| Name | Type | Required | Description |
8-
| ------- | ------ | -------- | ----------------------------- |
9-
| package | string | yes | Package name. |
10-
| path | string | yes | Relative path in the package. |
8+
| Name | Type | Required | Description |
9+
| ------ | -------- | -------- | ------------------------------ |
10+
| `path` | `string` | yes | The file path of the subgraph. |
11+
12+
## Substitutions
13+
14+
File paths can contain substitutions like ROS 2 launch. The supported substitutions are as follows.
15+
16+
| Substitution | Description |
17+
| ----------------------------- | -------------------------------- |
18+
| `$(dirname)` | The path of this file directory. |
19+
| `$(find-pkg-share <package>)` | The path of the package. |

system/diagnostic_graph_aggregator/doc/format/unit.md

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Converter tool
2+
3+
This tool converts `/diagnostics_graph` to `/diagnostics_agg` so it can be read by tools such as `rqt_runtime_monitor` and `rqt_robot_monitor`.
4+
5+
## Usage
6+
7+
```bash
8+
ros2 launch diagnostic_graph_aggregator converter.launch.xml complement:=false
9+
```
10+
11+
The `complement` argument specifies whether to add an intermediate path that does not exist.
12+
This means that if the graph contains paths `/A/B` and `/A/B/C/D/E`, the intermediate paths `/A`, `/A/B/C` and `/A/B/C/D` will be added.
13+
This is useful for tree view in `rqt_robot_monitor`. The completed node has an error level of `STALE`.
14+
15+
## Examples
16+
17+
```bash
18+
ros2 launch diagnostic_graph_aggregator example-main.launch.xml complement:=false
19+
ros2 run rqt_runtime_monitor rqt_runtime_monitor --ros-args -r diagnostics:=diagnostics_agg
20+
```
21+
22+
![rqt_runtime_monitor](./images/rqt_runtime_monitor.png)
23+
24+
```bash
25+
ros2 launch diagnostic_graph_aggregator example-main.launch.xml complement:=true
26+
ros2 run rqt_robot_monitor rqt_robot_monitor
27+
```
28+
29+
![rqt_robot_monitor](./images/rqt_robot_monitor.png)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Dump tool
2+
3+
This tool displays `/diagnostics_graph` in table format.
4+
5+
## Usage
6+
7+
```bash
8+
ros2 run diagnostic_graph_aggregator dump
9+
```
10+
11+
## Examples
12+
13+
```bash
14+
ros2 launch diagnostic_graph_aggregator example-main.launch.xml
15+
ros2 run diagnostic_graph_aggregator dump
16+
```
17+
18+
```txt
19+
| ----- | ----- | -------------------------------- | ----- |
20+
| index | level | name | links |
21+
| ----- | ----- | -------------------------------- | ----- |
22+
| 0 | OK | /sensing/radars/front | |
23+
| 1 | OK | /sensing/lidars/front | |
24+
| 2 | ERROR | /sensing/lidars/top | |
25+
| 3 | OK | /functions/obstacle_detection | 1 0 |
26+
| 4 | ERROR | /functions/pose_estimation | 2 |
27+
| 5 | OK | /external/remote_command | |
28+
| 6 | OK | /external/joystick_command | |
29+
| 7 | ERROR | /autoware/modes/pull_over | 4 3 |
30+
| 8 | OK | /autoware/modes/comfortable_stop | 3 |
31+
| 9 | OK | /autoware/modes/emergency_stop | |
32+
| 10 | OK | /autoware/modes/remote | 5 |
33+
| 11 | OK | /autoware/modes/local | 6 |
34+
| 12 | ERROR | /autoware/modes/autonomous | 4 3 |
35+
| 13 | OK | /autoware/modes/stop | |
36+
```
Loading
Loading

0 commit comments

Comments
 (0)