diff --git a/.github/workflows/bump_version.yaml b/.github/workflows/bump_version.yaml index 98253389..a0a6574f 100644 --- a/.github/workflows/bump_version.yaml +++ b/.github/workflows/bump_version.yaml @@ -1,60 +1,64 @@ +--- name: Bump version on: - workflow_dispatch: - inputs: - name: - description: "Version to bump (major, minor, patch)" - default: "patch" - required: true - pull_request: - branches: master - types: [closed] + workflow_dispatch: + inputs: + name: + description: Version to bump (major, minor, patch) + default: patch + required: true + pull_request: + branches: master + types: [closed] jobs: - get-bump: - name: Get version bump - runs-on: ubuntu-latest - outputs: - bump: ${{ env.BUMP }} - steps: - - if: github.event_name == 'pull_request' && github.event.pull_request.merged == true + industrial_ci: + name: Industrial CI + uses: ./.github/workflows/industrial_ci.yaml + + get-bump: name: Get version bump - id: get-version-bump - uses: husarion-ci/action-get-version-bump@v0.3.0 - - if: github.event_name == 'pull_request' && github.event.pull_request.merged == true - run: echo "BUMP=${{ steps.get-version-bump.outputs.bump }}" >> $GITHUB_ENV - - if: github.event_name == 'workflow_dispatch' - run: echo "BUMP=${{ github.event.inputs.name }}" >> $GITHUB_ENV + runs-on: ubuntu-latest + needs: industrial_ci + outputs: + bump: ${{ env.BUMP }} + steps: + - if: github.event_name == 'pull_request' && github.event.pull_request.merged == true + name: Get version bump + id: get-version-bump + uses: husarion-ci/action-get-version-bump@v0.3.0 + - if: github.event_name == 'pull_request' && github.event.pull_request.merged == true + run: echo "BUMP=${{ steps.get-version-bump.outputs.bump }}" >> $GITHUB_ENV + - if: github.event_name == 'workflow_dispatch' + run: echo "BUMP=${{ github.event.inputs.name }}" >> $GITHUB_ENV + + catkin-release: + name: Bump version + runs-on: ubuntu-latest + needs: get-bump + outputs: + new_version: ${{ steps.catkin-release.outputs.new_version }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Catkin release + id: catkin-release + uses: husarion-ci/action-catkin-release@v0.1.4 + with: + bump: ${{ needs.get-bump.outputs.bump }} + github_token: ${{ secrets.GITHUB_TOKEN }} + git_user: action-bot + git_email: action-bot@action-bot.com - catkin-release: - name: Bump version - runs-on: ubuntu-latest - needs: get-bump - outputs: - new_version: ${{ steps.catkin-release.outputs.new_version }} - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Catkin release - id: catkin-release - uses: husarion-ci/action-catkin-release@v0.1.4 - with: - bump: ${{ needs.get-bump.outputs.bump }} - github_token: ${{ secrets.GITHUB_TOKEN }} - git_user: action-bot - git_email: action-bot@action-bot.com - - build-and-push-docker-image: - name: Create new docker image - runs-on: ubuntu-latest - needs: catkin-release - steps: - - name: trigger the endpoint - run: > - curl -X POST - -H "Accept: application/vnd.github+json" - -H "Authorization: Bearer ${{ secrets.GH_PAT }}" - https://api.github.com/repos/husarion/rosbot-xl-docker/dispatches - -d '{"event_type":"ros-package-update","client_payload":{"image_version":"${{ needs.catkin-release.outputs.new_version }}"}}' + build-and-push-docker-image: + name: Create new docker image + runs-on: ubuntu-latest + needs: catkin-release + steps: + - name: trigger the endpoint + run: > + curl -X POST + -H "Accept: application/vnd.github+json" + -H "Authorization: Bearer ${{ secrets.GH_PAT }}" + https://api.github.com/repos/husarion/rosbot-xl-docker/dispatches + -d '{"event_type":"ros-package-update","client_payload":{"image_version":"${{ needs.catkin-release.outputs.new_version }}"}}' diff --git a/.github/workflows/industrial_ci.yaml b/.github/workflows/industrial_ci.yaml index 1270553c..8d146895 100644 --- a/.github/workflows/industrial_ci.yaml +++ b/.github/workflows/industrial_ci.yaml @@ -1,25 +1,44 @@ +--- name: Industrial CI on: - workflow_call: - pull_request: - push: - branches: - - master + workflow_call: + workflow_dispatch: + push: + jobs: - industrial_ci: - strategy: - fail-fast: false - matrix: - ROS_DISTRO: [humble] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Clone installation requirements - shell: bash - run : python3 -m pip install -U vcstool && - vcs import . < ./rosbot_xl/rosbot_xl_hardware.repos && - vcs import . < ./rosbot_xl/rosbot_xl_simulation.repos - - uses: ros-industrial/industrial_ci@master - env: - ROS_DISTRO: ${{matrix.ROS_DISTRO}} + black: + name: Black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: psf/black@stable + with: + options: --line-length=99 + + spellcheck: + name: Spellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: rojopolis/spellcheck-github-actions@0.33.1 + name: Spellcheck + + ros_industrial_ci: + name: ROS Industrial CI + needs: + - black + - spellcheck + strategy: + fail-fast: false + matrix: + ROS_DISTRO: [humble] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Clone installation requirements + shell: bash + run: python3 -m pip install -U vcstool && vcs import . < ./rosbot_xl/rosbot_xl_hardware.repos && vcs import . < ./rosbot_xl/rosbot_xl_simulation.repos + - uses: ros-industrial/industrial_ci@master + env: + ROS_DISTRO: ${{matrix.ROS_DISTRO}} diff --git a/.gitignore b/.gitignore index c3ec0d55..c57e18a4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,18 @@ demo/test/.env demo/id dev_utils/ -# ROS2 +# ROS 2 build folders build/ install/ log/ __pycache__/ -.pre-commit-config.yaml + +# ROSbots submodules +rosbot_hardware_interfaces/ +ros_components_description/ +rosbot_controllers/ +husarion/husarion_office_gz +gazebosim/gz_ros2_control + +# pyspelling +*.dic diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..ab067c58 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,71 @@ +--- +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: v1.16.0 + hooks: + - id: codespell + name: codespell + description: Checks for common misspellings in text files. + entry: codespell * + language: python + types: [text] + + - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.2.1 + hooks: + - id: yamlfmt + files: ^.github|./\.yaml + + - repo: https://github.com/psf/black + rev: 23.10.1 + hooks: + - id: black + args: ["--line-length=99", "--preview"] + + - repo: https://github.com/PyCQA/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + args: ["--ignore=E501,W503,E203"] # ignore too long line and line break before binary operator, + # black checks it + + - 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$ + + - repo: local + hooks: + - id: ament_copyright + name: ament_copyright + description: Check if copyright notice is available in all files. + stages: [commit] + entry: ament_copyright + language: system + + # 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/.*$ diff --git a/.pyspelling.yaml b/.pyspelling.yaml new file mode 100644 index 00000000..df8259ca --- /dev/null +++ b/.pyspelling.yaml @@ -0,0 +1,53 @@ +matrix: +- name: Python Source + aspell: + lang: en + d: en_US + camel-case: true + sources: + - 'rosbot*/**/*.py' + + dictionary: + encoding: utf-8 + output: wordlist.dic + wordlists: + - .wordlist.txt + + pipeline: + - pyspelling.filters.python: + comments: true + +- name: Markdown sources + aspell: + lang: en + d: en_US + camel-case: true + sources: + - 'rosbot*/**/*.md' + - 'rosbot*/**/*.txt' + dictionary: + encoding: utf-8 + output: wordlist.dic + wordlists: + - .wordlist.txt + + pipeline: + - pyspelling.filters.text + +- name: XML sources + aspell: + lang: en + d: en_US + camel-case: true + sources: + - 'rosbot*/**/*.xacro' + - 'rosbot*/**/*.urdf' + - 'rosbot*/**/*.xml' + dictionary: + encoding: utf-8 + output: wordlist.dic + wordlists: + - .wordlist.txt + + pipeline: + - pyspelling.filters.xml diff --git a/.wordlist.txt b/.wordlist.txt new file mode 100644 index 00000000..6d7ca908 --- /dev/null +++ b/.wordlist.txt @@ -0,0 +1,64 @@ +wordlist +wordlists +pyspelling +metapackage +preconfigured +colcon +rosbot_xl_description +vcs +vcstool +rosdep +rosdistro +Dockerfiles +gamepad +teleoperation +laserscan +amcl +env +usr +ros +husarion +apache +http +www +urdf +xacro +imu +xl +rosbot +https +cmake +github +ament +Wojciechowski +Stepien +Nowak +Nikolas +ROSbot +Maciej +Krzysztof +extrinsics +Duc +Dominik +bringup +gz +ign +Jakub +Delicat +mecanum +fdir +webots +accelerometer +cmd +config +rl +rr +unstamped +vel +msg +lidar +gpu +gazebosim +msgs +nav +pytest diff --git a/LICENSE.txt b/LICENSE.txt index 8b1f1a64..a835c7d1 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,5 @@ ROSBOT XL ROS PACKAGE LICENSING -The default license for ROSbot XL ROS package is the Apache License, Version 2.0 -(see LICENSE_APACHE2.txt); you may elect at your option to use the ROSbot XL ROS -package under the MIT License (see LICENSE_MIT.txt). Contributions must be +The default license for ROSbot XL ROS package is the Apache License, Version 2.0 +(see LICENSE_APACHE2.txt); you may elect at your option to use the ROSbot XL ROS +package under the MIT License (see LICENSE_MIT.txt). Contributions must be made under both licenses. diff --git a/README.md b/README.md index db4c18e7..75674047 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ROS2 packages for ROSbot XL ### `rosbot_xl` -Metapackeage that contains dependencies to other repositories. It is also used to define whether simulation dependencies should be used. +Metapackage that contains dependencies to other repositories. It is also used to define whether simulation dependencies should be used. ### `rosbot_xl_bringup` @@ -106,6 +106,43 @@ colcon build source install/setup.bash ros2 launch rosbot_xl_gazebo simulation.launch.py ``` +## Testing package + +### pre-commit +[pre-commit configuration](.pre-commit-config.yaml) prepares plenty of tests helping for developing and contributing. Usage: + +```bash +# install pre-commit +pip install pre-commit + +# initialize pre-commit workspace +pre-commit install + +# manually run tests +pre-commit run -a +``` + +After initialization [pre-commit configuration](.pre-commit-config.yaml) will applied on every commit. + +### Industrial CI +``` +colcon test +``` + +> [!NOTE] +> Command `colcon test` does not build the code. Remember to build your code after changes. + +If tests finish with errors print logs: +``` +colcon test-result --verbose +``` + +### Format python code with [Black](https://github.com/psf/black) +``` +cd src/ +black rosbot* +``` + ## Demos diff --git a/ROS_API.md b/ROS_API.md index 1908c250..3cddc39d 100644 --- a/ROS_API.md +++ b/ROS_API.md @@ -1,9 +1,9 @@ Use `bringup.launch.py` from `rosbot_xl_bringup` to start all base functionalities for ROSbot XL. It consists of the following parts: -- `scan_to_scan_filter_chain` from `laser_filters`, it subscribes to `/scan` topic and removes all points that are within the robot's footprint (defined by config `laser_filter.yaml` in `rosbot_xl_bringup` package). Filtered laserscan is then published on `/scan_filtered` topic - +- `scan_to_scan_filter_chain` from `laser_filters`, it subscribes to `/scan` topic and removes all points that are within the robot's footprint (defined by config `laser_filter.yaml` in `rosbot_xl_bringup` package). Filtered laser scan is then published on `/scan_filtered` topic + **Subscribes** - `/scan` (_sensor_msgs/LaserScan_) - + **Publishes** - `/scan_filtered` (_sensor_msgs/LaserScan_) @@ -12,13 +12,13 @@ Use `bringup.launch.py` from `rosbot_xl_bringup` to start all base functionaliti **Subscribes** - `/rosbot_xl_base_controller/odom` (_nav_msgs/Odometry_) - `/imu_broadcaster/imu` (_sensor_msgs/Imu_) - + **Publishes** - `/tf` (_tf2_msgs/TFMessage_) - `base_link`->`odom` transform - `/odometry/filtered` (_nav_msgs/Odometry_) -- `controller.launch.py` from `rosbot_xl_controller`, it loads robot model defined in `rosbot_xl_description` as well as ros2 control [rosbot_hardware_interfaces](https://github.com/husarion/rosbot_hardware_interfaces). It also starts controllers: +- `controller.launch.py` from `rosbot_xl_controller`, it loads robot model defined in `rosbot_xl_description` as well as ros2 control [rosbot_hardware_interfaces](https://github.com/husarion/rosbot_hardware_interfaces). It also starts controllers: * `joint_state_broadcaster` * `rosbot_xl_base_controller` - depending on the value of `mecanum` argument it can be `DiffDriveController` or `MecanumDriveController` * `imu_broadcaster` @@ -27,7 +27,7 @@ Use `bringup.launch.py` from `rosbot_xl_bringup` to start all base functionaliti - `/cmd_vel` (_geometry_msgs/Twist_) - `/_motors_responses` (_sensor_msgs/JointState_) - `/_imu/data_raw` (_sensor_msgs/Imu_) - + **Publishes** - `/tf` (_tf2_msgs/TFMessage_) - `/tf_static` (_tf2_msgs/TFMessage_) diff --git a/rosbot_xl/CHANGELOG.rst b/rosbot_xl/CHANGELOG.rst index b1285f1b..c40a15d5 100644 --- a/rosbot_xl/CHANGELOG.rst +++ b/rosbot_xl/CHANGELOG.rst @@ -2,6 +2,35 @@ Changelog for package rosbot_xl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +0.8.8 (2023-10-25) +------------------ + +0.8.7 (2023-10-24) +------------------ + +0.8.6 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into test-controller +* Contributors: Jakub Delicat + +0.8.5 (2023-10-24) +------------------ +* Merge pull request `#45 `_ from husarion/add-pyspelling + Add pyspelling +* Merge remote-tracking branch 'origin/master' into add-pyspelling +* Contributors: Jakub Delicat, rafal-gorecki + +0.8.4 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into add-black +* Contributors: Jakub Delicat + +0.8.3 (2023-10-24) +------------------ +* Merge pull request `#50 `_ from husarion/add-pre-commit + added and applied precommit +* Contributors: Jakub Delicat + 0.8.2 (2023-05-23) ------------------ diff --git a/rosbot_xl/CMakeLists.txt b/rosbot_xl/CMakeLists.txt index 1949e356..e5ae9d51 100644 --- a/rosbot_xl/CMakeLists.txt +++ b/rosbot_xl/CMakeLists.txt @@ -3,4 +3,4 @@ project(rosbot_xl) find_package(ament_cmake REQUIRED) -ament_package() \ No newline at end of file +ament_package() diff --git a/rosbot_xl/package.xml b/rosbot_xl/package.xml index e03a1863..a318001a 100644 --- a/rosbot_xl/package.xml +++ b/rosbot_xl/package.xml @@ -2,9 +2,9 @@ rosbot_xl - 0.8.2 + 0.8.8 - Meta package that contains all packages of Rosbot XL + Meta package that contains all packages of ROSbot XL Apache License 2.0 Krzysztof Wojciechowski diff --git a/rosbot_xl/rosbot_xl_hardware.repos b/rosbot_xl/rosbot_xl_hardware.repos index 0bf1d2ec..84c92831 100644 --- a/rosbot_xl/rosbot_xl_hardware.repos +++ b/rosbot_xl/rosbot_xl_hardware.repos @@ -10,4 +10,4 @@ repositories: ros_components_description: type: git url: https://github.com/husarion/ros_components_description.git - version: ros2 \ No newline at end of file + version: ros2 diff --git a/rosbot_xl/rosbot_xl_simulation.repos b/rosbot_xl/rosbot_xl_simulation.repos index 0d30339e..400406a9 100644 --- a/rosbot_xl/rosbot_xl_simulation.repos +++ b/rosbot_xl/rosbot_xl_simulation.repos @@ -3,10 +3,10 @@ repositories: type: git url: https://github.com/ros-controls/gz_ros2_control.git # on branch humble hardware isn't activated - # recently on master API breaking change was introduced, it is necessay to use commit before this change + # recently on master API breaking change was introduced, it is necessary to use commit before this change version: b296ff2f5c3758b637a70bd496fe6ed875ab03ce husarion/gazebo_worlds: type: git url: https://github.com/husarion/gazebo_worlds.git - version: main \ No newline at end of file + version: main diff --git a/rosbot_xl_bringup/CHANGELOG.rst b/rosbot_xl_bringup/CHANGELOG.rst index 1e9a6806..675193ea 100644 --- a/rosbot_xl_bringup/CHANGELOG.rst +++ b/rosbot_xl_bringup/CHANGELOG.rst @@ -2,6 +2,36 @@ Changelog for package rosbot_xl_bringup ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +0.8.8 (2023-10-25) +------------------ + +0.8.7 (2023-10-24) +------------------ +* Merge pull request `#51 `_ from husarion/workflow-test + Workflow test +* Contributors: rafal-gorecki + +0.8.6 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into test-controller +* Contributors: Jakub Delicat + +0.8.5 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into add-pyspelling +* Contributors: Jakub Delicat + +0.8.4 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into add-black +* Contributors: Jakub Delicat + +0.8.3 (2023-10-24) +------------------ +* Merge pull request `#50 `_ from husarion/add-pre-commit + added and applied precommit +* Contributors: Jakub Delicat + 0.8.2 (2023-05-23) ------------------ diff --git a/rosbot_xl_bringup/CMakeLists.txt b/rosbot_xl_bringup/CMakeLists.txt index b78851c1..f7ec6cdb 100644 --- a/rosbot_xl_bringup/CMakeLists.txt +++ b/rosbot_xl_bringup/CMakeLists.txt @@ -9,4 +9,4 @@ install(DIRECTORY DESTINATION share/${PROJECT_NAME} ) -ament_package() \ No newline at end of file +ament_package() diff --git a/rosbot_xl_bringup/launch/bringup.launch.py b/rosbot_xl_bringup/launch/bringup.launch.py index 1de65e95..c1bd87c2 100644 --- a/rosbot_xl_bringup/launch/bringup.launch.py +++ b/rosbot_xl_bringup/launch/bringup.launch.py @@ -1,4 +1,16 @@ -#!/usr/bin/env python3 +# Copyright 2023 Husarion +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. from launch import LaunchDescription from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument @@ -18,7 +30,9 @@ def generate_launch_description(): declare_mecanum_arg = DeclareLaunchArgument( "mecanum", default_value="False", - description="Whether to use mecanum drive controller (otherwise diff drive controller is used)", + description=( + "Whether to use mecanum drive controller (otherwise diff drive controller is used)" + ), ) camera_model = LaunchConfiguration("camera_model") diff --git a/rosbot_xl_bringup/package.xml b/rosbot_xl_bringup/package.xml index 82b5a572..ce3906a7 100644 --- a/rosbot_xl_bringup/package.xml +++ b/rosbot_xl_bringup/package.xml @@ -2,7 +2,7 @@ rosbot_xl_bringup - 0.8.2 + 0.8.8 The rosbot_xl_bringup package Apache License 2.0 diff --git a/rosbot_xl_controller/CHANGELOG.rst b/rosbot_xl_controller/CHANGELOG.rst index 70c60386..5ff0f696 100644 --- a/rosbot_xl_controller/CHANGELOG.rst +++ b/rosbot_xl_controller/CHANGELOG.rst @@ -1,6 +1,38 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package rosbot_xl_controller -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +0.8.8 (2023-10-25) +------------------ + +0.8.7 (2023-10-24) +------------------ +* Merge pull request `#51 `_ from husarion/workflow-test + Workflow test +* Contributors: rafal-gorecki + +0.8.6 (2023-10-24) +------------------ +* Merge pull request `#46 `_ from husarion/test-controller + Test controller +* Merge remote-tracking branch 'origin/master' into test-controller +* Contributors: Jakub Delicat, rafal-gorecki + +0.8.5 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into add-pyspelling +* Contributors: Jakub Delicat + +0.8.4 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into add-black +* Contributors: Jakub Delicat + +0.8.3 (2023-10-24) +------------------ +* Merge pull request `#50 `_ from husarion/add-pre-commit + added and applied precommit +* Contributors: Jakub Delicat 0.8.2 (2023-05-23) ------------------ diff --git a/rosbot_xl_controller/CMakeLists.txt b/rosbot_xl_controller/CMakeLists.txt deleted file mode 100644 index 76fe7a70..00000000 --- a/rosbot_xl_controller/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.10.2) -project(rosbot_xl_controller) - -find_package(ament_cmake REQUIRED) - -install(DIRECTORY - launch - config - DESTINATION share/${PROJECT_NAME} -) - -ament_package() \ No newline at end of file diff --git a/rosbot_xl_controller/config/diff_drive_controller.yaml b/rosbot_xl_controller/config/diff_drive_controller.yaml index db7871ba..6870a465 100644 --- a/rosbot_xl_controller/config/diff_drive_controller.yaml +++ b/rosbot_xl_controller/config/diff_drive_controller.yaml @@ -2,8 +2,8 @@ simulation_ignition_ros_control: ros__parameters: use_sim_time: true -# Separate controller manager used for simulation - only difference is -# the use_sim_time parameter (it is the easiest way to do it with ign ros2 control) +# Separate controller manager used for simulation - only difference is +# the use_sim_time parameter (it is the easiest way to do it with ign ros2 control) simulation_controller_manager: ros__parameters: use_sim_time: true diff --git a/rosbot_xl_controller/config/mecanum_drive_controller.yaml b/rosbot_xl_controller/config/mecanum_drive_controller.yaml index 05fb39cf..80def4fd 100644 --- a/rosbot_xl_controller/config/mecanum_drive_controller.yaml +++ b/rosbot_xl_controller/config/mecanum_drive_controller.yaml @@ -2,8 +2,8 @@ simulation_ignition_ros_control: ros__parameters: use_sim_time: true -# Separate controller manager used for simulation - only difference is -# the use_sim_time parameter (it is the easiest way to do it with ign ros2 control) +# Separate controller manager used for simulation - only difference is +# the use_sim_time parameter (it is the easiest way to do it with ign ros2 control) simulation_controller_manager: ros__parameters: use_sim_time: true diff --git a/rosbot_xl_controller/launch/controller.launch.py b/rosbot_xl_controller/launch/controller.launch.py index c77547ce..990e7c20 100644 --- a/rosbot_xl_controller/launch/controller.launch.py +++ b/rosbot_xl_controller/launch/controller.launch.py @@ -36,7 +36,9 @@ def generate_launch_description(): declare_mecanum_arg = DeclareLaunchArgument( "mecanum", default_value="False", - description="Whether to use mecanum drive controller (otherwise diff drive controller is used)", + description=( + "Whether to use mecanum drive controller (otherwise diff drive controller is used)", + ), ) camera_model = LaunchConfiguration("camera_model") @@ -191,12 +193,10 @@ def generate_launch_description(): ) # Delay start of robot_controller after joint_state_broadcaster - delay_robot_controller_spawner_after_joint_state_broadcaster_spawner = ( - RegisterEventHandler( - event_handler=OnProcessExit( - target_action=joint_state_broadcaster_spawner, - on_exit=[robot_controller_spawner], - ) + delay_robot_controller_spawner_after_joint_state_broadcaster_spawner = RegisterEventHandler( + event_handler=OnProcessExit( + target_action=joint_state_broadcaster_spawner, + on_exit=[robot_controller_spawner], ) ) diff --git a/rosbot_xl_controller/package.xml b/rosbot_xl_controller/package.xml index 0a2e4cb1..190d78f2 100644 --- a/rosbot_xl_controller/package.xml +++ b/rosbot_xl_controller/package.xml @@ -2,21 +2,20 @@ rosbot_xl_controller - 0.8.2 + 0.8.8 Hardware configuration for ROSbot XL Apache License 2.0 Maciej Stepien Krzysztof Wojciechowski + Jakub Delicat Husarion https://husarion.com/ https://github.com/husarion/rosbot_xl_ros https://github.com/husarion/rosbot_xl_ros/issues - ament_cmake - rosbot_xl_description launch @@ -33,7 +32,25 @@ rosbot_hardware_interfaces + python3-pytest + launch + launch_ros + launch_pytest + + xacro + sensor_msgs + nav_msgs + + rosbot_xl_description + ros_components_description + + controller_manager + joint_state_broadcaster + imu_sensor_broadcaster + diff_drive_controller + mecanum_drive_controller + - ament_cmake + ament_python diff --git a/rosbot_xl_controller/resource/rosbot_xl_controller b/rosbot_xl_controller/resource/rosbot_xl_controller new file mode 100644 index 00000000..e69de29b diff --git a/rosbot_xl_controller/setup.cfg b/rosbot_xl_controller/setup.cfg new file mode 100644 index 00000000..8878b79a --- /dev/null +++ b/rosbot_xl_controller/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/lib/rosbot_xl_controller +[install] +install_scripts=$base/lib/rosbot_xl_controller diff --git a/rosbot_xl_controller/setup.py b/rosbot_xl_controller/setup.py new file mode 100644 index 00000000..197fbfd3 --- /dev/null +++ b/rosbot_xl_controller/setup.py @@ -0,0 +1,41 @@ +# Copyright 2023 Husarion +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +from glob import glob +from setuptools import find_packages, setup + +package_name = "rosbot_xl_controller" + +setup( + name=package_name, + version="0.8.2", + packages=find_packages(exclude=["test"]), + data_files=[ + ("share/ament_index/resource_index/packages", ["resource/" + package_name]), + ("share/" + package_name, ["package.xml"]), + (os.path.join("share", package_name, "launch"), glob("launch/*.launch.py")), + (os.path.join("share", package_name, "config"), glob("config/*.yaml")), + ], + install_requires=["setuptools"], + zip_safe=True, + maintainer="Husarion", + maintainer_email="contact@husarion.com", + description="Hardware configuration for ROSbot XL", + license="Apache License 2.0", + tests_require=["pytest"], + entry_points={ + "console_scripts": [], + }, +) diff --git a/rosbot_xl_controller/test/test_copyright.py b/rosbot_xl_controller/test/test_copyright.py new file mode 100644 index 00000000..f46f861d --- /dev/null +++ b/rosbot_xl_controller/test/test_copyright.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=[".", "test"]) + assert rc == 0, "Found errors" diff --git a/rosbot_xl_controller/test/test_diff_drive_controllers.py b/rosbot_xl_controller/test/test_diff_drive_controllers.py new file mode 100644 index 00000000..f7d12ecc --- /dev/null +++ b/rosbot_xl_controller/test/test_diff_drive_controllers.py @@ -0,0 +1,101 @@ +# Copyright 2021 Open Source Robotics Foundation, Inc. +# Copyright 2023 Intel Corporation. All Rights Reserved. +# Copyright 2023 Husarion +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import launch_pytest +import pytest +import rclpy + +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription +from launch.substitutions import PathJoinSubstitution +from launch.launch_description_sources import PythonLaunchDescriptionSource +from test_utils import ControllersTestNode + + +@launch_pytest.fixture +def generate_test_description(): + rosbot_xl_controller = get_package_share_directory("rosbot_xl_controller") + bringup_launch = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + PathJoinSubstitution( + [ + rosbot_xl_controller, + "launch", + "controller.launch.py", + ] + ) + ), + launch_arguments={ + "use_sim": "False", + "mecanum": "False", + "use_gpu": "False", + }.items(), + ) + + return LaunchDescription([bringup_launch]) + + +@pytest.mark.launch(fixture=generate_test_description) +def test_controllers_startup_fail(): + rclpy.init() + try: + node = ControllersTestNode("test_controllers_bringup") + node.create_test_subscribers_and_publishers() + + node.start_node_thread() + msgs_received_flag = node.joint_state_msg_event.wait(timeout=10.0) + assert not msgs_received_flag, ( + "Received JointStates message that should not have appeared. Check whether other" + " robots are connected to your network.!" + ) + msgs_received_flag = node.odom_msg_event.wait(timeout=10.0) + assert not msgs_received_flag, ( + "Received Odom message that should not have appeared. Check whether other robots are" + " connected to your network.!" + ) + msgs_received_flag = node.imu_msg_event.wait(timeout=10.0) + assert not msgs_received_flag, ( + "Received Imu message that should not have appeared. Check whether other robots are" + " connected to your network.!" + ) + finally: + rclpy.shutdown() + + +@pytest.mark.launch(fixture=generate_test_description) +def test_controllers_startup_success(): + rclpy.init() + try: + node = ControllersTestNode("test_controllers_bringup") + node.create_test_subscribers_and_publishers() + node.start_publishing_fake_hardware() + + node.start_node_thread() + msgs_received_flag = node.joint_state_msg_event.wait(timeout=10.0) + assert ( + msgs_received_flag + ), "Expected JointStates message but it was not received. Check joint_state_broadcaster!" + msgs_received_flag = node.odom_msg_event.wait(timeout=10.0) + assert ( + msgs_received_flag + ), "Expected Odom message but it was not received. Check rosbot_base_controller!" + msgs_received_flag = node.imu_msg_event.wait(timeout=10.0) + assert ( + msgs_received_flag + ), "Expected Imu message but it was not received. Check imu_broadcaster!" + finally: + rclpy.shutdown() diff --git a/rosbot_xl_controller/test/test_flake8.py b/rosbot_xl_controller/test/test_flake8.py new file mode 100644 index 00000000..49c1644f --- /dev/null +++ b/rosbot_xl_controller/test/test_flake8.py @@ -0,0 +1,23 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, "Found %d code style errors / warnings:\n" % len(errors) + "\n".join(errors) diff --git a/rosbot_xl_controller/test/test_mecanum_controllers.py b/rosbot_xl_controller/test/test_mecanum_controllers.py new file mode 100644 index 00000000..2b8a1567 --- /dev/null +++ b/rosbot_xl_controller/test/test_mecanum_controllers.py @@ -0,0 +1,101 @@ +# Copyright 2021 Open Source Robotics Foundation, Inc. +# Copyright 2023 Intel Corporation. All Rights Reserved. +# Copyright 2023 Husarion +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import launch_pytest +import pytest +import rclpy + +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription +from launch.substitutions import PathJoinSubstitution +from launch.launch_description_sources import PythonLaunchDescriptionSource +from test_utils import ControllersTestNode + + +@launch_pytest.fixture +def generate_test_description(): + rosbot_xl_controller = get_package_share_directory("rosbot_xl_controller") + bringup_launch = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + PathJoinSubstitution( + [ + rosbot_xl_controller, + "launch", + "controller.launch.py", + ] + ) + ), + launch_arguments={ + "use_sim": "False", + "mecanum": "True", + "use_gpu": "False", + }.items(), + ) + + return LaunchDescription([bringup_launch]) + + +@pytest.mark.launch(fixture=generate_test_description) +def test_controllers_startup_fail(): + rclpy.init() + try: + node = ControllersTestNode("test_controllers_bringup") + node.create_test_subscribers_and_publishers() + + node.start_node_thread() + msgs_received_flag = node.joint_state_msg_event.wait(timeout=10.0) + assert not msgs_received_flag, ( + "Received JointStates message that should not have appeared. Check whether other" + " robots are connected to your network.! aaaaaaaaaaaaaaaaaaaaaaaaaaa" + ) + msgs_received_flag = node.odom_msg_event.wait(timeout=10.0) + assert not msgs_received_flag, ( + "Received Odom message that should not have appeared. Check whether other robots are" + " connected to your network.!" + ) + msgs_received_flag = node.imu_msg_event.wait(timeout=10.0) + assert not msgs_received_flag, ( + "Received Imu message that should not have appeared. Check whether other robots are" + " connected to your network.!" + ) + finally: + rclpy.shutdown() + + +@pytest.mark.launch(fixture=generate_test_description) +def test_controllers_startup_success(): + rclpy.init() + try: + node = ControllersTestNode("test_controllers_bringup") + node.create_test_subscribers_and_publishers() + node.start_publishing_fake_hardware() + + node.start_node_thread() + msgs_received_flag = node.joint_state_msg_event.wait(timeout=10.0) + assert ( + msgs_received_flag + ), "Expected JointStates message but it was not received. Check joint_state_broadcaster!" + msgs_received_flag = node.odom_msg_event.wait(timeout=10.0) + assert ( + msgs_received_flag + ), "Expected Odom message but it was not received. Check rosbot_base_controller!" + msgs_received_flag = node.imu_msg_event.wait(timeout=10.0) + assert ( + msgs_received_flag + ), "Expected Imu message but it was not received. Check imu_broadcaster!" + finally: + rclpy.shutdown() diff --git a/rosbot_xl_controller/test/test_pep257.py b/rosbot_xl_controller/test/test_pep257.py new file mode 100644 index 00000000..a2c3deb8 --- /dev/null +++ b/rosbot_xl_controller/test/test_pep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=[".", "test"]) + assert rc == 0, "Found code style errors / warnings" diff --git a/rosbot_xl_controller/test/test_utils.py b/rosbot_xl_controller/test/test_utils.py new file mode 100644 index 00000000..ecf984c8 --- /dev/null +++ b/rosbot_xl_controller/test/test_utils.py @@ -0,0 +1,91 @@ +# Copyright 2021 Open Source Robotics Foundation, Inc. +# Copyright 2023 Husarion +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import rclpy + +from threading import Event +from threading import Thread + +from rclpy.node import Node + +from sensor_msgs.msg import JointState, Imu +from nav_msgs.msg import Odometry + + +class ControllersTestNode(Node): + ROSBOT_HARDWARE_PUBLISHERS_RATE = 10.0 + + __test__ = False + + def __init__(self, name="test_node"): + super().__init__(name) + self.joint_state_msg_event = Event() + self.odom_msg_event = Event() + self.imu_msg_event = Event() + + def create_test_subscribers_and_publishers(self): + self.joint_state_sub = self.create_subscription( + JointState, "/joint_states", self.joint_states_callback, 10 + ) + + self.odom_sub = self.create_subscription( + Odometry, "/rosbot_xl_base_controller/odom", self.odometry_callback, 10 + ) + + self.imu_sub = self.create_subscription(Imu, "/imu_broadcaster/imu", self.imu_callback, 10) + + self.imu_publisher = self.create_publisher(Imu, "_imu/data_raw", 10) + + self.joint_states_publisher = self.create_publisher(JointState, "_motors_response", 10) + + self.timer = None + + def start_node_thread(self): + self.ros_spin_thread = Thread(target=lambda node: rclpy.spin(node), args=(self,)) + self.ros_spin_thread.start() + + def joint_states_callback(self, data): + self.joint_state_msg_event.set() + + def odometry_callback(self, data): + self.odom_msg_event.set() + + def imu_callback(self, data): + self.imu_msg_event.set() + + def start_publishing_fake_hardware(self): + self.timer = self.create_timer( + 1.0 / self.ROSBOT_HARDWARE_PUBLISHERS_RATE, + self.publish_fake_hardware_messages, + ) + + def publish_fake_hardware_messages(self): + imu_msg = Imu() + imu_msg.header.stamp = self.get_clock().now().to_msg() + imu_msg.header.frame_id = "imu_link" + + joint_state_msg = JointState() + joint_state_msg.header.stamp = self.get_clock().now().to_msg() + joint_state_msg.name = [ + "fl_wheel_joint", + "fr_wheel_joint", + "rl_wheel_joint", + "rr_wheel_joint", + ] + joint_state_msg.position = [0.0, 0.0, 0.0, 0.0] + joint_state_msg.velocity = [0.0, 0.0, 0.0, 0.0] + + self.imu_publisher.publish(imu_msg) + self.joint_states_publisher.publish(joint_state_msg) diff --git a/rosbot_xl_controller/test/test_xacro.py b/rosbot_xl_controller/test/test_xacro.py new file mode 100644 index 00000000..84caf38a --- /dev/null +++ b/rosbot_xl_controller/test/test_xacro.py @@ -0,0 +1,66 @@ +# Copyright 2023 Husarion +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import xacro +import itertools +from ament_index_python.packages import get_package_share_directory + + +def test_rosbot_description_parsing(): + mecanum_values = ["true", "false"] + use_sim_values = ["true", "false"] + use_gpu_values = ["true", "false"] + simulation_engine_values = ["ignition-gazebo", "webots"] # 'gazebo-classic' + lidar_model = ["slamtec_rplidar_s1", "slamtec_rplidar_a2", "slamtec_rplidar_a3"] + camera_model = ["intel_realsense_d435"] + + all_combinations = list( + itertools.product( + mecanum_values, + use_sim_values, + use_gpu_values, + simulation_engine_values, + lidar_model, + camera_model, + ) + ) + + for combination in all_combinations: + ( + mecanum, + use_sim, + use_gpu, + simulation_engine, + lidar_model, + camera_model, + ) = combination + mappings = { + "mecanum": mecanum, + "use_sim": use_sim, + "use_gpu": use_gpu, + "simulation_engine": simulation_engine, + "lidar_model": lidar_model, + "camera_model": camera_model, + } + rosbot_xl_description = get_package_share_directory("rosbot_xl_description") + xacro_path = os.path.join(rosbot_xl_description, "urdf/rosbot_xl.urdf.xacro") + try: + xacro.process_file(xacro_path, mappings=mappings) + except xacro.XacroException as e: + assert False, ( + f"xacro parsing failed: {str(e)} for mecanum: {mecanum}, " + f"use_sim: {use_sim}, use_gpu: {use_gpu}, simulation_engine: {simulation_engine}, " + f"lidar_model: {lidar_model}, camera_model{camera_model}" + ) diff --git a/rosbot_xl_description/CHANGELOG.rst b/rosbot_xl_description/CHANGELOG.rst index bb105135..831b8f31 100644 --- a/rosbot_xl_description/CHANGELOG.rst +++ b/rosbot_xl_description/CHANGELOG.rst @@ -2,6 +2,33 @@ Changelog for package rosbot_xl_description ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +0.8.8 (2023-10-25) +------------------ + +0.8.7 (2023-10-24) +------------------ + +0.8.6 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into test-controller +* Contributors: Jakub Delicat + +0.8.5 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into add-pyspelling +* Contributors: Jakub Delicat + +0.8.4 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into add-black +* Contributors: Jakub Delicat + +0.8.3 (2023-10-24) +------------------ +* Merge pull request `#50 `_ from husarion/add-pre-commit + added and applied precommit +* Contributors: Jakub Delicat + 0.8.2 (2023-05-23) ------------------ diff --git a/rosbot_xl_description/CMakeLists.txt b/rosbot_xl_description/CMakeLists.txt index 41f6c3c2..b96e61e5 100644 --- a/rosbot_xl_description/CMakeLists.txt +++ b/rosbot_xl_description/CMakeLists.txt @@ -9,4 +9,4 @@ install(DIRECTORY DESTINATION share/${PROJECT_NAME} ) -ament_package() \ No newline at end of file +ament_package() diff --git a/rosbot_xl_description/meshes/body.dae b/rosbot_xl_description/meshes/body.dae index ed3897a4..71ed7d7f 100644 --- a/rosbot_xl_description/meshes/body.dae +++ b/rosbot_xl_description/meshes/body.dae @@ -269,4 +269,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/meshes/components/antenna.dae b/rosbot_xl_description/meshes/components/antenna.dae index 4fbb7974..dab9742c 100644 --- a/rosbot_xl_description/meshes/components/antenna.dae +++ b/rosbot_xl_description/meshes/components/antenna.dae @@ -218,4 +218,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/meshes/components/antenna_connector.dae b/rosbot_xl_description/meshes/components/antenna_connector.dae index 68dbc8fa..2531e6b2 100644 --- a/rosbot_xl_description/meshes/components/antenna_connector.dae +++ b/rosbot_xl_description/meshes/components/antenna_connector.dae @@ -218,4 +218,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/meshes/components/camera_mount_bot.dae b/rosbot_xl_description/meshes/components/camera_mount_bot.dae index 5e54cfdf..013b82b0 100644 --- a/rosbot_xl_description/meshes/components/camera_mount_bot.dae +++ b/rosbot_xl_description/meshes/components/camera_mount_bot.dae @@ -118,4 +118,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/meshes/components/camera_mount_mid.dae b/rosbot_xl_description/meshes/components/camera_mount_mid.dae index 8f407bdf..5ed0604b 100644 --- a/rosbot_xl_description/meshes/components/camera_mount_mid.dae +++ b/rosbot_xl_description/meshes/components/camera_mount_mid.dae @@ -89,4 +89,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/meshes/components/camera_mount_top.dae b/rosbot_xl_description/meshes/components/camera_mount_top.dae index 417d8cde..44ea191b 100644 --- a/rosbot_xl_description/meshes/components/camera_mount_top.dae +++ b/rosbot_xl_description/meshes/components/camera_mount_top.dae @@ -118,4 +118,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/meshes/mecanum_a.dae b/rosbot_xl_description/meshes/mecanum_a.dae index a56f7826..84779c4e 100644 --- a/rosbot_xl_description/meshes/mecanum_a.dae +++ b/rosbot_xl_description/meshes/mecanum_a.dae @@ -115,4 +115,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/meshes/mecanum_b.dae b/rosbot_xl_description/meshes/mecanum_b.dae index cacc5c39..46f873bd 100644 --- a/rosbot_xl_description/meshes/mecanum_b.dae +++ b/rosbot_xl_description/meshes/mecanum_b.dae @@ -115,4 +115,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/meshes/wheel_a.dae b/rosbot_xl_description/meshes/wheel_a.dae index a2755e41..cb42dab7 100644 --- a/rosbot_xl_description/meshes/wheel_a.dae +++ b/rosbot_xl_description/meshes/wheel_a.dae @@ -115,4 +115,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/meshes/wheel_b.dae b/rosbot_xl_description/meshes/wheel_b.dae index 2375bb3d..62062e36 100644 --- a/rosbot_xl_description/meshes/wheel_b.dae +++ b/rosbot_xl_description/meshes/wheel_b.dae @@ -115,4 +115,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/package.xml b/rosbot_xl_description/package.xml index bcfe42f2..0173afad 100644 --- a/rosbot_xl_description/package.xml +++ b/rosbot_xl_description/package.xml @@ -2,7 +2,7 @@ rosbot_xl_description - 0.8.2 + 0.8.8 The rosbot_xl_description package Apache License 2.0 @@ -20,7 +20,7 @@ xacro xacro - + ros_components_description diff --git a/rosbot_xl_description/urdf/body.urdf.xacro b/rosbot_xl_description/urdf/body.urdf.xacro index 322bd2a9..299cfa99 100644 --- a/rosbot_xl_description/urdf/body.urdf.xacro +++ b/rosbot_xl_description/urdf/body.urdf.xacro @@ -51,4 +51,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/urdf/components/antenna.urdf.xacro b/rosbot_xl_description/urdf/components/antenna.urdf.xacro index 39263a4d..822fedf8 100644 --- a/rosbot_xl_description/urdf/components/antenna.urdf.xacro +++ b/rosbot_xl_description/urdf/components/antenna.urdf.xacro @@ -54,4 +54,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/urdf/components/camera_mount.urdf.xacro b/rosbot_xl_description/urdf/components/camera_mount.urdf.xacro index 4bc5b1e4..f9b872c1 100644 --- a/rosbot_xl_description/urdf/components/camera_mount.urdf.xacro +++ b/rosbot_xl_description/urdf/components/camera_mount.urdf.xacro @@ -92,4 +92,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/urdf/rosbot_xl_macro.urdf.xacro b/rosbot_xl_description/urdf/rosbot_xl_macro.urdf.xacro index 75e3a011..c152b269 100644 --- a/rosbot_xl_description/urdf/rosbot_xl_macro.urdf.xacro +++ b/rosbot_xl_description/urdf/rosbot_xl_macro.urdf.xacro @@ -156,4 +156,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_description/urdf/wheel.urdf.xacro b/rosbot_xl_description/urdf/wheel.urdf.xacro index 49c4e9f9..a4096118 100644 --- a/rosbot_xl_description/urdf/wheel.urdf.xacro +++ b/rosbot_xl_description/urdf/wheel.urdf.xacro @@ -106,4 +106,4 @@ - \ No newline at end of file + diff --git a/rosbot_xl_gazebo/CHANGELOG.rst b/rosbot_xl_gazebo/CHANGELOG.rst index f5491295..d555727f 100644 --- a/rosbot_xl_gazebo/CHANGELOG.rst +++ b/rosbot_xl_gazebo/CHANGELOG.rst @@ -2,6 +2,36 @@ Changelog for package rosbot_xl_gazebo ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +0.8.8 (2023-10-25) +------------------ + +0.8.7 (2023-10-24) +------------------ +* Merge pull request `#51 `_ from husarion/workflow-test + Workflow test +* Contributors: rafal-gorecki + +0.8.6 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into test-controller +* Contributors: Jakub Delicat + +0.8.5 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into add-pyspelling +* Contributors: Jakub Delicat + +0.8.4 (2023-10-24) +------------------ +* Merge remote-tracking branch 'origin/master' into add-black +* Contributors: Jakub Delicat + +0.8.3 (2023-10-24) +------------------ +* Merge pull request `#50 `_ from husarion/add-pre-commit + added and applied precommit +* Contributors: Jakub Delicat + 0.8.2 (2023-05-23) ------------------ diff --git a/rosbot_xl_gazebo/CMakeLists.txt b/rosbot_xl_gazebo/CMakeLists.txt index 04926f32..9243b092 100644 --- a/rosbot_xl_gazebo/CMakeLists.txt +++ b/rosbot_xl_gazebo/CMakeLists.txt @@ -8,4 +8,4 @@ install(DIRECTORY DESTINATION share/${PROJECT_NAME} ) -ament_package() \ No newline at end of file +ament_package() diff --git a/rosbot_xl_gazebo/launch/simulation.launch.py b/rosbot_xl_gazebo/launch/simulation.launch.py index f4eb7f73..04b34c55 100644 --- a/rosbot_xl_gazebo/launch/simulation.launch.py +++ b/rosbot_xl_gazebo/launch/simulation.launch.py @@ -1,4 +1,16 @@ -#!/usr/bin/env python3 +# Copyright 2023 Husarion +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. from launch import LaunchDescription, LaunchContext from launch.actions import ( @@ -8,7 +20,6 @@ ) from launch.substitutions import ( PathJoinSubstitution, - PythonExpression, LaunchConfiguration, ) from launch.launch_description_sources import PythonLaunchDescriptionSource @@ -17,36 +28,51 @@ from ament_index_python.packages import get_package_share_directory + def launch_gz_bridge(context: LaunchContext, *args, **kwargs): - camera_model = context.perform_substitution(LaunchConfiguration('camera_model')) - lidar_model = context.perform_substitution(LaunchConfiguration('lidar_model')) + camera_model = context.perform_substitution(LaunchConfiguration("camera_model")) + lidar_model = context.perform_substitution(LaunchConfiguration("lidar_model")) gz_args = ["/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock"] gz_remapping = [] # Add camera topic if camera_model.startswith("intel_realsense"): - gz_args.append("/camera/color/camera_info@sensor_msgs/msg/CameraInfo[ignition.msgs.CameraInfo") + gz_args.append( + "/camera/color/camera_info@sensor_msgs/msg/CameraInfo[ignition.msgs.CameraInfo" + ) gz_args.append("/camera/color/image_raw@sensor_msgs/msg/Image[ignition.msgs.Image") gz_args.append("/camera/camera_info@sensor_msgs/msg/CameraInfo[ignition.msgs.CameraInfo") gz_args.append("/camera/depth@sensor_msgs/msg/Image[ignition.msgs.Image") - gz_args.append("/camera/depth/points@sensor_msgs/msg/PointCloud2[ignition.msgs.PointCloudPacked") + gz_args.append( + "/camera/depth/points@sensor_msgs/msg/PointCloud2[ignition.msgs.PointCloudPacked" + ) gz_remapping.append(("/camera/camera_info", "/camera/depth/camera_info")) gz_remapping.append(("/camera/depth", "/camera/depth/image_raw")) elif camera_model.startswith("stereolabs_zed"): - zed = camera_model[len("stereolabs_"):] - - gz_args.append(f"/{zed}/zed_node/rgb/camera_info@sensor_msgs/msg/CameraInfo[ignition.msgs.CameraInfo") - gz_args.append(f"/{zed}/zed_node/rgb/image_rect_color@sensor_msgs/msg/Image[ignition.msgs.Image") - gz_args.append(f"/{zed}/zed_node/camera_info@sensor_msgs/msg/CameraInfo[ignition.msgs.CameraInfo") + zed = camera_model[len("stereolabs_") :] + + gz_args.append( + f"/{zed}/zed_node/rgb/camera_info@sensor_msgs/msg/CameraInfo[ignition.msgs.CameraInfo" + ) + gz_args.append( + f"/{zed}/zed_node/rgb/image_rect_color@sensor_msgs/msg/Image[ignition.msgs.Image" + ) + gz_args.append( + f"/{zed}/zed_node/camera_info@sensor_msgs/msg/CameraInfo[ignition.msgs.CameraInfo" + ) gz_args.append(f"/{zed}/zed_node/depth@sensor_msgs/msg/Image[ignition.msgs.Image") - gz_args.append(f"/{zed}/zed_node/depth/points@sensor_msgs/msg/PointCloud2[ignition.msgs.PointCloudPacked") + gz_args.append( + f"/{zed}/zed_node/depth/points@sensor_msgs/msg/PointCloud2[ignition.msgs.PointCloudPacked" + ) gz_remapping.append((f"{zed}/zed_node/camera_info", f"/{zed}/zed_node/depth/camera_info")) gz_remapping.append((f"{zed}/zed_node/depth", f"/{zed}/zed_node/depth/depth_registered")) - gz_remapping.append((f"{zed}/zed_node/depth/points", f"/{zed}/zed_node/point_cloud/cloud_registered")) + gz_remapping.append( + (f"{zed}/zed_node/depth/points", f"/{zed}/zed_node/point_cloud/cloud_registered") + ) else: pass @@ -55,10 +81,12 @@ def launch_gz_bridge(context: LaunchContext, *args, **kwargs): gz_args.append("/scan@sensor_msgs/msg/LaserScan[ignition.msgs.LaserScan") elif lidar_model.startswith("velodyne"): - gz_args.append("/velodyne_points/points@sensor_msgs/msg/PointCloud2[ignition.msgs.PointCloudPacked") + gz_args.append( + "/velodyne_points/points@sensor_msgs/msg/PointCloud2[ignition.msgs.PointCloudPacked" + ) gz_remapping.append(("/velodyne_points/points", "/velodyne_points")) - else: # TODO: Check ouster + else: # FIXME: Checkout ouster pass gz_bridge_node = Node( @@ -72,12 +100,15 @@ def launch_gz_bridge(context: LaunchContext, *args, **kwargs): return [gz_bridge_node] + def generate_launch_description(): mecanum = LaunchConfiguration("mecanum") declare_mecanum_arg = DeclareLaunchArgument( "mecanum", default_value="False", - description="Whether to use mecanum drive controller (otherwise diff drive controller is used)", + description=( + "Whether to use mecanum drive controller (otherwise diff drive controller is used)" + ), ) camera_model = LaunchConfiguration("camera_model") diff --git a/rosbot_xl_gazebo/package.xml b/rosbot_xl_gazebo/package.xml index c7269965..3ee6a3c9 100644 --- a/rosbot_xl_gazebo/package.xml +++ b/rosbot_xl_gazebo/package.xml @@ -2,7 +2,7 @@ rosbot_xl_gazebo - 0.8.2 + 0.8.8 The rosbot_xl_gazebo package Apache License 2.0 @@ -33,4 +33,4 @@ ament_cmake - \ No newline at end of file + diff --git a/wordlist.dic b/wordlist.dic new file mode 100644 index 00000000..a4339c65 Binary files /dev/null and b/wordlist.dic differ