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(perception): add support of ML-based prediction with MTR #6777

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
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]"]
104 changes: 104 additions & 0 deletions perception/autoware_mtr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
cmake_minimum_required(VERSION 3.8)
project(autoware_mtr)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(autoware_cmake REQUIRED)
autoware_package()

find_package(CUDA REQUIRED)
if (CUDA_FOUND)
include_directories(${CUDA_INCLUDE_DIRS})
find_library(CUBLAS_LIBRARIES cublas HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib64
${CUDA_TOOLKIT_ROOT_DIR}/lib)
find_library(
CUDNN_LIBRARIES
NAMES libcudnn.so${__cudnn_ver_suffix} libcudnn${__cudnn_ver_suffix}.dylib
${__cudnn_lib_win_name}
PATHS $ENV{LD_LIBRARY_PATH} ${__libpath_cudart} ${CUDNN_ROOT_DIR}
${PC_CUDNN_LIBRARY_DIRS} ${CMAKE_INSTALL_PREFIX}
PATH_SUFFIXES lib lib64 bin
DOC "CUDNN library.")
else()
message(FATAL_ERROR "Can not find CUDA")
endif()

list(APPEND TRT_PLUGINS "nvinfer")
list(APPEND TRT_PLUGINS "nvonnxparser")
list(APPEND TRT_PLUGINS "nvparsers")
foreach(libName ${TRT_PLUGINS})
find_library(${libName}_lib NAMES ${libName} "/usr" PATH_SUFFIXES lib)
list(APPEND TRT_PLUGINS ${${libName}_lib})
endforeach()

# TRT plugins and cuda kernels
cuda_add_library(${PROJECT_NAME}_cuda_lib SHARED
lib/src/attention/trt_attn_value_computation_kernel.cu
lib/src/attention/trt_attn_value_computation.cpp
lib/src/attention/trt_attn_weight_computation_kernel.cu
lib/src/attention/trt_attn_weight_computation.cpp
lib/src/knn/trt_knn_batch_kernel.cu
lib/src/knn/trt_knn_batch.cpp
lib/src/knn/trt_knn_batch_mlogk_kernel.cu

Check warning on line 45 in perception/autoware_mtr/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (mlogk)
lib/src/knn/trt_knn_batch_mlogk.cpp

Check warning on line 46 in perception/autoware_mtr/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (mlogk)
lib/src/preprocess/agent_preprocess_kernel.cu
lib/src/preprocess/polyline_preprocess_kernel.cu
lib/src/postprocess/postprocess_kernel.cu
)
target_include_directories(${PROJECT_NAME}_cuda_lib PUBLIC
lib/include
)

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}
${TRT_PLUGIN_LIBS}
${CUDA_LIBRARIES}
${CUBLAS_LIBRARIES}
${CUDNN_LIBRARIES}
${PROJECT_NAME}_cuda_lib
)
target_include_directories(${PROJECT_NAME}_lib PUBLIC
include
lib/include
)

target_compile_options(${PROJECT_NAME}_lib PRIVATE
-Wall -Wextra -Wpedantic -Werror -Wno-deprecated-declarations
)

# ROS 2 node
ament_auto_add_library(${PROJECT_NAME}_node SHARED
src/node.cpp
)

target_link_libraries(${PROJECT_NAME}_node
${PROJECT_NAME}_lib
)

rclcpp_components_register_node(${PROJECT_NAME}_node
PLUGIN "autoware::mtr::MTRNode"
EXECUTABLE ${PROJECT_NAME}
)

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(
INSTALL_TO_SHARE
launch
config
data
)
Loading
Loading