-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup AV camera trigger component (#1)
- MVP setup in ROS2 of the camera trigger component, refactor/reworked and seems to work as expected. - Time synch does not seem to work as originally intended but does not seem to affect camera frequency nor timestamps.
- Loading branch information
1 parent
f6fd868
commit 9d64a51
Showing
25 changed files
with
1,975 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
tags: ["*"] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
ROS_DISTRO: humble | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
file: Dockerfile | ||
target: runtime | ||
build-args: ROS_DISTRO=${{ env.ROS_DISTRO }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
|
||
# To use: | ||
# | ||
# pre-commit run -a | ||
# | ||
# Or: | ||
# | ||
# pre-commit install # (runs every time you commit in git) | ||
# | ||
# To update this file: | ||
# | ||
# pre-commit autoupdate | ||
# | ||
# See https://github.com/pre-commit/pre-commit | ||
|
||
repos: | ||
# Standard hooks | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
exclude_types: [rst] | ||
- id: fix-byte-order-marker | ||
|
||
# Python hooks | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.2 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py36-plus] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 24.4.2 | ||
hooks: | ||
- id: black | ||
args: ["--line-length=79", -S] | ||
|
||
# CPP hooks | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v18.1.4 | ||
hooks: | ||
- id: clang-format | ||
args: ['-fallback-style=none', '-i'] | ||
|
||
- repo: local | ||
hooks: | ||
- id: ament_cppcheck | ||
name: ament_cppcheck | ||
description: Static code analysis of C/C++ files. | ||
entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck | ||
language: system | ||
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ | ||
|
||
- repo: local | ||
hooks: | ||
- id: ament_cpplint | ||
name: ament_cpplint | ||
description: Static code analysis of C/C++ files. | ||
entry: ament_cpplint | ||
language: system | ||
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ | ||
args: ["--linelength=100", "--filter=-legal/copyright,-build/include_order"] | ||
|
||
# Cmake hooks | ||
- repo: local | ||
hooks: | ||
- id: ament_lint_cmake | ||
name: ament_lint_cmake | ||
description: Check format of CMakeLists.txt files. | ||
entry: ament_lint_cmake | ||
language: system | ||
files: CMakeLists\.txt$ | ||
|
||
# Docs - RestructuredText hooks | ||
- repo: https://github.com/PyCQA/doc8 | ||
rev: v1.1.1 | ||
hooks: | ||
- id: doc8 | ||
args: ['--max-line-length=100', '--ignore=D001'] | ||
exclude: CHANGELOG\.rst$ | ||
|
||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.10.0 | ||
hooks: | ||
- id: rst-backticks | ||
exclude: CHANGELOG\.rst$ | ||
- id: rst-directive-colons | ||
- id: rst-inline-touching-normal | ||
|
||
# Spellcheck in comments and docs | ||
# skipping of *.svg files is not working... | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.6 | ||
hooks: | ||
- id: codespell | ||
args: ['--write-changes', '--uri-ignore-words-list=ist', '-L manuel,ned'] | ||
exclude: CHANGELOG\.rst|\.(svg|pyc|drawio|dae)$ | ||
|
||
# Check Github files | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.28.2 | ||
hooks: | ||
- id: check-github-workflows | ||
args: ["--verbose"] | ||
- id: check-github-actions | ||
args: ["--verbose"] | ||
- id: check-dependabot | ||
args: ["--verbose"] | ||
|
||
# Bash prettify | ||
- repo: https://github.com/lovesegfault/beautysh | ||
rev: v6.2.1 | ||
hooks: | ||
- id: beautysh | ||
|
||
# ROS checks | ||
- repo: https://github.com/tier4/pre-commit-hooks-ros | ||
rev: v0.8.0 | ||
hooks: | ||
- id: flake8-ros | ||
- id: prettier-xacro | ||
- id: prettier-launch-xml | ||
- id: prettier-package-xml | ||
- id: ros-include-guard | ||
- id: sort-package-xml | ||
|
||
# Dockerfiles | ||
- repo: https://github.com/AleksaC/hadolint-py | ||
rev: v2.12.1b3 | ||
hooks: | ||
- id: hadolint | ||
args: ['--ignore=DL3008'] | ||
|
||
ci: | ||
autofix_commit_msg: | | ||
[pre-commit.ci] auto fixes from pre-commit.com hooks | ||
for more information, see https://pre-commit.ci | ||
autofix_prs: false | ||
autoupdate_branch: '' | ||
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' | ||
autoupdate_schedule: monthly | ||
skip: [ament_cppcheck, ament_cpplint, ament_lint_cmake] | ||
submodules: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
FROM ros:humble-ros-base-jammy AS base | ||
|
||
# Switch to much faster mirror for apt processes | ||
ENV OLD_MIRROR archive.ubuntu.com | ||
ENV SEC_MIRROR security.ubuntu.com | ||
ENV NEW_MIRROR mirror.bytemark.co.uk | ||
|
||
RUN sed -i "s/$OLD_MIRROR\|$SEC_MIRROR/$NEW_MIRROR/g" /etc/apt/sources.list | ||
|
||
# Install basic dev tools (And clean apt cache afterwards) | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive \ | ||
apt-get -y --quiet --no-install-recommends install \ | ||
libhidapi-dev \ | ||
libboost-all-dev \ | ||
# Install Cyclone DDS ROS RMW | ||
ros-"$ROS_DISTRO"-rmw-cyclonedds-cpp \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Setup ROS workspace folder | ||
ENV ROS_WS /opt/ros_ws | ||
WORKDIR $ROS_WS | ||
|
||
# Set cyclone DDS ROS RMW | ||
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp | ||
|
||
COPY ./cyclone_dds.xml $ROS_WS/ | ||
|
||
# Configure Cyclone cfg file | ||
ENV CYCLONEDDS_URI=file://${ROS_WS}/cyclone_dds.xml | ||
|
||
# Enable ROS log colorised output | ||
ENV RCUTILS_COLORIZED_OUTPUT=1 | ||
|
||
# ----------------------------------------------------------------------- | ||
|
||
FROM base AS prebuilt | ||
|
||
# Bring source code into docker image | ||
COPY av_camera_trigger $ROS_WS/src/av_camera_trigger | ||
COPY camera_trigger_msgs $ROS_WS/src/camera_trigger_msgs | ||
|
||
# Source ROS setup for dependencies and build our code | ||
RUN . /opt/ros/"$ROS_DISTRO"/setup.sh \ | ||
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release | ||
|
||
# ----------------------------------------------------------------------- | ||
|
||
FROM base AS dev | ||
|
||
# Install basic dev tools (And clean apt cache afterwards) | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive \ | ||
apt-get -y --quiet --no-install-recommends install \ | ||
# Command-line editor | ||
nano \ | ||
# Ping network tools | ||
inetutils-ping \ | ||
# Bash auto-completion for convenience | ||
bash-completion \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Add sourcing local workspace command to bashrc when running interactively | ||
# Add colcon build alias for convenience | ||
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /root/.bashrc && \ | ||
echo 'alias colcon_build="colcon build --symlink-install \ | ||
--cmake-args -DCMAKE_BUILD_TYPE=Release && \ | ||
source install/setup.bash"' >> /root/.bashrc | ||
|
||
# Enter bash for development | ||
CMD ["bash"] | ||
|
||
# ----------------------------------------------------------------------- | ||
|
||
FROM base as runtime | ||
|
||
# Copy artifacts/binaries from prebuilt | ||
COPY --from=prebuilt $ROS_WS/install $ROS_WS/install | ||
|
||
# Add command to docker entrypoint to source newly compiled code in container | ||
RUN sed --in-place --expression \ | ||
"\$isource \"$ROS_WS/install/setup.bash\" " \ | ||
/ros_entrypoint.sh | ||
|
||
# launch ros package | ||
CMD ["ros2", "launch", "av_camera_trigger", "av_camera_trigger.launch.xml"] |
Oops, something went wrong.