Skip to content

Commit

Permalink
chore: apply ktro2828/autoware_mtr
Browse files Browse the repository at this point in the history
Signed-off-by: ktro2828 <[email protected]>
  • Loading branch information
ktro2828 committed Jan 8, 2025
1 parent 9c054ca commit b518cc9
Show file tree
Hide file tree
Showing 40 changed files with 1,507 additions and 758 deletions.
51 changes: 51 additions & 0 deletions perception/autoware_mtr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
devel/
logs/
build/
bin/
msg_gen/
srv_gen/
data/*onnx
msg/*Action.msg
msg/*ActionFeedback.msg
msg/*ActionGoal.msg
msg/*ActionResult.msg
msg/*Feedback.msg
msg/*Goal.msg
msg/*Result.msg
msg/_*.py
build_isolated/
devel_isolated/

# Generated by dynamic reconfigure
*.cfgc
/cfg/cpp/
/cfg/*.py

# Ignore generated docs
*.dox
*.wikidoc

# eclipse stuff
.project
.cproject

# qcreator stuff
CMakeLists.txt.user

srv/_*.py
*.pcd
*.pyc
qtcreator-*
*.user

/planning/cfg
/planning/docs
/planning/src

*~

# Emacs
.#*

# Catkin custom files
CATKIN_IGNORE
16 changes: 16 additions & 0 deletions perception/autoware_mtr/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is automatically synced from:
# https://github.com/autowarefoundation/sync-file-templates
# To make changes, update the source repository and follow the guidelines in its README.

# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for all rules.
default: true
MD013: false
MD024:
siblings_only: true
MD029:
style: ordered
MD033: false
MD041: false
MD045: false
MD046: false
MD049: false
6 changes: 6 additions & 0 deletions perception/autoware_mtr/.pre-commit-config-optional.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/tcort/markdown-link-check
rev: v3.12.2
hooks:
- id: markdown-link-check
args: [--quiet, --config=.markdown-link-check.json]
95 changes: 95 additions & 0 deletions perception/autoware_mtr/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
ci:
autofix_commit_msg: "style(pre-commit): autofix"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-xml
- id: check-yaml
args: [--unsafe]
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
- id: markdownlint
args: [-c, .markdownlint.yaml, --fix]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint

- repo: https://github.com/tier4/pre-commit-hooks-ros
rev: v0.10.0
hooks:
- id: flake8-ros
- id: prettier-xacro
- id: prettier-launch-xml
- id: prettier-package-xml
- id: ros-include-guard
- id: sort-package-xml

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck

- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.9.0-1
hooks:
- id: shfmt
args: [-w, -s, -i=4]

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
args: [--line-length=100]

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
hooks:
- id: clang-format
types_or: [c++, c, cuda]

- repo: https://github.com/cpplint/cpplint
rev: 1.6.1
hooks:
- id: cpplint
args: [--quiet]
exclude: .cu

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.2
hooks:
- id: check-metaschema
files: ^.+/schema/.*schema\.json$

- repo: local
hooks:
- id: prettier-svg
name: prettier svg
description: Apply Prettier with plugin-xml to svg.
entry: prettier --write --list-different --ignore-unknown --print-width 200 --xml-self-closing-space false --xml-whitespace-sensitivity ignore
language: node
files: .svg$
additional_dependencies: [[email protected], "@prettier/[email protected]"]
4 changes: 4 additions & 0 deletions perception/autoware_mtr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ target_include_directories(${PROJECT_NAME}_cuda_lib PUBLIC
ament_auto_add_library(${PROJECT_NAME}_lib SHARED
src/builder.cpp
src/trt_mtr.cpp
src/conversions/lanelet.cpp
src/intention_point.cpp
src/conversions/history.cpp
)
target_link_libraries(${PROJECT_NAME}_lib
${TRT_PLUGINS}
Expand Down Expand Up @@ -90,6 +93,7 @@ rclcpp_components_register_node(${PROJECT_NAME}_node
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
ament_auto_add_gtest(test_fixed_queue test/test_fixed_queue.cpp)
endif()

ament_auto_package(
Expand Down
1 change: 0 additions & 1 deletion perception/autoware_mtr/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
73 changes: 72 additions & 1 deletion perception/autoware_mtr/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,72 @@
# Motion TRansformer (MTR)
# autoware_mtr

## Purpose

The `autoware_mtr` package is used for 3D object motion prediction based on ML-based model called MTR.

## Inner-workings / Algorithms

The implementation bases on MTR [1] work. It uses TensorRT library for data process and network interface.

## Inputs / Outputs

### Input

| Name | Type | Description |
| -------------------- | ----------------------------------------------- | ------------------------ |
| `~/input/objects` | `autoware_perception_msgs::msg::TrackedObjects` | Input agent state. |
| `~/input/vector_map` | `autoware_map_msgs::msg::LeneletMapBin` | Input vector map. |
| `~/input/ego` | `sensor_msgs::msg::Odometry` | Input ego vehicle state. |

### Output

| Name | Type | Description |
| ------------------ | ------------------------------------------------- | -------------------------- |
| `~/output/objects` | `autoware_perception_msgs::msg::PredictedObjects` | Predicted objects' motion. |

## Parameters

Following parameters can be specified in `.launch.xml` or command line.

### `param_path`

File path to the MTR configuration. (Default: `autoware_mtr/config/mtr.param.yaml`)

### Configuration Parameters

#### `model_params`

| Name | type | Description |
| :---------------------------- | :-----: | :---------------------------------------------------------- |
| `model_path` | `str` | ONNX or engine file path. |
| `target_labels` | `str[]` | An array of label names to be predicted. |
| `num_past` | `int` | The number of history length. |
| `num_mode` | `int` | The number of predicted modes. |
| `num_future` | `int` | The number of predicted future length. |
| `max_num_polyline` | `int` | The maximum number of polylines to be contained in input. |
| `max_num_point` | `int` | The maximum number of points included in a single polyline. |
| `point_break_distance` | `float` | Distance threshold to separate points into two polylines. |
| `intention_point_filepath` | `str` | File path to intension points (.csv). |
| `num_intention_point_cluster` | `int` | The number of clusters of intention points. |

#### `build_params`

| Name | type | Description |
| :----------- | :----: | :---------------------------------------------------------- |
| `is_dynamic` | `bool` | Indicates whether the model allows dynamic shape inference. |
| `precision` | `str` | Precision mode. |
| `MINMAX` | `str` | Calibration mode. |

### `data_path`

Directory path to ONNX or TensorRT engine file. (Default: `autoware_mtr/data`)

### `build_only`

This option performs to build the TensorRT engine file from the ONNX file and exit after finishing it. (Default: `false`)

You can execute with the following command:

```bash
ros2 launch autoware_mtr mtr.launch.xml build_only:=true
```
4 changes: 0 additions & 4 deletions perception/autoware_mtr/config/mtr.param.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
point_break_distance: 1.0
intention_point_filepath: "$(var data_path)/intention_point.csv"
num_intention_point_cluster: 64
polyline_label_path: "$(var data_path)/polyline_label.txt"
static_inference:
num_target: 2
num_agent: 7
build_params:
is_dynamic: false
precision: "FP32"
Expand Down
13 changes: 0 additions & 13 deletions perception/autoware_mtr/data/polyline_label.txt

This file was deleted.

Loading

0 comments on commit b518cc9

Please sign in to comment.