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

Add pre-commit #7

Closed
wants to merge 1 commit into from
Closed
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
31 changes: 17 additions & 14 deletions .github/workflows/ros-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
name: Build/Publish ROS Docker Image
---
name: Build/Publish ROS Docker Image

on:
on:
workflow_dispatch:
inputs:
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'
repository_dispatch:
types: [rebuild]
pull_request:
Expand All @@ -36,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ros-distro: [ "humble" ] # iron is not supported on arm
ros-distro: [humble] # iron is not supported on arm

steps:

Expand All @@ -47,12 +51,11 @@ jobs:
uses: husarion-ci/[email protected]
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
build_type: ${{ inputs.build_type }}
ros_distro: ${{ matrix.ros-distro }}
platforms: "linux/amd64, linux/arm64"
platforms: linux/amd64, linux/arm64
# variables important only for stable release
target_distro: ${{ inputs.target_distro }}
target_release: ${{ inputs.target_release }}
target_date: ${{ inputs.target_date }}

29 changes: 16 additions & 13 deletions .github/workflows/vulcanexus-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
---
name: Build/Publish Vulcanexus Docker Image

on:
workflow_dispatch:
inputs:
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'
repository_dispatch:
types: [rebuild]
pull_request:
Expand All @@ -36,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ros-distro: [ "humble" ] # iron is not supported on arm
ros-distro: [humble] # iron is not supported on arm

steps:

Expand All @@ -47,13 +51,12 @@ jobs:
uses: husarion-ci/[email protected]
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
build_type: ${{ inputs.build_type }}
ros_distro: ${{ matrix.ros-distro }}
platforms: "linux/amd64, linux/arm64"
prefix: "vulcanexus-"
platforms: linux/amd64, linux/arm64
prefix: vulcanexus-
# variables important only for stable release
target_distro: ${{ inputs.target_distro }}
target_release: ${{ inputs.target_release }}
target_date: ${{ inputs.target_date }}

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 *

- 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
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
Building a Docker image with Navigation 2.

Available for ROS distros:
- ROS 2 galactic
- ROS 2 humble
- ROS 2 Humble

Using in Docker Compose:

```yaml
nav2:
image: husarion/navigation2:humble
restart: unless-stopped
volumes:
volumes:
- ./config/nav2_params.yaml:/nav2_params.yaml
command: >
ros2 launch nav2_bringup navigation_launch.py
ros2 launch nav2_bringup navigation_launch.py
params_file:=/nav2_params.yaml
```

Expand All @@ -25,4 +24,4 @@ Using in Docker Compose:
```bash
sudo apt install -y qemu-user-static binfmt-support
docker buildx build --platform linux/arm64,linux/amd64 -t nav2-test --build-arg PREFIX=vulcanexus- .
```
```
3 changes: 1 addition & 2 deletions healthcheck/healthcheck_localization.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ int main(int argc, char *argv[]) {
auto node = rclcpp::Node::make_shared("healthcheck_node");

auto sub = node->create_subscription<lifecycle_msgs::msg::TransitionEvent>(
"amcl/transition_event", rclcpp::SystemDefaultsQoS(),
msg_callback);
"amcl/transition_event", rclcpp::SystemDefaultsQoS(), msg_callback);

rclcpp::spin(node);

Expand Down
23 changes: 12 additions & 11 deletions nav2_params/rosbot2_amcl.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
---
amcl:
ros__parameters:
use_sim_time: False
use_sim_time: false
alpha1: 0.2
alpha2: 0.2
alpha3: 0.2
alpha4: 0.2
alpha5: 0.2
base_frame_id: "base_link"
base_frame_id: base_link
beam_skip_distance: 0.5
beam_skip_error_threshold: 0.9
beam_skip_threshold: 0.3
do_beamskip: false
global_frame_id: "map"
global_frame_id: map
lambda_short: 0.1
laser_likelihood_max_dist: 2.0
laser_max_range: 12.0
laser_min_range: -1.0
laser_model_type: "likelihood_field"
laser_model_type: likelihood_field
max_beams: 60
max_particles: 25000
min_particles: 6000
odom_frame_id: "odom"
odom_frame_id: odom
pf_err: 0.05
pf_z: 0.99
recovery_alpha_fast: 0.0
recovery_alpha_slow: 0.0
resample_interval: 1
robot_model_type: nav2_amcl::DifferentialMotionModel # robot_model_type: "differential" # on foxy
robot_model_type: nav2_amcl::DifferentialMotionModel # robot_model_type: "differential" # on foxy
save_pose_rate: 0.5
sigma_hit: 0.2
tf_broadcast: true
Expand All @@ -37,7 +38,7 @@ amcl:
z_max: 0.05
z_rand: 0.5
z_short: 0.05
scan_topic: "scan"
scan_topic: scan
set_initial_pose: true
always_reset_initial_pose: true
initial_pose:
Expand All @@ -48,13 +49,13 @@ amcl:

amcl_map_client:
ros__parameters:
use_sim_time: False
use_sim_time: false

amcl_rclcpp_node:
ros__parameters:
use_sim_time: False
use_sim_time: false

map_server:
ros__parameters:
use_sim_time: False
yaml_filename: "map.yaml"
use_sim_time: false
yaml_filename: map.yaml
Loading
Loading