Skip to content

Commit

Permalink
Merge branch 'beta/v0.3.16' into backport/pr1434/v0.3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
yn-mrse authored Jun 20, 2023
2 parents eeabd9d + e0e6d0c commit fcd7418
Show file tree
Hide file tree
Showing 257 changed files with 3,656 additions and 2,893 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ jobs:
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: build_depends.repos

- name: Test
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: build_depends.repos
17 changes: 10 additions & 7 deletions .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@ jobs:

- name: Build
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
uses: autowarefoundation/autoware-github-actions/colcon-build@a7cc2c1ce6052f395e5800a0fb6e6221421bf30a
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: build_depends.repos
include-eol-distros: true

- name: Test
id: test
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
uses: autowarefoundation/autoware-github-actions/colcon-test@a7cc2c1ce6052f395e5800a0fb6e6221421bf30a
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: build_depends.repos
include-eol-distros: true

- name: Upload coverage to CodeCov
if: ${{ steps.test.outputs.coverage-report-files != '' }}
Expand All @@ -51,7 +53,7 @@ jobs:

clang-tidy-differential:
runs-on: ubuntu-latest
container: ros:galactic
container: ros:humble
needs: build-and-test-differential
steps:
- name: Check out repository
Expand All @@ -68,9 +70,10 @@ jobs:

- name: Run clang-tidy
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
uses: autowarefoundation/autoware-github-actions/clang-tidy@a7cc2c1ce6052f395e5800a0fb6e6221421bf30a
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy
build-depends-repos: build_depends.repos
include-eol-distros: true
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test-self-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
build-depends-repos: build_depends.repos

- name: Test
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
build-depends-repos: build_depends.repos
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
build-depends-repos: build_depends.repos

Expand All @@ -35,7 +35,7 @@ jobs:
id: test
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
build-depends-repos: build_depends.repos

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/check-build-depends.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ jobs:
uses: autowarefoundation/autoware-github-actions/get-self-packages@v1

- name: Build
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
uses: autowarefoundation/autoware-github-actions/colcon-build@a7cc2c1ce6052f395e5800a0fb6e6221421bf30a
with:
rosdistro: galactic
rosdistro: humble
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
build-depends-repos: build_depends.repos
include-eol-distros: true
46 changes: 46 additions & 0 deletions .github/workflows/dispatch-release-note.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: dispatch-release-note
on:
push:
branches:
- beta/v*
- tier4/main
tags:
- v*
workflow_dispatch:
inputs:
beta-branch-or-tag-name:
description: The name of the beta branch or tag to write release note
type: string
required: true
jobs:
dispatch-release-note:
runs-on: ubuntu-latest
name: release-repository-dispatch
steps:
- name: Set tag name
id: set-tag-name
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
REF_NAME="${{ github.event.inputs.beta-branch-or-tag-name }}"
else
REF_NAME="${{ github.ref_name }}"
fi
echo ::set-output name=ref-name::"$REF_NAME"
echo ::set-output name=tag-name::"${REF_NAME#beta/}"
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Repository dispatch for release note
run: |
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ steps.generate-token.outputs.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/tier4/update-release-notes/dispatches" \
-d '{"event_type":"${{ steps.set-tag-name.outputs.ref-name }}"}'
16 changes: 16 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,28 @@ on:

jobs:
pre-commit:
if: ${{ github.event.repository.private }} # Use pre-commit.ci for public repositories
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Check out repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ steps.generate-token.outputs.token }}

- name: Run pre-commit
uses: autowarefoundation/autoware-github-actions/pre-commit@v1
with:
pre-commit-config: .pre-commit-config.yaml
token: ${{ steps.generate-token.outputs.token }}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ repos:
args: [-w, -s, -i=4]

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

Expand Down
12 changes: 4 additions & 8 deletions build_depends.repos
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@ repositories:
core/autoware_msgs:
type: git
url: https://github.com/tier4/autoware_auto_msgs.git # TODO(Tier IV): Move to autowarefoundation/autoware_msgs
version: tier4/main
version: c8a5d2001da052137c08cdf9e8d75c1975f99b84
core/common:
type: git
url: https://github.com/autowarefoundation/autoware_common.git
version: main
version: d95da5d4c3f262259c6e40a0bdc1399c0fdf612f
core/autoware:
type: git
url: https://github.com/autowarefoundation/autoware.core.git
version: main
# universe
universe/tier4_autoware_msgs:
type: git
url: https://github.com/tier4/AutowareArchitectureProposal_msgs.git # TODO(Tier IV): Rename to tier4/tier4_autoware_msgs
version: tier4/universe
universe/vendor/grid_map:
type: git
url: https://github.com/ANYbotics/grid_map.git
version: ba2f9cb6e62f7ee9c5bac7401391a211e442e459
url: https://github.com/tier4/tier4_autoware_msgs.git
version: a624d255107fa724cf90967c5dcc09463b1d1c73
universe/vendor/mussp:
type: git
url: https://github.com/tier4/muSSP.git
Expand Down
6 changes: 5 additions & 1 deletion common/autoware_auto_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ if(BUILD_TESTING)
autoware_set_compile_options(${TEST_COMMON})
target_compile_options(${TEST_COMMON} PRIVATE -Wno-sign-conversion)
target_include_directories(${TEST_COMMON} PRIVATE include)
ament_target_dependencies(${TEST_COMMON} builtin_interfaces Eigen3)
ament_target_dependencies(${TEST_COMMON}
builtin_interfaces
Eigen3
geometry_msgs
)
endif()

