Skip to content

Commit

Permalink
Switch to yamlfmt from google
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotochleb committed Sep 23, 2024
1 parent bb4f94b commit 804f29d
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 172 deletions.
117 changes: 51 additions & 66 deletions .github/workflows/happypose_ros_build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -1,77 +1,62 @@
---
name: 'Humble: Build and Test'

on :
on:
push:
branches:
- main
- main
pull_request:
branches:
- '*'

- '*'
jobs:
test_happypose_ros:
runs-on: ubuntu-22.04

env:
HAPPYPOSE_DATA_DIR: /tmp/local_data

steps:
- name: Install EGL mesa - required for Panda3D renderer
run: |
sudo apt-get update
sudo apt-get install -qqy libegl1-mesa libegl1-mesa-dev
- name: Install Python C headers and remove Blinker version conflicting with HappyPose
run: |
sudo apt-get update
sudo apt-get install -qqy python3-dev
sudo apt purge -qqy python3-blinker
- name: Caching of the HappyPose installation and data
uses: actions/cache@v4
with:
path: /tmp/local_data
key: data

- name: Update pip
run: pip install -U pip

- name: Download HappyPose source
working-directory: /tmp
run: |
git clone --branch dev --recurse-submodules https://github.com/agimus-project/happypose.git
- name: Build and install HappyPose
working-directory: /tmp/happypose
run: pip install ".[cpu,pypi,evaluation,multiview]" --extra-index-url https://download.pytorch.org/whl/cpu

- name: Download pre-trained models required for tests
run: |
mkdir -p /tmp/local_data
python -m happypose.toolbox.utils.download \
--bop_dataset ycbv \
--cosypose_models \
detector-bop-ycbv-pbr--970850 \
coarse-bop-ycbv-pbr--724183 \
refiner-bop-ycbv-pbr--604090
- name: Unzip HappyPose YCBV models
working-directory: /tmp/local_data/bop_datasets/ycbv
run: |
unzip -n -qq ycbv_base.zip
unzip -n -qq ycbv_models.zip
- name: Remove incompatible PyTest version
run: pip uninstall -y pytest

- name: Install ROS 2 Humble
uses: ros-tooling/[email protected]
with:
required-ros-distributions: humble

- name: Build and test happypose_ros
uses: ros-tooling/[email protected]
with:
package-name: happypose_ros
target-ros2-distro: humble
- name: Install EGL mesa - required for Panda3D renderer
run: |
sudo apt-get update
sudo apt-get install -qqy libegl1-mesa libegl1-mesa-dev
- name: Install Python C headers and remove Blinker version conflicting with HappyPose
run: |
sudo apt-get update
sudo apt-get install -qqy python3-dev
sudo apt purge -qqy python3-blinker
- name: Caching of the HappyPose installation and data
uses: actions/cache@v4
with:
path: /tmp/local_data
key: data
- name: Update pip
run: pip install -U pip
- name: Download HappyPose source
working-directory: /tmp
run: |
git clone --branch dev --recurse-submodules https://github.com/agimus-project/happypose.git
- name: Build and install HappyPose
working-directory: /tmp/happypose
run: pip install ".[cpu,pypi,evaluation,multiview]" --extra-index-url https://download.pytorch.org/whl/cpu
- name: Download pre-trained models required for tests
run: |
mkdir -p /tmp/local_data
python -m happypose.toolbox.utils.download \
--bop_dataset ycbv \
--cosypose_models \
detector-bop-ycbv-pbr--970850 \
coarse-bop-ycbv-pbr--724183 \
refiner-bop-ycbv-pbr--604090
- name: Unzip HappyPose YCBV models
working-directory: /tmp/local_data/bop_datasets/ycbv
run: |
unzip -n -qq ycbv_base.zip
unzip -n -qq ycbv_models.zip
- name: Remove incompatible PyTest version
run: pip uninstall -y pytest
- name: Install ROS 2 Humble
uses: ros-tooling/[email protected]
with:
required-ros-distributions: humble
- name: Build and test happypose_ros
uses: ros-tooling/[email protected]
with:
package-name: happypose_ros
target-ros2-distro: humble
74 changes: 36 additions & 38 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
---
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
hooks:
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: [--write-changes]
exclude: resources/happypose_ros_diagram.drawio.svg
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
args: [--mapping, '2', --sequence, '2', --offset, '0', --colons, --width, '86']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.5
hooks:
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: [--write-changes]
exclude: resources/happypose_ros_diagram.drawio.svg
- repo: https://github.com/google/yamlfmt
rev: v0.13.0
hooks:
- id: yamlfmt
15 changes: 7 additions & 8 deletions happypose_examples/config/camera_info.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
---
image_width : 640
image_height : 480
camera_name : webcam
camera_matrix :
image_width: 640
image_height: 480
camera_name: webcam
camera_matrix:
rows: 3
cols: 3
data: [1066.778, 0.0, 312.9869, 0.0, 1067.487, 241.3109, 0.0, 0.0, 1.0]
distortion_model : plumb_bob
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [0.0, 0.0, 0.0, 0.0, 0.0]
rectification_matrix :
rectification_matrix:
rows: 3
cols: 3
data: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
projection_matrix :
projection_matrix:
rows: 3
cols: 4
data: [1.0, 0.0, 320.0, 0.0, 0.0, 1.0, 240.0, 0.0, 0.0, 0.0, 1.0, 0.0]
9 changes: 3 additions & 6 deletions happypose_examples/config/cosypose_params.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
/**:
ros__parameters:
# Device to which the models will be loaded. Supported options are 'cpu' and 'cuda:x' where 'x' is the GPU number.
Expand All @@ -7,7 +6,6 @@
visualization.publish_markers: true
# Extended verbosity on info logs. Show logs with number of detections and more
verbose_info_logs: true

# Specifies which pose estimator to use in the pipeline
pose_estimator_type: cosypose
cosypose:
Expand All @@ -33,10 +31,9 @@
n_coarse_iterations: 1
# Number of iterations for the coarse estimate
n_refiner_iterations: 3
# Labels of detected objects to keep. If not specyfied, all objects are kept
# labels_to_keep:
# - "ycbv-obj_000001"

# Labels of detected objects to keep. If not specyfied, all objects are kept
# labels_to_keep:
# - "ycbv-obj_000001"
# List of camera names to subscribe to. Those names are internal to happypose_ros node
# and can be chosen arbitrarily as long as they are valid YAML keys to be used later
camera_names: [cam_1]
Expand Down
3 changes: 0 additions & 3 deletions happypose_examples/config/cosypose_params_multiview.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
/**:
ros__parameters:
# Device to which the models will be loaded. Supported options are 'cpu' and 'cuda:x' where 'x' is the GPU number.
Expand All @@ -13,7 +12,6 @@
verbose_info_logs: true
# Which image time stamp to use in final detection message
time_stamp_strategy: oldest

# Specifies which pose estimator to use in the pipeline
pose_estimator_type: cosypose
cosypose:
Expand Down Expand Up @@ -50,7 +48,6 @@
ransac_dist_threshold: 0.02
# Number of steps in the final bundle adjustment refinement
ba_n_iter: 100

# List of camera names to subscribe to. Those names are internal to happypose_ros node
# and can be chosen arbitrarily as long as they are valid YAML keys to be used later
camera_names: [cam_1, cam_2, cam_3]
Expand Down
Loading

0 comments on commit 804f29d

Please sign in to comment.