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(ad-api): add mrm request #649

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions docs/design/autoware-interfaces/ad-api/features/fail-safe.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- {{ link_ad_api('/api/fail_safe/rti_state') }}
- {{ link_ad_api('/api/fail_safe/mrm_state') }}
- {{ link_ad_api('/api/fail_safe/mrm_request/send') }}
- {{ link_ad_api('/api/fail_safe/mrm_request/list') }}

## Description

Expand Down Expand Up @@ -45,3 +47,16 @@ This is service dependent. Autoware supports the following transitions by defaul
| COMFORTABLE_STOP | The vehicle will stop quickly with a comfortable deceleration. |
| EMERGENCY_STOP | The vehicle will stop immediately with as much deceleration as possible. |
| PULL_OVER | The vehicle will stop after moving to the side of the road. |

## MRM request

MRM request is a feature that triggers MRM from an application, and is mainly used when the application wants to transition the vehicle to a safe state by detecting an abnormality. When an MRM request is sent, Autoware attempts to operate the MRM. To distinguish requests from multiple applications, an MRM request must include a user name as an identifier.

Since MRM has multiple behaviors, this feature provides a selection strategy. Please refer to the table below for supported strategies.
If there are multiple requests, the strategy with the highest priority will be used.
Note that when Autoware detects an abnormality, it may not be able to operate according to the MRM request strategy.

| Strategy | Description |
| -------- | ---------------------------------------------------------- |
| CANCEL | Cancel the MRM request associated with the specified user. |
| DELEGATE | Delegate the selection of MRM behavior to Autoware. |
Comment on lines +61 to +62
Copy link
Member

@mitsudome-r mitsudome-r Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only have cancel and delegate as startegy.
Were there any considerations about selecting MRM behavior from an application?

In other words, if an application is triggering MRM through this API, then Autoware is not aware of the reason why it should be taking MRM behavior. Is it possible for Autoware to select the appropriate behavior in such situation?

If this is future work, that is okay, but we might want to state that in the description.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, I will consider to add strategies that vehicles achieve MRC as quickly as possible, as comfortable as possible, or etc.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: /api/fail_safe/mrm_request/list
status: not released
method: notification
type:
name: autoware_adapi_v1_msgs/msg/MrmRequestList
msg:
- name: requests.user
text: The sender name of the MRM request.
- name: requests.strategy
text: The strategy of the MRM request.
---

{% extends 'design/autoware-interfaces/templates/autoware-interface.jinja2' %}
{% block description %}
List the MRM requests from all senders.
For details, see the [fail-safe](../../../../features/fail-safe.md).
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: /api/fail_safe/mrm_request/send
status: not released
method: function call
type:
name: autoware_adapi_v1_msgs/srv/SendMrmRequest
req:
- name: request.user
text: The sender name of the MRM request.
- name: request.strategy
text: The strategy of the MRM request.
res:
- name: status
text: response status
---

