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: use new srv to capture screen shot and movie #121

Open
wants to merge 4 commits 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
111 changes: 111 additions & 0 deletions .github/actions/build-and-test-differential/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: build-and-test-differential
description: ""

inputs:
rosdistro:
description: ""
required: true
container:
description: ""
required: true
container-suffix:
description: ""
required: true
runner:
description: ""
required: true
build-depends-repos:
description: ""
required: true
build-pre-command:
description: ""
required: true
codecov-token:
description: ""
required: true

runs:
using: composite
steps:
- name: Show disk space before the tasks
run: df -h
shell: bash

- name: Show machine specs
run: lscpu && free -h
shell: bash

- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1

- name: Get modified packages
id: get-modified-packages
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1

- name: Create ccache directory
run: |
mkdir -p ${CCACHE_DIR}
du -sh ${CCACHE_DIR} && ccache -s
shell: bash

- name: Attempt to restore ccache
uses: actions/cache/restore@v4
with:
path: |
/root/.ccache
key: ccache-main-${{ runner.arch }}-${{ inputs.rosdistro }}-${{ github.event.pull_request.base.sha }}
restore-keys: |
ccache-main-${{ runner.arch }}-${{ inputs.rosdistro }}-

- name: Show ccache stats before build and reset stats
run: |
du -sh ${CCACHE_DIR} && ccache -s
ccache --zero-stats
shell: bash

- name: Export CUDA state as a variable for adding to cache key
run: |
build_type_cuda_state=nocuda
if [[ "${{ inputs.container-suffix }}" == "-cuda" ]]; then
build_type_cuda_state=cuda
fi
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
shell: bash

- name: Build
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
with:
rosdistro: ${{ inputs.rosdistro }}
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: ${{ inputs.build-depends-repos }}
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
build-pre-command: ${{ inputs.build-pre-command }}

- name: Show ccache stats after build
run: du -sh ${CCACHE_DIR} && ccache -s
shell: bash

- name: Test
id: test
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
with:
rosdistro: ${{ inputs.rosdistro }}
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: ${{ inputs.build-depends-repos }}

- name: Upload coverage to CodeCov
if: ${{ steps.test.outputs.coverage-report-files != '' }}
uses: codecov/codecov-action@v4
with:
files: ${{ steps.test.outputs.coverage-report-files }}
fail_ci_if_error: false
verbose: true
flags: differential
token: ${{ inputs.codecov-token }}

- name: Show disk space after the tasks
run: df -h
shell: bash
94 changes: 66 additions & 28 deletions .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,32 @@ on:
types:
- opened
- synchronize
- reopened
- labeled

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

env:
CC: /usr/lib/ccache/gcc
CXX: /usr/lib/ccache/g++

jobs:
prevent-no-label-execution:
uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1
make-sure-label-is-present:
uses: autowarefoundation/autoware-github-actions/.github/workflows/make-sure-label-is-present.yaml@v1
with:
label: tag:run-build-and-test-differential

make-sure-require-cuda-label-is-present:
uses: autowarefoundation/autoware-github-actions/.github/workflows/make-sure-label-is-present.yaml@v1
with:
label: tag:require-cuda-build-and-test

build-and-test-differential:
needs: prevent-no-label-execution
if: ${{ needs.prevent-no-label-execution.outputs.run == 'true' }}
runs-on: ubuntu-latest
needs: [make-sure-label-is-present, make-sure-require-cuda-label-is-present]
if: ${{ needs.make-sure-label-is-present.outputs.result == 'true' }}
runs-on: ${{ matrix.runner }}
container: ${{ matrix.container }}${{ matrix.container-suffix }}
strategy:
fail-fast: false
Expand All @@ -28,8 +42,41 @@ jobs:
- -cuda
include:
- rosdistro: humble
container: ghcr.io/autowarefoundation/autoware:latest-prebuilt
container: ghcr.io/autowarefoundation/autoware:latest-autoware-universe
build-depends-repos: build_depends.repos
- container-suffix: -cuda
runner: codebuild-autoware-us-east-1-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large
build-pre-command: taskset --cpu-list 0-6
- container-suffix: ""
runner: ubuntu-latest
build-pre-command: ""
steps:
- name: Set PR fetch depth
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
shell: bash

- name: Checkout PR branch and all PR commits
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}

