Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add diagnostics api #539

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/design/autoware-interfaces/ad-api/features/diagnostics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Diagnostics

## Related API

- {{ link_ad_api('/api/system/diagnostics/struct') }}
- {{ link_ad_api('/api/system/diagnostics/status') }}

## Description

This API provides a diagnostic graph consisting of error levels for functional units of Autoware.
The system groups functions into arbitrary units depending on configuration and diagnoses their error levels.
Each functional unit has dependencies, so the whole looks like a fault tree analysis (FTA).
In practice, it becomes a directed acyclic graph (DAG) because multiple parents may share the same child.
Below is an example of the diagnostics provided by this API.
The `path` in the diagram is an arbitrary string that describes the functional unit, and the `level` is its error level.
For error level, the same value as `diagnostic_msgs/msg/DiagnosticStatus` is used.

![graph-tree](./diagnostics/tree.drawio.svg)

The diagnostics data has static and dynamic parts, so the API provides these separately for efficiency.
Below is an example of a message that corresponds to the above diagram.
The static part of the diagnostic is published only once as the DiagGraphStruct that contains nodes and links.
The links specify dependencies between nodes by index into an array of nodes.
The dynamic part of the diagnostic is published periodically as DiagGraphStatus.
The status has an array of nodes of the same length as the struct, with the same index representing the same functional unit.

