Skip to content

Commit

Permalink
Add pre-commit (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki authored Dec 27, 2023
1 parent 1c36382 commit 78da7ca
Show file tree
Hide file tree
Showing 14 changed files with 315 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
.dockerignore
.gitignore
Dockerfile.*
README.md
README.md
26 changes: 15 additions & 11 deletions .github/workflows/ros-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
---
name: Selected Docker Image Build & Push

on:
workflow_dispatch:
inputs:
dockerfile:
description: "Type Dockerfile version to build"
description: Type Dockerfile version to build
required: true
default: "cpu"
default: cpu
type: choice
options:
- cpu
- desktop
- jetson
build_type:
description: "Is it a \"development\" or a \"stable\" release?"
description: Is it a "development" or a "stable" release?
required: true
default: 'development'
default: development
type: choice
options:
- development
- stable
target_distro:
description: "In case of \"stable\" release specify the ROS distro of the existing docker image (eg. humble)"
description: In case of "stable" release specify the ROS distro of the existing docker image (eg.
humble)
type: string
default: "ardent"
default: ardent
target_release:
description: "In case of \"stable\" release specify the version of the existing docker image (eg. 1.0.12)"
description: In case of "stable" release specify the version of the existing docker image (eg.
1.0.12)
type: string
default: "0.0.0"
default: 0.0.0
target_date:
description: "In case of \"stable\" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)"
description: In case of "stable" release specify the date of the existing docker image in format
YYYYMMDD (eg. 20220124)
type: string
default: "20131206"
default: '20131206'
jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -68,7 +72,7 @@ jobs:
uses: husarion-ci/[email protected]
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
main_branch_name: ros2
dockerfile: Dockerfile.${{ inputs.dockerfile }}
repo_name: ${{ env.REPO_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ pyenv
Vagrantfile

.vscode
__pycache__/
__pycache__/
55 changes: 55 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-xml
- id: check-added-large-files
- id: check-ast
- id: check-json
- id: name-tests-test
files: ^.*\/test\/.*$
args: [--pytest-test-first]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
entry: codespell --ignore-words .wordlist.txt *

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
files: ^(?!.*compose).*$
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100']

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

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
args: ['--ignore=E501,W503'] # ignore too long line and line break before binary operator,
# black checks it

# 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/mirrors-clang-format
rev: v17.0.6
hooks:
- id: clang-format
1 change: 1 addition & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empy
6 changes: 3 additions & 3 deletions demo/compose-cpu.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
services:

zed:
image: husarion/zed-desktop-cpu:humble
container_name: zed
network_mode: host
ipc: host
volumes:
- /dev:/dev
- /dev:/dev
environment:
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-0}
- RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION:-rmw_fastrtps_cpp}
Expand All @@ -25,4 +25,4 @@ services:
- DISPLAY=${DISPLAY:?err}
- LIBGL_ALWAYS_SOFTWARE=1
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-0}
- RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION:-rmw_fastrtps_cpp}
- RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION:-rmw_fastrtps_cpp}
322 changes: 159 additions & 163 deletions demo/params/common.yaml

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions demo/params/zed.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# config/zed_yaml
# Parameters for Stereolabs ZED camera
---
/**:
ros__parameters:
general:
camera_model: "zed"
camera_name: "zed" # usually overwritten by launch file
grab_resolution: 'HD720' # The native camera grab resolution. 'HD2K', 'HD1080', 'HD720', 'VGA', 'AUTO'
grab_frame_rate: 15 # ZED SDK internal grabbing rate
ros__parameters:
general:
camera_model: zed
camera_name: zed # usually overwritten by launch file
grab_resolution: HD720 # The native camera grab resolution. 'HD2K', 'HD1080', 'HD720', 'VGA', 'AUTO'
grab_frame_rate: 15 # ZED SDK internal grabbing rate

depth:
min_depth: 0.3 # Min: 0.3, Max: 3.0
max_depth: 10. # Dynamic
depth:
min_depth: 0.3 # Min: 0.3, Max: 3.0
max_depth: 10. # Dynamic
21 changes: 9 additions & 12 deletions demo/params/zed2.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# config/zed2_yaml
# Parameters for Stereolabs ZED2 camera
---
/**:
ros__parameters:
general:
camera_model: "zed2"
camera_name: "zed2" # usually overwritten by launch file
grab_resolution: 'HD720' # The native camera grab resolution. 'HD2K', 'HD1080', 'HD720', 'VGA', 'AUTO'
grab_frame_rate: 30 # ZED SDK internal grabbing rate

depth:
min_depth: 0.2 # Min: 0.2, Max: 3.0
max_depth: 15.0 # Max: 40.0
ros__parameters:
general:
camera_model: zed2
camera_name: zed2 # usually overwritten by launch file
grab_resolution: HD720 # The native camera grab resolution. 'HD2K', 'HD1080', 'HD720', 'VGA', 'AUTO'
grab_frame_rate: 30 # ZED SDK internal grabbing rate

depth:
min_depth: 0.2 # Min: 0.2, Max: 3.0
max_depth: 15.0 # Max: 40.0
21 changes: 9 additions & 12 deletions demo/params/zed2i.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# config/zed2i_yaml
# Parameters for Stereolabs zed2i camera
---
/**:
ros__parameters:
general:
camera_model: "zed2i"
camera_name: "zed2i" # usually overwritten by launch file
grab_resolution: 'HD720' # The native camera grab resolution. 'HD2K', 'HD1080', 'HD720', 'VGA', 'AUTO'
grab_frame_rate: 30 # ZED SDK internal grabbing rate

depth:
min_depth: 0.2 # Min: 0.2, Max: 3.0
max_depth: 10.0 # Max: 40.0
ros__parameters:
general:
camera_model: zed2i
camera_name: zed2i # usually overwritten by launch file
grab_resolution: HD720 # The native camera grab resolution. 'HD2K', 'HD1080', 'HD720', 'VGA', 'AUTO'
grab_frame_rate: 30 # ZED SDK internal grabbing rate

depth:
min_depth: 0.2 # Min: 0.2, Max: 3.0
max_depth: 10.0 # Max: 40.0
21 changes: 9 additions & 12 deletions demo/params/zedm.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# config/zedm_yaml
# Parameters for Stereolabs ZED mini camera
---
/**:
ros__parameters:
general:
camera_model: "zedm"
camera_name: "zedm" # usually overwritten by launch file
grab_resolution: 'HD720' # The native camera grab resolution. 'HD2K', 'HD1080', 'HD720', 'VGA', 'AUTO'
grab_frame_rate: 15 # ZED SDK internal grabbing rate

depth:
min_depth: 0.1 # Min: 0.1, Max: 3.0
max_depth: 10.0 # Max: 20.0
ros__parameters:
general:
camera_model: zedm
camera_name: zedm # usually overwritten by launch file
grab_resolution: HD720 # The native camera grab resolution. 'HD2K', 'HD1080', 'HD720', 'VGA', 'AUTO'
grab_frame_rate: 15 # ZED SDK internal grabbing rate

depth:
min_depth: 0.1 # Min: 0.1, Max: 3.0
max_depth: 10.0 # Max: 20.0
44 changes: 21 additions & 23 deletions demo/params/zedx.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
# config/zedx.yaml
# Parameters for Stereolabs ZED X camera
---
/**:
ros__parameters:
general:
camera_model: "zedx"
camera_name: "zedx" # usually overwritten by launch file
grab_resolution: 'HD1200' # The native camera grab resolution. 'HD1200', 'HD1080', 'SVGA', 'AUTO'
grab_frame_rate: 30 # ZED SDK internal grabbing rate (HD1200/HD1080: 60, 30, 15 - SVGA: 120, 60, 30, 15)
ros__parameters:
general:
camera_model: zedx
camera_name: zedx # usually overwritten by launch file
grab_resolution: HD1200 # The native camera grab resolution. 'HD1200', 'HD1080', 'SVGA', 'AUTO'
grab_frame_rate: 30 # ZED SDK internal grabbing rate (HD1200/HD1080: 60, 30, 15 - SVGA: 120, 60, 30, 15)

video:
exposure_time: 16000 # Defines the real exposure time in microseconds. Recommended to control manual exposure (instead of `video.exposure` setting)
auto_exposure_time_range_min: 28 # Defines the minimum range of exposure auto control in micro seconds
auto_exposure_time_range_max: 30000 # Defines the maximum range of exposure auto control in micro seconds
exposure_compensation: 50 # Defines the Exposure-target compensation made after auto exposure. Reduces the overall illumination target by factor of F-stops. Values range is [0 - 100]. Default value is 50, i.e. no compensation applied
analog_gain: 1255 # Defines the real analog gain (sensor) in mDB. Range [1000-16000]. Recommended to control manual sensor gain (instead of `video.gain` setting)
auto_analog_gain_range_min: 1000 # Defines the minimum range of sensor gain in automatic control
auto_analog_gain_range_max: 16000 # Defines the maximum range of sensor gain in automatic control
digital_gain: 1 # Defines the real digital gain (ISP) as a factor. Range [1-256]. Recommended to control manual ISP gain (instead of `video.gain` setting)
auto_digital_gain_range_min: 1 # Defines the minimum range of digital ISP gain in automatic control
auto_digital_gain_range_max: 256 # Defines the maximum range of digital ISP gain in automatic control
denoising: 50 # Defines the level of denoising applied on both left and right images. Range [0-100]
video:
exposure_time: 16000 # Defines the real exposure time in microseconds. Recommended to control manual exposure (instead of `video.exposure` setting)
auto_exposure_time_range_min: 28 # Defines the minimum range of exposure auto control in micro seconds
auto_exposure_time_range_max: 30000 # Defines the maximum range of exposure auto control in micro seconds
exposure_compensation: 50 # Defines the Exposure-target compensation made after auto exposure. Reduces the overall illumination target by factor of F-stops. Values range is [0 - 100]. Default value is 50, i.e. no compensation applied
analog_gain: 1255 # Defines the real analog gain (sensor) in mDB. Range [1000-16000]. Recommended to control manual sensor gain (instead of `video.gain` setting)
auto_analog_gain_range_min: 1000 # Defines the minimum range of sensor gain in automatic control
auto_analog_gain_range_max: 16000 # Defines the maximum range of sensor gain in automatic control
digital_gain: 1 # Defines the real digital gain (ISP) as a factor. Range [1-256]. Recommended to control manual ISP gain (instead of `video.gain` setting)
auto_digital_gain_range_min: 1 # Defines the minimum range of digital ISP gain in automatic control
auto_digital_gain_range_max: 256 # Defines the maximum range of digital ISP gain in automatic control
denoising: 50 # Defines the level of denoising applied on both left and right images. Range [0-100]

depth:
min_depth: 0.3 # Min: 0.3, Max: 3.0
max_depth: 10.0 # Max: 20.0
depth:
min_depth: 0.3 # Min: 0.3, Max: 3.0
max_depth: 10.0 # Max: 20.0
45 changes: 21 additions & 24 deletions demo/params/zedxm.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# config/zedxm_yaml
# Parameters for Stereolabs ZED X Mini camera
---
/**:
ros__parameters:
general:
camera_model: "zedxm"
camera_name: "zedxm" # usually overwritten by launch file
grab_resolution: 'HD1200' # The native camera grab resolution. 'HD1200', 'HD1080', 'SVGA', 'AUTO'
grab_frame_rate: 30 # ZED SDK internal grabbing rate (HD1200/HD1080: 60, 30, 15 - SVGA: 120, 60, 30, 15)
ros__parameters:
general:
camera_model: zedxm
camera_name: zedxm # usually overwritten by launch file
grab_resolution: HD1200 # The native camera grab resolution. 'HD1200', 'HD1080', 'SVGA', 'AUTO'
grab_frame_rate: 30 # ZED SDK internal grabbing rate (HD1200/HD1080: 60, 30, 15 - SVGA: 120, 60, 30, 15)

video:
exposure_time: 16666 # Defines the real exposure time in microseconds. Recommended to control manual exposure (instead of `video.exposure` setting)
auto_exposure_time_range_min: 28 # Defines the minimum range of exposure auto control in micro seconds
auto_exposure_time_range_max: 16666 # Defines the maximum range of exposure auto control in micro seconds
exposure_compensation: 50 # Defines the Exposure-target compensation made after auto exposure. Reduces the overall illumination target by factor of F-stops. Values range is [0 - 100]. Default value is 50, i.e. no compensation applied
analog_gain: 8000 # Defines the real analog gain (sensor) in mDB. Range [1000-16000]. Recommended to control manual sensor gain (instead of `video.gain` setting)
auto_analog_gain_range_min: 1000 # Defines the minimum range of sensor gain in automatic control
auto_analog_gain_range_max: 16000 # Defines the maximum range of sensor gain in automatic control
digital_gain: 128 # Defines the real digital gain (ISP) as a factor. Range [1-256]. Recommended to control manual ISP gain (instead of `video.gain` setting)
auto_digital_gain_range_min: 1 # Defines the minimum range of digital ISP gain in automatic control
auto_digital_gain_range_max: 256 # Defines the maximum range of digital ISP gain in automatic control
denoising: 50 # Defines the level of denoising applied on both left and right images. Range [0-100]

depth:
min_depth: 0.3 # Min: 0.3, Max: 3.0
max_depth: 10.0 # Max: 20.0
video:
exposure_time: 16666 # Defines the real exposure time in microseconds. Recommended to control manual exposure (instead of `video.exposure` setting)
auto_exposure_time_range_min: 28 # Defines the minimum range of exposure auto control in micro seconds
auto_exposure_time_range_max: 16666 # Defines the maximum range of exposure auto control in micro seconds
exposure_compensation: 50 # Defines the Exposure-target compensation made after auto exposure. Reduces the overall illumination target by factor of F-stops. Values range is [0 - 100]. Default value is 50, i.e. no compensation applied
analog_gain: 8000 # Defines the real analog gain (sensor) in mDB. Range [1000-16000]. Recommended to control manual sensor gain (instead of `video.gain` setting)
auto_analog_gain_range_min: 1000 # Defines the minimum range of sensor gain in automatic control
auto_analog_gain_range_max: 16000 # Defines the maximum range of sensor gain in automatic control
digital_gain: 128 # Defines the real digital gain (ISP) as a factor. Range [1-256]. Recommended to control manual ISP gain (instead of `video.gain` setting)
auto_digital_gain_range_min: 1 # Defines the minimum range of digital ISP gain in automatic control
auto_digital_gain_range_max: 256 # Defines the maximum range of digital ISP gain in automatic control
denoising: 50 # Defines the level of denoising applied on both left and right images. Range [0-100]

depth:
min_depth: 0.3 # Min: 0.3, Max: 3.0
max_depth: 10.0 # Max: 20.0
3 changes: 2 additions & 1 deletion healthcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ int main(int argc, char *argv[]) {
auto node = rclcpp::Node::make_shared("healthcheck_zed");

auto sub = node->create_subscription<sensor_msgs::msg::Image>(
"zed/zed_node/rgb/image_rect_color", rclcpp::SensorDataQoS().keep_last(1), msg_callback);
"zed/zed_node/rgb/image_rect_color", rclcpp::SensorDataQoS().keep_last(1),
msg_callback);

while (rclcpp::ok()) {
rclcpp::spin_some(node);
Expand Down

0 comments on commit 78da7ca

Please sign in to comment.