- name: Run build-and-test-differential action
if: ${{ !(matrix.container-suffix == '-cuda') || needs.make-sure-require-cuda-label-is-present.outputs.result == 'true' }}
uses: ./.github/actions/build-and-test-differential
with:
rosdistro: ${{ matrix.rosdistro }}
container: ${{ matrix.container }}
container-suffix: ${{ matrix.container-suffix }}
runner: ${{ matrix.runner }}
build-depends-repos: ${{ matrix.build-depends-repos }}
build-pre-command: ${{ matrix.build-pre-command }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}

clang-tidy-differential:
needs: build-and-test-differential
runs-on: ubuntu-latest
container: ghcr.io/autowarefoundation/autoware:latest-autoware-universe-cuda
steps:
- name: Set PR fetch depth
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
Expand All @@ -50,31 +97,22 @@ jobs:
id: get-modified-packages
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1

- name: Build
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
with:
rosdistro: ${{ matrix.rosdistro }}
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: ${{ matrix.build-depends-repos }}
- name: Get changed files (existing files only)
id: get-changed-files
run: |
echo "changed-files=$(git diff --name-only "origin/${{ github.base_ref }}"...HEAD | grep -E '\.(cpp|hpp)$' | while read -r file; do [ -e "$file" ] && echo -n "$file "; done)" >> $GITHUB_OUTPUT
shell: bash

- name: Test
id: test
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
- name: Run clang-tidy
if: ${{ steps.get-changed-files.outputs.changed-files != '' }}
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
with:
rosdistro: ${{ matrix.rosdistro }}
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: ${{ matrix.build-depends-repos }}

- name: Upload coverage to CodeCov
if: ${{ steps.test.outputs.coverage-report-files != '' }}
uses: codecov/codecov-action@v3
with:
files: ${{ steps.test.outputs.coverage-report-files }}
fail_ci_if_error: false
verbose: true
flags: differential
target-files: ${{ steps.get-changed-files.outputs.changed-files }}
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy-ci
build-depends-repos: build_depends.repos
cache-key-element: cuda

- name: Show disk space after the tasks
run: df -h
20 changes: 17 additions & 3 deletions common/tier4_screen_capture_rviz_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,31 @@ include_directories(
${OpenCV_INCLUDE_DIRS}
)

ament_auto_add_library(${PROJECT_NAME} SHARED
ament_auto_find_build_dependencies()
rosidl_generate_interfaces(${PROJECT_NAME}
"srv/Capture.srv"
DEPENDENCIES
std_msgs
ADD_LINTER_TESTS
)

ament_auto_add_library(${PROJECT_NAME}_lib SHARED
src/screen_capture_panel.hpp
src/screen_capture_panel.cpp
)
target_link_libraries(${PROJECT_NAME}

rosidl_get_typesupport_target(
cpp_typesupport_target ${PROJECT_NAME} "rosidl_typesupport_cpp")
target_link_libraries(${PROJECT_NAME}_lib "${cpp_typesupport_target}")

target_link_libraries(${PROJECT_NAME}_lib
${QT_LIBRARIES}
${OpenCV_LIBRARIES}
)

pluginlib_export_plugin_description_file(rviz_common plugins/plugin_description.xml)

ament_auto_package(
INSTALL_TO_SHARE
plugins
plugins
)
6 changes: 6 additions & 0 deletions common/tier4_screen_capture_rviz_plugin/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<build_depend>rosidl_default_generators</build_depend>

<depend>libopencv-dev</depend>
<depend>libqt5-core</depend>
<depend>libqt5-gui</depend>
Expand All @@ -24,6 +26,10 @@
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>

<exec_depend>rosidl_default_runtime</exec_depend>

<member_of_group>rosidl_interface_packages</member_of_group>

<export>
<build_type>ament_cmake</build_type>
<rviz plugin="${prefix}/plugins/plugin_description.xml"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<library path="tier4_screen_capture_rviz_plugin">
<library path="tier4_screen_capture_rviz_plugin_lib">

<class
type="AutowareScreenCapturePanel"
name="rviz_plugins/AutowareScreenCapturePanel"
type="rviz_plugins::AutowareScreenCapturePanel"
base_class_type="rviz_common::Panel">
<description>AutowareScreenCapturePanel</description>
</class>
Expand Down
Loading
Loading