{% extends 'design/autoware-interfaces/templates/autoware-interface.jinja2' %}
{% block description %}
Send the MRM request.
For details, see the [fail-safe](../../../../features/fail-safe.md).
{% 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 @@ -2,6 +2,8 @@

| API | Release | Method |
| ------------------------------------------------------------------------------------------------ | ------------ | --------------- |
| [/api/fail_safe/mrm_request/list](./api/fail_safe/mrm_request/list.md) | not released | notification |
| [/api/fail_safe/mrm_request/send](./api/fail_safe/mrm_request/send.md) | not released | function call |
| [/api/fail_safe/mrm_state](./api/fail_safe/mrm_state.md) | v1.1.0 | notification |
| [/api/fail_safe/rti_state](./api/fail_safe/rti_state.md) | not released | notification |
| [/api/interface/version](./api/interface/version.md) | v1.0.0 | function call |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# This file is generated by tools/autoware-interfaces/generate.py
title: autoware_adapi_v1_msgs/msg/MrmRequest
used:
- autoware_adapi_v1_msgs/msg/MrmRequestList
- autoware_adapi_v1_msgs/srv/SendMrmRequest
---

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

```txt
uint16 UNKNOWN = 0
uint16 CANCEL = 1 # Cancel the MRM request.
uint16 DELEGATE = 2 # Delegate the selection of MRM behavior to Autoware.

uint16 strategy
string user # The identifier of the request sender.
```

{% 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/MrmRequestList
uses:
- autoware_adapi_v1_msgs/msg/MrmRequest
---

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

```txt
builtin_interfaces/Time stamp
autoware_adapi_v1_msgs/MrmRequest[] requests
```

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ used:
- autoware_adapi_v1_msgs/srv/InitializeLocalization
- autoware_adapi_v1_msgs/srv/ListManualControlMode
- autoware_adapi_v1_msgs/srv/SelectManualControlMode
- autoware_adapi_v1_msgs/srv/SendMrmRequest
- autoware_adapi_v1_msgs/srv/SetCooperationCommands
- autoware_adapi_v1_msgs/srv/SetCooperationPolicies
- autoware_adapi_v1_msgs/srv/SetDoorCommand
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
# This file is generated by tools/autoware-interfaces/generate.py
title: autoware_adapi_v1_msgs/srv/SendMrmRequest
uses:
- autoware_adapi_v1_msgs/msg/MrmRequest
- autoware_adapi_v1_msgs/msg/ResponseStatus
---

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

```txt
autoware_adapi_v1_msgs/MrmRequest[] requests
---
autoware_adapi_v1_msgs/ResponseStatus status
```

{% endblock %}
3 changes: 3 additions & 0 deletions docs/design/autoware-interfaces/ad-api/types/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
- [autoware_adapi_v1_msgs/msg/ManualControlModeStatus](./autoware_adapi_v1_msgs/msg/ManualControlModeStatus.md)
- [autoware_adapi_v1_msgs/msg/ManualOperatorStatus](./autoware_adapi_v1_msgs/msg/ManualOperatorStatus.md)
- [autoware_adapi_v1_msgs/msg/MotionState](./autoware_adapi_v1_msgs/msg/MotionState.md)
- [autoware_adapi_v1_msgs/msg/MrmRequest](./autoware_adapi_v1_msgs/msg/MrmRequest.md)
- [autoware_adapi_v1_msgs/msg/MrmRequestList](./autoware_adapi_v1_msgs/msg/MrmRequestList.md)
- [autoware_adapi_v1_msgs/msg/MrmState](./autoware_adapi_v1_msgs/msg/MrmState.md)
- [autoware_adapi_v1_msgs/msg/ObjectClassification](./autoware_adapi_v1_msgs/msg/ObjectClassification.md)
- [autoware_adapi_v1_msgs/msg/OperationModeState](./autoware_adapi_v1_msgs/msg/OperationModeState.md)
Expand Down Expand Up @@ -60,6 +62,7 @@
- [autoware_adapi_v1_msgs/srv/InitializeLocalization](./autoware_adapi_v1_msgs/srv/InitializeLocalization.md)
- [autoware_adapi_v1_msgs/srv/ListManualControlMode](./autoware_adapi_v1_msgs/srv/ListManualControlMode.md)
- [autoware_adapi_v1_msgs/srv/SelectManualControlMode](./autoware_adapi_v1_msgs/srv/SelectManualControlMode.md)
- [autoware_adapi_v1_msgs/srv/SendMrmRequest](./autoware_adapi_v1_msgs/srv/SendMrmRequest.md)
- [autoware_adapi_v1_msgs/srv/SetCooperationCommands](./autoware_adapi_v1_msgs/srv/SetCooperationCommands.md)
- [autoware_adapi_v1_msgs/srv/SetCooperationPolicies](./autoware_adapi_v1_msgs/srv/SetCooperationPolicies.md)
- [autoware_adapi_v1_msgs/srv/SetDoorCommand](./autoware_adapi_v1_msgs/srv/SetDoorCommand.md)
Expand Down
13 changes: 13 additions & 0 deletions yaml/autoware-interfaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ types:
msg:
stamp: builtin_interfaces/msg/Time
state: uint16
autoware_adapi_v1_msgs/msg/MrmRequest:
msg:
strategy: uint16
user: string
autoware_adapi_v1_msgs/msg/MrmRequestList:
msg:
requests: autoware_adapi_v1_msgs/msg/MrmRequest[]
stamp: builtin_interfaces/msg/Time
autoware_adapi_v1_msgs/msg/MrmState:
msg:
behavior: uint16
Expand Down Expand Up @@ -276,6 +284,11 @@ types:
mode: autoware_adapi_v1_msgs/msg/ManualControlMode
res:
status: autoware_adapi_v1_msgs/msg/ResponseStatus
autoware_adapi_v1_msgs/srv/SendMrmRequest:
req:
requests: autoware_adapi_v1_msgs/msg/MrmRequest[]
res:
status: autoware_adapi_v1_msgs/msg/ResponseStatus
autoware_adapi_v1_msgs/srv/SetCooperationCommands:
req:
commands: autoware_adapi_v1_msgs/msg/CooperationCommand[]
Expand Down
Loading