Skip to content

Commit

Permalink
Jazzy - General code maintenance (#123)
Browse files Browse the repository at this point in the history
* support for RPi5

* restart ros2_control_node if error

* minor fixes

* Update controller.launch.py

* fix mecanum lauch

* Fix controller namespace (#115)

* Fix controller namespace

* spellcheck fix

* use husarion-controller from main branch (#116)

* added docker setup for local build

* ros2 humble works without custom controllers

* Cleaner logs from flash script (#108)

* Clean up output of flash script

* Pre commit

* Cleaner

* Specify concrete commands

* Simplify

* pre-commit fix

* Clean up usb firmware

* Clean up unused arguments (#118)

* Add scan filter

* Clean up

* undo

* added docker setup for local build

* broken ros2 controller - previous worked fine

* Clean up unused arguments

* Fix workflow: Remove spellcheck (redundant), fix integration check

* Fix multiple robot spawn

* fixes

* Delete tools folder

* Pre-commit update and remove redundant flake8

* Fix some tests and set hash in vcs

* Clean up

* Move controller test to bringup and reduce test time

* Fix lidar in simulation

* Rename test files

* Fix tests

* Add scan_filtered test and improve workpace tree

---------

Co-authored-by: Dominik Nowak <[email protected]>

* Applied xml schemas for xmllint (#101)

* applied package.xml template

Signed-off-by: Jakub Delicat <[email protected]>

* chronology

Signed-off-by: Jakub Delicat <[email protected]>

* Support

Signed-off-by: Jakub Delicat <[email protected]>

* Removed unnecessary dep

Signed-off-by: Jakub Delicat <[email protected]>

* DDS xml lint

---------

Signed-off-by: Jakub Delicat <[email protected]>
Co-authored-by: rafal-gorecki <[email protected]>

* Some fixes

* test

* Pre-commit

* pre-commit

* Humble docker (#124)

* Add hardware and sim Docker

* Fix hardware docker

* Fixes

* Use packages-up-to

* Add description to compose

* Jazzy docker (#125)

* Add hardware and sim Docker

* Fix hardware docker

* Fixes

* Fixes

* Simulation gz_gui fixes + use TwistStamped

* Use packages-up-to

* Add healthcheck + clean up

* Add healthcheck + clean up

* Remove combined.launch.py

* Add User env to docker

* Add devcontainer

* Changes in healthcheck

* Fix simulation

* Red error info

* Change healthcheck

* Remove healthcheck arg

* Fix workflow

* Remove building imu_broadcaster

* One more removal

* update repos

* Clean up

* Update docs

* Add launch arguments info

* Add status info

* add unsaved

* fix

* Simplify

* Update URDF, fix mecanum sim, fix laser_filter ns, remove tf renaming

* pre-commit

* Fix ros2 controller with namespace

* Fix building instructions

* Fix indent

* Fix mecanum controller

* Remove camera test from sim

* update

* Adjust wheel_separation_multiplier param

* Simplify docker

---------

Signed-off-by: Jakub Delicat <[email protected]>
Co-authored-by: dominikn <[email protected]>
Co-authored-by: Jakub Delicat <[email protected]>
  • Loading branch information
3 people authored Dec 11, 2024
1 parent 2760517 commit 9ffafaa
Show file tree
Hide file tree
Showing 75 changed files with 1,467 additions and 2,269 deletions.
37 changes: 37 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM husarnet/ros:jazzy-ros-base

ARG USERNAME=husarion
ARG UID=1001
ARG GID=$UID

# Install development tools
RUN apt update -q && \
apt upgrade -q -y && \
apt install -y --no-install-recommends \
python3-pip \
ros-dev-tools \
ros-$ROS_DISTRO-plotjuggler \
ros-$ROS_DISTRO-plotjuggler-ros \
ros-$ROS_DISTRO-rqt* \
ros-$ROS_DISTRO-rviz2 \
ros-$ROS_DISTRO-teleop-twist-keyboard

# Create and switch to user
RUN groupadd -g $GID $USERNAME && \
useradd -lm -u $UID -g $USERNAME -s /bin/bash $USERNAME && \
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER $USERNAME

# Setup workspace
WORKDIR /home/$USERNAME/ros2_ws
RUN mkdir -p /home/$USERNAME/ros2_ws/src && \
echo 'source /opt/ros/'$ROS_DISTRO'/setup.bash' >> /home/$USERNAME/.bashrc && \
echo 'source /home/'$USERNAME'/ros2_ws/install/setup.bash' >> /home/$USERNAME/.bashrc

ENV TERM=xterm-256color
ENV RCUTILS_COLORIZED_OUTPUT=1

# Setup entrypoint
COPY ./ros_entrypoint.sh /
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
25 changes: 25 additions & 0 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
services:
devcontainer:
build: .
ipc: host
network_mode: host
privileged: true
tty: true
runtime: nvidia
volumes:
- ros2_ws_volume:/home/husarion/ros2_ws
- ../:/home/husarion/ros2_ws/src/rosbot_ros:cached
- /tmp/.X11-unix:/tmp/.X11-unix
- /home/${USER}/.ssh:/home/husarion/.ssh
- /lib/modules:/lib/modules:ro
environment:
- DISPLAY
- RMW_IMPLEMENTATION
- QT_X11_NO_MITSHM=1
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
- PIP_BREAK_SYSTEM_PACKAGES=1
command: sleep infinity

volumes:
ros2_ws_volume:
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"dockerComposeFile": "compose.yaml",
"initializeCommand": "xhost +local:docker",
"service": "devcontainer",
"workspaceFolder": "/home/husarion/ros2_ws/src",
// "postCreateCommand": "~/ros2_ws/src/ros/.vscode/scripts/install_dependencies.sh && ~/ros2_ws/src/ros/.vscode/scripts/install_dependencies.sh",
"shutdownAction": "stopCompose",
"customizations": {
"vscode": {
"extensions": [
"althack.ament-task-provider",
"charliermarsh.ruff",
"eamodio.gitlens",
"GitHub.copilot",
"ms-python.python",
"ms-iot.vscode-ros",
"ms-vscode.cpptools-extension-pack",
"smilerobotics.urdf",
"redhat.vscode-xml",
"tamasfe.even-better-toml",
"timonwong.shellcheck",
"streetsidesoftware.code-spell-checker",
"yzhang.markdown-all-in-one"
],
"settings": {
"files.associations": {
"*.rviz": "yaml",
"*.srdf": "xml",
"*.urdf": "xml",
"*.xacro": "xml"
}
}
}
}
}
5 changes: 5 additions & 0 deletions .devcontainer/ros_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# shellcheck disable=SC1090,SC1091
set -e

exec "$@"
48 changes: 15 additions & 33 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,11 @@ on:
workflow_dispatch:

jobs:
black:
name: Black
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Black
uses: psf/[email protected]
with:
options: --line-length=99

spellcheck:
name: Spellcheck
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Spellcheck
uses: rojopolis/[email protected]
pre-commit:
name: Pre-commit
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master
with:
ros_distro: jazzy

industrial_ci:
name: Industrial CI
Expand All @@ -36,35 +22,31 @@ jobs:
ROS_DISTRO: [jazzy]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Act + Docker fix
run: |
sudo chown runner:docker /var/run/docker.sock
uses: actions/checkout@v4

- name: Setup ROS2 Workspace and Clone Repositories
run: |
mkdir -p src
find . -maxdepth 1 -not -name src -not -name . -exec mv {} src/ \;
mkdir -p src/rosbot_ros
find . -maxdepth 1 -not -name src -not -name . -exec mv {} src/rosbot_ros \;
python3 -m pip install -U vcstool
vcs import src < src/rosbot/rosbot_hardware.repos
vcs import src < src/rosbot/rosbot_simulation.repos
vcs import src < src/rosbot_ros/rosbot/rosbot_hardware.repos
vcs import src < src/rosbot_ros/rosbot/rosbot_simulation.repos
cp -r src/ros2_controllers/diff_drive_controller src/
cp -r src/ros2_controllers/imu_sensor_broadcaster src/
rm -rf src/ros2_controllers
# Package micro_ros_msgs does not have industrial ci and tests does not pass.
# For more information see https://github.com/micro-ROS/micro_ros_msgs/issues/7
- name: Leave only ROSbot tests
shell: bash
run: |
sed '/if(BUILD_TESTING)/,/endif()/d' src/micro_ros_msgs/CMakeLists.txt -i
- name: Fix pip
shell: bash
run: |
echo -e "[global]\nbreak-system-packages = true" >> ~/.config/pip/pip.conf
sed '/if(BUILD_TESTING)/,/endif()/d' src/ros_components_description/CMakeLists.txt -i
- name: Running ROS Industrial CI
uses: ros-industrial/industrial_ci@master
env:
PIP_BREAK_SYSTEM_PACKAGES: 1
ROS_DISTRO: ${{matrix.ROS_DISTRO}}
DOCKER_IMAGE: ros:${{matrix.ROS_DISTRO}}-ros-base
IMMEDIATE_TEST_OUTPUT: true
69 changes: 46 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,51 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.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
# mesh files has to be taken into account
args: [--maxkb=3000]
- id: check-ast
- id: check-json
exclude: ^.vscode/|^.devcontainer/
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: name-tests-test
files: ^.*\/test\/.*$
args: [--pytest-test-first]
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile, black]

- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.4
hooks:
- id: clang-format

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
name: codespell
description: Checks for common misspellings in text files.
entry: codespell *
entry: codespell
exclude_types: [rst, svg]
language: python
types: [text]

Expand All @@ -33,23 +57,16 @@ repos:
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100']

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

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

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile, black]
args: ['--ignore=E501,W503']

- repo: local
hooks:
Expand All @@ -65,14 +82,20 @@ repos:
- id: ament_copyright
name: ament_copyright
description: Check if copyright notice is available in all files.
stages: [commit]
stages: [pre-commit]
entry: ament_copyright
language: system
exclude: ^.*\.md$

# Docs - RestructuredText hooks
- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
rev: v1.1.2
hooks:
- id: doc8
args: [--max-line-length=100, --ignore=D001]
exclude: ^.*\/CHANGELOG\.rst/.*$

- repo: https://github.com/tier4/pre-commit-hooks-ros
rev: v0.10.0
hooks:
- id: prettier-package-xml
- id: sort-package-xml
54 changes: 0 additions & 54 deletions .pyspelling.yaml

This file was deleted.

Loading

0 comments on commit 9ffafaa

Please sign in to comment.