![graph-data](./diagnostics/data.drawio.svg)
1,140 changes: 1,140 additions & 0 deletions docs/design/autoware-interfaces/ad-api/features/diagnostics/data.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/design/autoware-interfaces/ad-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ Service providers can combine these use cases to define user stories and check i
- [Vehicle doors](./features/vehicle-doors.md)
- [Cooperation](./features/cooperation.md)
- [Heartbeat](./features/heartbeat.md)
- [Diagnostics](./features/diagnostics.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: /api/system/diagnostics/status
status: not released
method: realtime stream
type:
name: autoware_adapi_v1_msgs/msg/DiagGraphStatus
msg:
- name: stamp
text: Timestamp when this message was sent
- name: id
text: ID to check correspondence between struct and status.
- name: nodes
text: Dynamic data for nodes in diagnostic graph.
---

{% extends 'design/autoware-interfaces/templates/autoware-interface.jinja2' %}
{% block description %}
This is the dynamic part of the diagnostics.
If static data is published with new ID, ignore dynamic data with old ID.
See [diagnostics](../../../../features/diagnostics.md) for details.
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: /api/system/diagnostics/struct
status: not released
method: notification
type:
name: autoware_adapi_v1_msgs/msg/DiagGraphStruct
msg:
- name: stamp
text: Timestamp when this message was sent.
- name: id
text: ID to check correspondence between struct and status.
- name: nodes
text: Static data for nodes in diagnostic graph.
- name: links
text: Static data for links in diagnostic graph.
---

{% extends 'design/autoware-interfaces/templates/autoware-interface.jinja2' %}
{% block description %}
This is the static part of the diagnostics.
If static data is published with new ID, ignore dynamic data with old ID.
See [diagnostics](../../../../features/diagnostics.md) for details.
{% endblock %}
2 changes: 2 additions & 0 deletions docs/design/autoware-interfaces/ad-api/list/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
| [/api/routing/set_route](./api/routing/set_route.md) | v1.0.0 |
| [/api/routing/set_route_points](./api/routing/set_route_points.md) | v1.0.0 |
| [/api/routing/state](./api/routing/state.md) | v1.0.0 |
| [/api/system/diagnostics/status](./api/system/diagnostics/status.md) | not released |
| [/api/system/diagnostics/struct](./api/system/diagnostics/struct.md) | not released |
| [/api/system/heartbeat](./api/system/heartbeat.md) | not released |
| [/api/vehicle/dimensions](./api/vehicle/dimensions.md) | v1.1.0 |
| [/api/vehicle/doors/command](./api/vehicle/doors/command.md) | v1.2.0 |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# This file is generated by tools/autoware-interfaces/generate.py
title: autoware_adapi_v1_msgs/msg/DiagGraphStatus
uses:
- autoware_adapi_v1_msgs/msg/DiagNodeStatus
---

{% extends 'design/autoware-interfaces/templates/autoware-data-type.jinja2' %}
{% block definition %}

```txt
builtin_interfaces/Time stamp
string id
autoware_adapi_v1_msgs/DiagNodeStatus[] nodes
```

{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# This file is generated by tools/autoware-interfaces/generate.py
title: autoware_adapi_v1_msgs/msg/DiagGraphStruct
uses:
- autoware_adapi_v1_msgs/msg/DiagLinkStruct
- autoware_adapi_v1_msgs/msg/DiagNodeStruct
---

{% extends 'design/autoware-interfaces/templates/autoware-data-type.jinja2' %}
{% block definition %}

```txt
builtin_interfaces/Time stamp
string id
autoware_adapi_v1_msgs/DiagNodeStruct[] nodes
autoware_adapi_v1_msgs/DiagLinkStruct[] links
```

{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# This file is generated by tools/autoware-interfaces/generate.py
title: autoware_adapi_v1_msgs/msg/DiagLinkStruct
used:
- autoware_adapi_v1_msgs/msg/DiagGraphStruct
---

{% extends 'design/autoware-interfaces/templates/autoware-data-type.jinja2' %}
{% block definition %}

```txt
# The index of nodes in the graph struct message.
uint32 parent
uint32 child
```

{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# This file is generated by tools/autoware-interfaces/generate.py
title: autoware_adapi_v1_msgs/msg/DiagNodeStatus
used:
- autoware_adapi_v1_msgs/msg/DiagGraphStatus
---

{% extends 'design/autoware-interfaces/templates/autoware-data-type.jinja2' %}
{% block definition %}

```txt
# The level of diagnostic_msgs/msg/DiagnosticStatus.
byte level
```

{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# This file is generated by tools/autoware-interfaces/generate.py
title: autoware_adapi_v1_msgs/msg/DiagNodeStruct
used:
- autoware_adapi_v1_msgs/msg/DiagGraphStruct
---

{% extends 'design/autoware-interfaces/templates/autoware-data-type.jinja2' %}
{% block definition %}

```txt
string path
```

{% endblock %}
5 changes: 5 additions & 0 deletions docs/design/autoware-interfaces/ad-api/types/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
- [autoware_adapi_v1_msgs/msg/CooperationDecision](./autoware_adapi_v1_msgs/msg/CooperationDecision.md)
- [autoware_adapi_v1_msgs/msg/CooperationPolicy](./autoware_adapi_v1_msgs/msg/CooperationPolicy.md)
- [autoware_adapi_v1_msgs/msg/CooperationStatus](./autoware_adapi_v1_msgs/msg/CooperationStatus.md)
- [autoware_adapi_v1_msgs/msg/DiagGraphStatus](./autoware_adapi_v1_msgs/msg/DiagGraphStatus.md)
- [autoware_adapi_v1_msgs/msg/DiagGraphStruct](./autoware_adapi_v1_msgs/msg/DiagGraphStruct.md)
- [autoware_adapi_v1_msgs/msg/DiagLinkStruct](./autoware_adapi_v1_msgs/msg/DiagLinkStruct.md)
- [autoware_adapi_v1_msgs/msg/DiagNodeStatus](./autoware_adapi_v1_msgs/msg/DiagNodeStatus.md)
- [autoware_adapi_v1_msgs/msg/DiagNodeStruct](./autoware_adapi_v1_msgs/msg/DiagNodeStruct.md)
- [autoware_adapi_v1_msgs/msg/DoorCommand](./autoware_adapi_v1_msgs/msg/DoorCommand.md)
- [autoware_adapi_v1_msgs/msg/DoorLayout](./autoware_adapi_v1_msgs/msg/DoorLayout.md)
- [autoware_adapi_v1_msgs/msg/DoorStatus](./autoware_adapi_v1_msgs/msg/DoorStatus.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
## Heartbeat

[Heartbeat](../features/heartbeat.md) is a reference for checking whether communication with Autoware is being performed properly.

## Diagnostics

[Diagnostics](../features/diagnostics.md) is a set of error levels for each functional unit of Autoware.
The design and structure of functional units are system dependent.
This is useful to identify the cause of an abnormality.
21 changes: 21 additions & 0 deletions yaml/autoware-interfaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ types:
cancellable: bool
cooperator: autoware_adapi_v1_msgs/msg/CooperationDecision
uuid: unique_identifier_msgs/msg/UUID
autoware_adapi_v1_msgs/msg/DiagGraphStatus:
msg:
id: string
nodes: autoware_adapi_v1_msgs/msg/DiagNodeStatus[]
stamp: builtin_interfaces/msg/Time
autoware_adapi_v1_msgs/msg/DiagGraphStruct:
msg:
id: string
links: autoware_adapi_v1_msgs/msg/DiagLinkStruct[]
nodes: autoware_adapi_v1_msgs/msg/DiagNodeStruct[]
stamp: builtin_interfaces/msg/Time
autoware_adapi_v1_msgs/msg/DiagLinkStruct:
msg:
child: uint32
parent: uint32
autoware_adapi_v1_msgs/msg/DiagNodeStatus:
msg:
level: byte
autoware_adapi_v1_msgs/msg/DiagNodeStruct:
msg:
path: string
autoware_adapi_v1_msgs/msg/DoorCommand:
msg:
command: uint8
Expand Down
Loading