# Ament Exporting
Expand Down
1 change: 1 addition & 0 deletions common/autoware_auto_common/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>geometry_msgs</test_depend>

<export><build_type>ament_cmake</build_type></export>
</package>
2 changes: 1 addition & 1 deletion common/autoware_auto_tf2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ if(BUILD_TESTING)
"autoware_auto_system_msgs"
"autoware_auto_geometry_msgs"
"geometry_msgs"
"orocos_kdl"
"tf2"
"tf2_geometry_msgs"
"tf2_ros"
)
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <tf2/convert.h>
#include <tf2/time.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#include <autoware_auto_perception_msgs/msg/bounding_box_array.hpp>
#include <autoware_auto_perception_msgs/msg/bounding_box.hpp>
#include <geometry_msgs/msg/transform_stamped.hpp>
Expand Down
2 changes: 1 addition & 1 deletion common/autoware_auto_tf2/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<depend>autoware_auto_common</depend>
<depend>geometry_msgs</depend>
<depend>tf2</depend>
<depend>tf2_geometry_msgs</depend>
<depend>tf2_ros</depend>
<depend>orocos_kdl</depend>

<test_depend>ament_cmake_gtest</test_depend>
<!-- <test_depend>ament_lint_auto</test_depend> -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <gtest/gtest.h>
#include <tf2_ros/buffer.h>
#include <tf2_ros/transform_listener.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#include <autoware_auto_tf2/tf2_autoware_auto_msgs.hpp>
#include <rclcpp/clock.hpp>
#include <memory>
Expand Down
42 changes: 42 additions & 0 deletions common/grid_map_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.5)
project(grid_map_utils)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(autoware_cmake REQUIRED)
autoware_package()
find_package(ament_cmake REQUIRED)

ament_auto_add_library(${PROJECT_NAME} SHARED
DIRECTORY src
)

target_link_libraries(${PROJECT_NAME})

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

ament_add_gtest(test_${PROJECT_NAME}
test/test_polygon_iterator.cpp
)
target_link_libraries(test_${PROJECT_NAME}
${PROJECT_NAME}
)

find_package(OpenCV REQUIRED)
add_executable(benchmark test/benchmark.cpp)
target_link_libraries(benchmark
${PROJECT_NAME}
${OpenCV_LIBS}
)
endif()

ament_auto_package()
52 changes: 52 additions & 0 deletions common/grid_map_utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Grid Map Utils

## Overview

This packages contains a re-implementation of the `grid_map::PolygonIterator` used to iterate over
all cells of a grid map contained inside some polygon.

## Algorithm

This implementation uses the [scan line algorithm](https://en.wikipedia.org/wiki/Scanline_rendering),
a common algorithm used to draw polygons on a rasterized image.
The main idea of the algorithm adapted to a grid map is as follow:

- calculate intersections between rows of the grid map and the edges of the polygon edges;
- calculate for each row the column between each pair of intersections;
- the resulting `(row, column)` indexes are inside of the polygon.

More details on the scan line algorithm can be found in the References.

## API

The `grid_map_utils::PolygonIterator` follows the same API as the original [`grid_map::PolygonIterator`](https://docs.ros.org/en/kinetic/api/grid_map_core/html/classgrid__map_1_1PolygonIterator.html).

## Assumptions

The behavior of the `grid_map_utils::PolygonIterator` is only guaranteed to match the `grid_map::PolygonIterator` if edges of the polygon do not _exactly_ cross any cell center.
In such a case, whether the crossed cell is considered inside or outside of the polygon can vary due to floating precision error.

## Performances

Benchmarking code is implemented in `test/benchmarking.cpp` and is also used to validate that the `grid_map_utils::PolygonIterator` behaves exactly like the `grid_map::PolygonIterator`.

The following figure shows a comparison of the runtime between the implementation of this package (`grid_map_utils`) and the original implementation (`grid_map`).
The time measured includes the construction of the iterator and the iteration over all indexes and is shown using a logarithmic scale.
Results were obtained varying the side size of a square grid map with `100 <= n <= 1000` (size=`n` means a grid of `n x n` cells),
random polygons with a number of vertices `3 <= m <= 100` and with each parameter `(n,m)` repeated 10 times.

![Runtime comparison](media/runtime_comparison.png)

## Future improvements

There exists variations of the scan line algorithm for multiple polygons.
These can be implemented if we want to iterate over the cells contained in at least one of multiple polygons.

The current implementation imitate the behavior of the original `grid_map::PolygonIterator` where a cell is selected if its center position is inside the polygon.
This behavior could be changed for example to only return all cells overlapped by the polygon.

## References

- <https://en.wikipedia.org/wiki/Scanline_rendering>
- <https://web.cs.ucdavis.edu/~ma/ECS175_S00/Notes/0411_b.pdf>
- <https://www.techfak.uni-bielefeld.de/ags/wbski/lehre/digiSA/WS0607/3DVRCG/Vorlesung/13.RT3DCGVR-vertex-2-fragment.pdf>
Loading

0 comments on commit fcd7418

Please sign in to comment.