Skip to content

Commit

Permalink
feat: remake diagnostic graph packages (autowarefoundation#6715)
Browse files Browse the repository at this point in the history
Signed-off-by: Takagi, Isamu <[email protected]>
  • Loading branch information
isamu-takagi authored Apr 22, 2024
1 parent 8adf18e commit 4917b54
Show file tree
Hide file tree
Showing 108 changed files with 3,429 additions and 2,292 deletions.
19 changes: 4 additions & 15 deletions system/diagnostic_graph_aggregator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,27 @@ find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_add_library(${PROJECT_NAME} SHARED
src/common/graph/error.cpp
src/common/graph/data.cpp
src/common/graph/config.cpp
src/common/graph/debug.cpp
src/common/graph/loader.cpp
src/common/graph/graph.cpp
src/common/graph/units.cpp
)

ament_auto_add_executable(aggregator
src/node/aggregator.cpp
src/node/plugin/modes.cpp
src/node/availability.cpp
)
target_include_directories(aggregator PRIVATE src/common)

ament_auto_add_executable(converter
src/node/converter.cpp
)
target_include_directories(converter PRIVATE src/common)

ament_auto_add_executable(tree
src/tool/tree.cpp
src/tool/utils/loader.cpp
)
target_include_directories(tree PRIVATE src/common)

ament_auto_add_executable(plantuml
src/tool/plantuml.cpp
src/tool/utils/loader.cpp
)
target_include_directories(plantuml PRIVATE src/common)

Expand All @@ -45,10 +40,4 @@ if(BUILD_TESTING)
target_include_directories(gtest_${PROJECT_NAME} PRIVATE src/common)
endif()

install(PROGRAMS
script/dump.py
RENAME dump
DESTINATION lib/${PROJECT_NAME}
)

ament_auto_package(INSTALL_TO_SHARE config example launch)
41 changes: 23 additions & 18 deletions system/diagnostic_graph_aggregator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@
## Overview

The diagnostic graph aggregator node subscribes to diagnostic array and publishes aggregated diagnostic graph.
As shown in the diagram below, this node introduces extra diagnostic status for intermediate functional unit.
Diagnostic status dependencies will be directed acyclic graph (DAG).
As shown in the diagram below, this node introduces extra diagnostic status for intermediate functional units.

![overview](./doc/overview.drawio.svg)

## Diagnostics graph message
## Diagnostic graph structures

The diagnostics graph that this node outputs is a combination of diagnostic status and connections between them.
This graph consists of an array of diagnostic nodes, and each node has a status and links.
This link contains an index indicating the position of the node in the graph.
Therefore, the graph can be reconstructed from the array of nodes using links.
The following is an example of a message representing the graph in the overview section.
The diagnostic graph is actually a set of fault tree analysis (FTA) for each operation mode of Autoware.
Since the status of the same node may be referenced by multiple nodes, the overall structure is a directed acyclic graph (DAG).
Each node in the diagnostic graph represents the diagnostic status of a specific functional unit, including the input diagnostics.
So we define this as "unit", and call the unit corresponding to the input diagnosis "diag unit" and the others "node unit".

![message](./doc/message.drawio.svg)
Every unit has an error level that is the same as DiagnosticStatus, a unit type, and optionally a unit path.
In addition, every diag unit has a message, a hardware_id, and values that are the same as DiagnosticStatus.
The unit type represents how the unit status is calculated, such as AND or OR.
The unit path is any unique string that represents the functionality of the unit.

NOTE: This feature is currently under development.
The diagnostic graph also supports "link" because there are cases where connections between units have additional status.
For example, it is natural that many functional units will have an error status until initialization is complete.

## Operation mode availability

Expand All @@ -34,11 +39,13 @@ This feature breaks the generality of the graph and may be changed to a plugin o

## Interfaces

| Interface Type | Interface Name | Data Type | Description |
| -------------- | ------------------------------------- | ------------------------------------------------- | ------------------ |
| subscription | `/diagnostics` | `diagnostic_msgs/msg/DiagnosticArray` | Diagnostics input. |
| publisher | `/diagnostics_graph` | `tier4_system_msgs/msg/DiagnosticGraph` | Diagnostics graph. |
| publisher | `/system/operation_mode/availability` | `tier4_system_msgs/msg/OperationModeAvailability` | mode availability. |
| Interface Type | Interface Name | Data Type | Description |
| -------------- | ------------------------------------- | ------------------------------------------------- | ---------------------------------- |
| subscription | `/diagnostics` | `diagnostic_msgs/msg/DiagnosticArray` | Diagnostics input. |
| publisher | `/diagnostics_graph/unknowns` | `diagnostic_msgs/msg/DiagnosticArray` | Diagnostics not included in graph. |
| publisher | `/diagnostics_graph/struct` | `tier4_system_msgs/msg/DiagGraphStruct` | Diagnostic graph (static part). |
| publisher | `/diagnostics_graph/status` | `tier4_system_msgs/msg/DiagGraphStatus` | Diagnostic graph (dynamic part). |
| publisher | `/system/operation_mode/availability` | `tier4_system_msgs/msg/OperationModeAvailability` | Operation mode availability. |

## Parameters

Expand All @@ -49,7 +56,6 @@ This feature breaks the generality of the graph and may be changed to a plugin o
| `input_qos_depth` | `uint` | QoS depth of input array topic. |
| `graph_qos_depth` | `uint` | QoS depth of output graph topic. |
| `use_operation_mode_availability` | `bool` | Use operation mode availability publisher. |
| `use_debug_mode` | `bool` | Use debug output to stdout. |

## Examples

Expand All @@ -73,13 +79,12 @@ ros2 launch diagnostic_graph_aggregator example-edit.launch.xml

## Debug tools

- [dump](./doc/tool/dump.md)
- [converter](./doc/tool/converter.md)
- [tree](./doc/tool/tree.md)
- [diagnostic_graph_utils](../diagnostic_graph_utils/README.md)

## Graph file format

- [graph](./doc/format/graph.md)
- [path](./doc/format/path.md)
- [node](./doc/format/node.md)
- [unit](./doc/format/unit.md)
- [edit](./doc/format/edit.md)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**:
ros__parameters:
use_operation_mode_availability: true
use_debug_mode: false
rate: 10.0
input_qos_depth: 1000
graph_qos_depth: 1
4 changes: 2 additions & 2 deletions system/diagnostic_graph_aggregator/doc/format/edit/remove.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Remove

The `remove` object is a edit that removes other nodes.
The `remove` object is a edit that removes other units.

## Format

| Name | Type | Required | Description |
| ------ | -------- | -------- | ---------------------------------------- |
| `type` | `string` | yes | Specify `remove` when using this object. |
| `path` | `string` | yes | The path of the node to remove. |
| `path` | `string` | yes | The path of the unit to remove. |
2 changes: 1 addition & 1 deletion system/diagnostic_graph_aggregator/doc/format/graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ The graph object is the top level structure that makes up the configuration file
| Name | Type | Required | Description |
| ------- | -------------------------------------- | -------- | ------------------------------------------------- |
| `files` | <code>list\[[path](./path.md)\]</code> | no | List of path objects for importing subgraphs. |
| `nodes` | <code>list\[[node](./node.md)\]</code> | no | List of node objects that make up the graph. |
| `units` | <code>list\[[unit](./unit.md)\]</code> | no | List of unit objects that make up the graph. |
| `edits` | <code>list\[[edit](./edit.md)\]</code> | no | List of edit objects to partially edit the graph. |
21 changes: 0 additions & 21 deletions system/diagnostic_graph_aggregator/doc/format/node/remap.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Node
# Unit

The `node` is a base object that makes up the diagnostic graph.
Any derived object can be used where a node object is required.
The `unit` is a base object that makes up the diagnostic graph.
Any derived object can be used where a unit object is required.

## Format

| Name | Type | Required | Description |
| ------ | -------- | -------- | ------------------------------------------------- |
| `type` | `string` | yes | The string indicating the type of derived object. |
| `path` | `string` | no | Any string to reference from other nodes. |
| `path` | `string` | no | Any string to reference from other units. |

## Derived objects

- [diag](./node/diag.md)
- [and](./node/and.md)
- [or](./node/or.md)
- [remapping](./node/remap.md)
- [diag](./unit/diag.md)
- [and](./unit/and.md)
- [or](./unit/or.md)
- [remapping](./unit/remap.md)
- warn-to-ok
- warn-to-error
- [constant](./node/const.md)
- [constant](./unit/const.md)
- ok
- warn
- error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# And

The `and` object is a node that is evaluated as the maximum error level of the input nodes.
The `and` object is a unit that is evaluated as the maximum error level of the input units.
Note that error level `stale` is treated as `error`.

## Format

| Name | Type | Required | Description |
| ------ | -------------------------------------- | -------- | ------------------------------------------------------------ |
| `type` | <code>string</code> | yes | Specify `and` or `short-circuit-and` when using this object. |
| `list` | <code>list\[[node](../node.md)]</code> | yes | List of input node objects. |
| `list` | <code>list\[[unit](../unit.md)]</code> | yes | List of input unit objects. |

## Short-circuit evaluation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Constant

The constant object is a node with a fixed error level.
The constant object is a unit with a fixed error level.

## Format

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Diag

The `diag` object is a node that refers to a specific status within the source diagnostics.
The `diag` object is a unit that refers to a specific status within the source diagnostics.

## Format

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Link

The `link` object is a node that refers to other nodes.
The `link` object is a unit that refers to another unit.

## Format

| Name | Type | Required | Description |
| ------ | -------- | -------- | -------------------------------------- |
| `type` | `string` | yes | Specify `link` when using this object. |
| `link` | `string` | yes | The path of the node to reference. |
| `link` | `string` | yes | The path of the unit to reference. |
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Or

The `or` object is a node that is evaluated as the minimum error level of the input nodes.
The `or` object is a unit that is evaluated as the minimum error level of the input units.
Note that error level `stale` is treated as `error`.

## Format

| Name | Type | Required | Description |
| ------ | -------------------------------------- | -------- | ------------------------------------ |
| `type` | <code>string</code> | yes | Specify `or` when using this object. |
| `list` | <code>list\[[node](../node.md)]</code> | yes | List of input node objects. |
| `list` | <code>list\[[unit](../unit.md)]</code> | yes | List of input unit objects. |
21 changes: 21 additions & 0 deletions system/diagnostic_graph_aggregator/doc/format/unit/remap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Constant

!!! warning

This object is under development. It may be removed in the future.

The remapping object is a unit that converts error levels.

## Format

| Name | Type | Required | Description |
| ------ | ------------------------------- | -------- | ---------------------------------------------- |
| `type` | `string` | yes | Specify remapping type when using this object. |
| `item` | <code>[unit](../unit.md)</code> | yes | Input unit object. |

## Remapping types

The supported remapping types are as follows.

- `warn-to-ok`
- `warn-to-error`
Loading

0 comments on commit 4917b54

Please sign in to comment.