diff --git a/.gitignore b/.gitignore index 4d56f66..d2a3410 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ __pycache__/ rosbot_hardware_interfaces/ ros_components_description/ rosbot_controllers/ -husarion/husarion_office_gz +husarion_gz_worlds micro-ROS-Agent/ micro_ros_msgs/ industrial_ci/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 325294f..4097795 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,12 +32,11 @@ repos: files: ^(?!.*compose)(?!.*ekf\.yaml$).*$ args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100'] - # Please keep this version until --experimental-string-processing come back or will be available by default - repo: https://github.com/psf/black - rev: 23.11.0 + rev: 24.4.0 hooks: - id: black - args: [--line-length=99, --experimental-string-processing] + args: [--line-length=99] - repo: https://github.com/PyCQA/flake8 rev: 7.0.0 @@ -46,6 +45,12 @@ repos: 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] + - repo: local hooks: - id: ament_lint_cmake diff --git a/README.md b/README.md index 3a9763b..e9a24ff 100644 --- a/README.md +++ b/README.md @@ -109,4 +109,3 @@ For further usage examples check out our other repositories: * [`rosbot-xl-autonomy`](https://github.com/husarion/rosbot-xl-autonomy) - autonomous navigation & mapping based on Nav2 * [`rosbot-xl-telepresence`](https://github.com/husarion/rosbot-xl-telepresence) - control and receive signals in real time from any device across the Internet using Husarnet VPN * [`rosbot-xl-manipulation`](https://github.com/husarion/rosbot-xl-manipulation) - integration of ROSbot XL with OpenManipulatorX - diff --git a/ROS_API.md b/ROS_API.md index 3e39038..0dc25be 100644 --- a/ROS_API.md +++ b/ROS_API.md @@ -61,7 +61,7 @@ Launch files for Ignition Gazebo working with ROS2 control. | **include_camera_mount** | Whether to include camera mount to the robot URDF | **False** | | **mecanum** | Whether to use mecanum drive controller, otherwise use diff drive | **False** | | **namespace** | Namespace for all topics and tfs | **""** | -| **world** | Path to SDF world file | **`husarion_office_gz/`
`worlds/husarion_world.sdf`** | +| **world** | Path to SDF world file | **`husarion_gz_worlds/`
`worlds/husarion_world.sdf`** | | **headless** | Run Gazebo Ignition in the headless mode | **False** | | **robots** | List of robots that will be spawn in the simulation | **[]**\*\* | diff --git a/rosbot_xl/rosbot_xl_simulation.repos b/rosbot_xl/rosbot_xl_simulation.repos index e4d80df..bded389 100644 --- a/rosbot_xl/rosbot_xl_simulation.repos +++ b/rosbot_xl/rosbot_xl_simulation.repos @@ -1,5 +1,5 @@ repositories: - husarion/husarion_office_gz: + husarion_gz_worlds: type: git - url: https://github.com/husarion/husarion_office_gz + url: https://github.com/husarion/husarion_gz_worlds version: main diff --git a/rosbot_xl_bringup/launch/bringup.launch.py b/rosbot_xl_bringup/launch/bringup.launch.py index b494e31..2fd498a 100644 --- a/rosbot_xl_bringup/launch/bringup.launch.py +++ b/rosbot_xl_bringup/launch/bringup.launch.py @@ -13,13 +13,11 @@ # limitations under the License. from launch import LaunchDescription -from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument -from launch.substitutions import PathJoinSubstitution, LaunchConfiguration +from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource - +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.actions import Node, SetParameter - -from ament_index_python.packages import get_package_share_directory +from launch_ros.substitutions import FindPackageShare def generate_launch_description(): @@ -92,8 +90,8 @@ def generate_launch_description(): description="Which simulation engine will be used", ) - rosbot_xl_controller = get_package_share_directory("rosbot_xl_controller") - rosbot_xl_bringup = get_package_share_directory("rosbot_xl_bringup") + rosbot_xl_controller = FindPackageShare("rosbot_xl_controller") + rosbot_xl_bringup = FindPackageShare("rosbot_xl_bringup") controller_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( diff --git a/rosbot_xl_bringup/launch/combined.launch.py b/rosbot_xl_bringup/launch/combined.launch.py index 45754ff..ce39e54 100644 --- a/rosbot_xl_bringup/launch/combined.launch.py +++ b/rosbot_xl_bringup/launch/combined.launch.py @@ -12,19 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os + from launch import LaunchDescription -from launch_ros.substitutions import FindPackageShare from launch.actions import ( - IncludeLaunchDescription, DeclareLaunchArgument, + IncludeLaunchDescription, LogInfo, - SetEnvironmentVariable, OpaqueFunction, + SetEnvironmentVariable, ) from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import ThisLaunchFileDir, LaunchConfiguration +from launch.substitutions import ( + LaunchConfiguration, + PathJoinSubstitution, + ThisLaunchFileDir, +) from launch_ros.actions import Node -import os +from launch_ros.substitutions import FindPackageShare def generate_microros_agent_node(context, *args, **kwargs): @@ -129,7 +134,9 @@ def generate_launch_description(): package_dir = FindPackageShare("rosbot_xl_bringup").find("rosbot_xl_bringup") # Construct the path to the XML file within the package - fastrtps_profiles_file = os.path.join(package_dir, "config", "microros_localhost_only.xml") + fastrtps_profiles_file = PathJoinSubstitution( + [package_dir, "config", "microros_localhost_only.xml"] + ) declare_localhost_only_fastrtps_profiles_file_arg = DeclareLaunchArgument( "localhost_only_fastrtps_profiles_file", diff --git a/rosbot_xl_bringup/package.xml b/rosbot_xl_bringup/package.xml index 3adbf5d..5cb411a 100644 --- a/rosbot_xl_bringup/package.xml +++ b/rosbot_xl_bringup/package.xml @@ -21,7 +21,6 @@ ros2launch launch launch_ros - ament_index_python rosbot_xl_controller diff --git a/rosbot_xl_bringup/setup.py b/rosbot_xl_bringup/setup.py index 8533fd3..c6b6b6e 100644 --- a/rosbot_xl_bringup/setup.py +++ b/rosbot_xl_bringup/setup.py @@ -14,6 +14,7 @@ import os from glob import glob + from setuptools import find_packages, setup package_name = "rosbot_xl_bringup" diff --git a/rosbot_xl_bringup/test/test_copyright.py b/rosbot_xl_bringup/test/test_copyright.py index f46f861..9167f3d 100644 --- a/rosbot_xl_bringup/test/test_copyright.py +++ b/rosbot_xl_bringup/test/test_copyright.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ament_copyright.main import main import pytest +from ament_copyright.main import main @pytest.mark.copyright diff --git a/rosbot_xl_bringup/test/test_diff_drive_ekf_and_scan.py b/rosbot_xl_bringup/test/test_diff_drive_ekf_and_scan.py index 8507b9f..d2398f0 100644 --- a/rosbot_xl_bringup/test/test_diff_drive_ekf_and_scan.py +++ b/rosbot_xl_bringup/test/test_diff_drive_ekf_and_scan.py @@ -14,22 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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 launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from test_utils import BringupTestNode, ekf_and_scan_test -from threading import Thread @launch_pytest.fixture def generate_test_description(): - rosbot_xl_bringup = get_package_share_directory("rosbot_xl_bringup") + rosbot_xl_bringup = FindPackageShare("rosbot_xl_bringup") bringup_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( diff --git a/rosbot_xl_bringup/test/test_flake8.py b/rosbot_xl_bringup/test/test_flake8.py index 40602d8..db52225 100644 --- a/rosbot_xl_bringup/test/test_flake8.py +++ b/rosbot_xl_bringup/test/test_flake8.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ament_flake8.main import main_with_errors -from os.path import join, dirname +from os.path import dirname, join + import pytest +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/rosbot_xl_bringup/test/test_mecanum_ekf_and_scan.py b/rosbot_xl_bringup/test/test_mecanum_ekf_and_scan.py index 817be79..4d4a440 100644 --- a/rosbot_xl_bringup/test/test_mecanum_ekf_and_scan.py +++ b/rosbot_xl_bringup/test/test_mecanum_ekf_and_scan.py @@ -14,22 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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 launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from test_utils import BringupTestNode, ekf_and_scan_test -from threading import Thread @launch_pytest.fixture def generate_test_description(): - rosbot_xl_bringup = get_package_share_directory("rosbot_xl_bringup") + rosbot_xl_bringup = FindPackageShare("rosbot_xl_bringup") bringup_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( diff --git a/rosbot_xl_bringup/test/test_multirobot_ekf_and_scan.py b/rosbot_xl_bringup/test/test_multirobot_ekf_and_scan.py index 446c569..ae605a4 100644 --- a/rosbot_xl_bringup/test/test_multirobot_ekf_and_scan.py +++ b/rosbot_xl_bringup/test/test_multirobot_ekf_and_scan.py @@ -14,26 +14,25 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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 launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from rclpy.executors import SingleThreadedExecutor from test_utils import BringupTestNode, ekf_and_scan_test -from threading import Thread - robot_names = ["rosbot1", "rosbot2", "rosbot3"] @launch_pytest.fixture def generate_test_description(): - rosbot_xl_bringup = get_package_share_directory("rosbot_xl_bringup") + rosbot_xl_bringup = FindPackageShare("rosbot_xl_bringup") actions = [] for i in range(len(robot_names)): bringup_launch = IncludeLaunchDescription( diff --git a/rosbot_xl_bringup/test/test_namespaced_diff_drive_ekf_and_scan.py b/rosbot_xl_bringup/test/test_namespaced_diff_drive_ekf_and_scan.py index 34f6971..3ed55ba 100644 --- a/rosbot_xl_bringup/test/test_namespaced_diff_drive_ekf_and_scan.py +++ b/rosbot_xl_bringup/test/test_namespaced_diff_drive_ekf_and_scan.py @@ -14,22 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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 launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from test_utils import BringupTestNode, ekf_and_scan_test -from threading import Thread @launch_pytest.fixture def generate_test_description(): - rosbot_xl_bringup = get_package_share_directory("rosbot_xl_bringup") + rosbot_xl_bringup = FindPackageShare("rosbot_xl_bringup") bringup_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( diff --git a/rosbot_xl_bringup/test/test_namespaced_mecanum_ekf_and_scan.py b/rosbot_xl_bringup/test/test_namespaced_mecanum_ekf_and_scan.py index 4b4b17e..06d6054 100644 --- a/rosbot_xl_bringup/test/test_namespaced_mecanum_ekf_and_scan.py +++ b/rosbot_xl_bringup/test/test_namespaced_mecanum_ekf_and_scan.py @@ -14,22 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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 launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from test_utils import BringupTestNode, ekf_and_scan_test -from threading import Thread @launch_pytest.fixture def generate_test_description(): - rosbot_xl_bringup = get_package_share_directory("rosbot_xl_bringup") + rosbot_xl_bringup = FindPackageShare("rosbot_xl_bringup") bringup_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( diff --git a/rosbot_xl_bringup/test/test_pep257.py b/rosbot_xl_bringup/test/test_pep257.py index a2c3deb..4eddb46 100644 --- a/rosbot_xl_bringup/test/test_pep257.py +++ b/rosbot_xl_bringup/test/test_pep257.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ament_pep257.main import main import pytest +from ament_pep257.main import main @pytest.mark.linter diff --git a/rosbot_xl_bringup/test/test_utils.py b/rosbot_xl_bringup/test/test_utils.py index 527b725..0211a0d 100644 --- a/rosbot_xl_bringup/test/test_utils.py +++ b/rosbot_xl_bringup/test/test_utils.py @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import rclpy import math import random - from threading import Event + +import rclpy from rclpy.node import Node -from sensor_msgs.msg import JointState, Imu, LaserScan +from sensor_msgs.msg import Imu, JointState, LaserScan from tf2_ros import TransformException from tf2_ros.buffer import Buffer from tf2_ros.transform_listener import TransformListener diff --git a/rosbot_xl_controller/launch/controller.launch.py b/rosbot_xl_controller/launch/controller.launch.py index 8cd1510..afc3256 100644 --- a/rosbot_xl_controller/launch/controller.launch.py +++ b/rosbot_xl_controller/launch/controller.launch.py @@ -15,22 +15,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -from launch.event_handlers import OnProcessExit from launch import LaunchDescription -from launch.actions import ( - DeclareLaunchArgument, - RegisterEventHandler, - OpaqueFunction, -) +from launch.actions import DeclareLaunchArgument, OpaqueFunction, RegisterEventHandler from launch.conditions import UnlessCondition +from launch.event_handlers import OnProcessExit from launch.substitutions import ( Command, - PythonExpression, FindExecutable, - PathJoinSubstitution, LaunchConfiguration, + PathJoinSubstitution, + PythonExpression, ) - from launch_ros.actions import Node, SetParameter from launch_ros.substitutions import FindPackageShare diff --git a/rosbot_xl_controller/package.xml b/rosbot_xl_controller/package.xml index c3b3b7c..fee112c 100644 --- a/rosbot_xl_controller/package.xml +++ b/rosbot_xl_controller/package.xml @@ -22,7 +22,6 @@ ros2launch launch launch_ros - ament_index_python rosbot_xl_description ros_components_description diff --git a/rosbot_xl_controller/setup.py b/rosbot_xl_controller/setup.py index 1bb857b..d4d5c9c 100644 --- a/rosbot_xl_controller/setup.py +++ b/rosbot_xl_controller/setup.py @@ -14,6 +14,7 @@ import os from glob import glob + from setuptools import find_packages, setup package_name = "rosbot_xl_controller" diff --git a/rosbot_xl_controller/test/test_copyright.py b/rosbot_xl_controller/test/test_copyright.py index f46f861..9167f3d 100644 --- a/rosbot_xl_controller/test/test_copyright.py +++ b/rosbot_xl_controller/test/test_copyright.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ament_copyright.main import main import pytest +from ament_copyright.main import main @pytest.mark.copyright diff --git a/rosbot_xl_controller/test/test_diff_drive_controllers.py b/rosbot_xl_controller/test/test_diff_drive_controllers.py index c7d1ee8..90b7dc4 100644 --- a/rosbot_xl_controller/test/test_diff_drive_controllers.py +++ b/rosbot_xl_controller/test/test_diff_drive_controllers.py @@ -14,22 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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 launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from test_utils import ControllersTestNode, controller_test -from threading import Thread @launch_pytest.fixture def generate_test_description(): - rosbot_xl_controller = get_package_share_directory("rosbot_xl_controller") + rosbot_xl_controller = FindPackageShare("rosbot_xl_controller") bringup_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( diff --git a/rosbot_xl_controller/test/test_flake8.py b/rosbot_xl_controller/test/test_flake8.py index 40602d8..db52225 100644 --- a/rosbot_xl_controller/test/test_flake8.py +++ b/rosbot_xl_controller/test/test_flake8.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ament_flake8.main import main_with_errors -from os.path import join, dirname +from os.path import dirname, join + import pytest +from ament_flake8.main import main_with_errors @pytest.mark.flake8 diff --git a/rosbot_xl_controller/test/test_mecanum_controllers.py b/rosbot_xl_controller/test/test_mecanum_controllers.py index 12530da..7e0288b 100644 --- a/rosbot_xl_controller/test/test_mecanum_controllers.py +++ b/rosbot_xl_controller/test/test_mecanum_controllers.py @@ -14,23 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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 launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from test_utils import ControllersTestNode, controller_test -from threading import Thread @launch_pytest.fixture def generate_test_description(): - rosbot_xl_controller = get_package_share_directory("rosbot_xl_controller") + rosbot_xl_controller = FindPackageShare("rosbot_xl_controller") bringup_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( diff --git a/rosbot_xl_controller/test/test_multirobot_controllers.py b/rosbot_xl_controller/test/test_multirobot_controllers.py index 6c699f8..83b4c23 100644 --- a/rosbot_xl_controller/test/test_multirobot_controllers.py +++ b/rosbot_xl_controller/test/test_multirobot_controllers.py @@ -14,25 +14,24 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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, TimerAction -from launch.substitutions import PathJoinSubstitution from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from test_utils import ControllersTestNode, controller_test -from threading import Thread robot_names = ["rosbot_xl1", "rosbot_xl2", "rosbot_xl3"] @launch_pytest.fixture def generate_test_description(): - rosbot_controller = get_package_share_directory("rosbot_xl_controller") + rosbot_controller = FindPackageShare("rosbot_xl_controller") actions = [] for i in range(len(robot_names)): controller_launch = IncludeLaunchDescription( diff --git a/rosbot_xl_controller/test/test_namespaced_diff_drive_controllers.py b/rosbot_xl_controller/test/test_namespaced_diff_drive_controllers.py index a9b6b05..1ac0b7e 100644 --- a/rosbot_xl_controller/test/test_namespaced_diff_drive_controllers.py +++ b/rosbot_xl_controller/test/test_namespaced_diff_drive_controllers.py @@ -14,23 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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 launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from test_utils import ControllersTestNode, controller_test -from threading import Thread @launch_pytest.fixture def generate_test_description(): - rosbot_xl_controller = get_package_share_directory("rosbot_xl_controller") + rosbot_xl_controller = FindPackageShare("rosbot_xl_controller") bringup_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( diff --git a/rosbot_xl_controller/test/test_namespaced_mecanum_controllers.py b/rosbot_xl_controller/test/test_namespaced_mecanum_controllers.py index b3a2bee..2c51fcb 100644 --- a/rosbot_xl_controller/test/test_namespaced_mecanum_controllers.py +++ b/rosbot_xl_controller/test/test_namespaced_mecanum_controllers.py @@ -14,23 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +from threading import Thread + 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 launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare from test_utils import ControllersTestNode, controller_test -from threading import Thread @launch_pytest.fixture def generate_test_description(): - rosbot_xl_controller = get_package_share_directory("rosbot_xl_controller") + rosbot_xl_controller = FindPackageShare("rosbot_xl_controller") bringup_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( diff --git a/rosbot_xl_controller/test/test_pep257.py b/rosbot_xl_controller/test/test_pep257.py index a2c3deb..4eddb46 100644 --- a/rosbot_xl_controller/test/test_pep257.py +++ b/rosbot_xl_controller/test/test_pep257.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ament_pep257.main import main import pytest +from ament_pep257.main import main @pytest.mark.linter diff --git a/rosbot_xl_controller/test/test_utils.py b/rosbot_xl_controller/test/test_utils.py index a6a386c..bfd6b46 100644 --- a/rosbot_xl_controller/test/test_utils.py +++ b/rosbot_xl_controller/test/test_utils.py @@ -15,9 +15,10 @@ from threading import Event -from rclpy.node import Node -from sensor_msgs.msg import JointState, Imu + from nav_msgs.msg import Odometry +from rclpy.node import Node +from sensor_msgs.msg import Imu, JointState class ControllersTestNode(Node): diff --git a/rosbot_xl_controller/test/test_xacro.py b/rosbot_xl_controller/test/test_xacro.py index 0ef5dfa..465265c 100644 --- a/rosbot_xl_controller/test/test_xacro.py +++ b/rosbot_xl_controller/test/test_xacro.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +import itertools import os + import xacro -import itertools from ament_index_python.packages import get_package_share_directory diff --git a/rosbot_xl_gazebo/launch/simulation.launch.py b/rosbot_xl_gazebo/launch/simulation.launch.py index 2d5bbf6..7cc0ac6 100644 --- a/rosbot_xl_gazebo/launch/simulation.launch.py +++ b/rosbot_xl_gazebo/launch/simulation.launch.py @@ -14,24 +14,21 @@ from launch import LaunchDescription from launch.actions import ( - IncludeLaunchDescription, DeclareLaunchArgument, - OpaqueFunction, - LogInfo, GroupAction, + IncludeLaunchDescription, + LogInfo, + OpaqueFunction, ) +from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import ( EnvironmentVariable, - PathJoinSubstitution, LaunchConfiguration, + PathJoinSubstitution, TextSubstitution, ) -from launch.launch_description_sources import PythonLaunchDescriptionSource - from launch_ros.actions import SetParameter - -from ament_index_python.packages import get_package_share_directory - +from launch_ros.substitutions import FindPackageShare from nav2_common.launch import ParseMultiRobotPose @@ -55,7 +52,7 @@ def launch_setup(context, *args, **kwargs): PythonLaunchDescriptionSource( PathJoinSubstitution( [ - get_package_share_directory("ros_gz_sim"), + FindPackageShare("ros_gz_sim"), "launch", "gz_sim.launch.py", ] @@ -93,7 +90,7 @@ def launch_setup(context, *args, **kwargs): PythonLaunchDescriptionSource( PathJoinSubstitution( [ - get_package_share_directory("rosbot_xl_gazebo"), + FindPackageShare("rosbot_xl_gazebo"), "launch", "spawn.launch.py", ] @@ -177,7 +174,7 @@ def generate_launch_description(): description="Whether to include camera mount to the robot URDF", ) - world_package = get_package_share_directory("husarion_office_gz") + world_package = FindPackageShare("husarion_gz_worlds") world_file = PathJoinSubstitution([world_package, "worlds", "husarion_world.sdf"]) declare_world_arg = DeclareLaunchArgument( "world", default_value=world_file, description="Path to SDF world file" diff --git a/rosbot_xl_gazebo/launch/spawn.launch.py b/rosbot_xl_gazebo/launch/spawn.launch.py index e235a61..e80ceb7 100644 --- a/rosbot_xl_gazebo/launch/spawn.launch.py +++ b/rosbot_xl_gazebo/launch/spawn.launch.py @@ -12,23 +12,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -from launch import LaunchDescription, LaunchContext +from launch import LaunchContext, LaunchDescription from launch.actions import ( - IncludeLaunchDescription, DeclareLaunchArgument, + IncludeLaunchDescription, OpaqueFunction, ) +from launch.conditions import LaunchConfigurationNotEquals +from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import ( - PathJoinSubstitution, LaunchConfiguration, + PathJoinSubstitution, PythonExpression, ) -from launch.conditions import LaunchConfigurationNotEquals -from launch.launch_description_sources import PythonLaunchDescriptionSource -from nav2_common.launch import ReplaceString from launch_ros.actions import Node, SetParameter - -from ament_index_python.packages import get_package_share_directory +from launch_ros.substitutions import FindPackageShare +from nav2_common.launch import ReplaceString def launch_gz_bridge(context: LaunchContext, *args, **kwargs): @@ -59,7 +58,7 @@ def launch_gz_bridge(context: LaunchContext, *args, **kwargs): if lidar_model != "None": gz_lidar_remappings_file = PathJoinSubstitution( [ - get_package_share_directory("rosbot_xl_gazebo"), + FindPackageShare("rosbot_xl_gazebo"), "config", LaunchConfiguration( "gz_lidar_remappings_file", @@ -100,7 +99,7 @@ def launch_gz_bridge(context: LaunchContext, *args, **kwargs): gz_camera_remappings_file = PathJoinSubstitution( [ - get_package_share_directory("rosbot_xl_gazebo"), + FindPackageShare("rosbot_xl_gazebo"), "config", LaunchConfiguration( "gz_camera_remappings_file", @@ -269,7 +268,7 @@ def generate_launch_description(): PythonLaunchDescriptionSource( PathJoinSubstitution( [ - get_package_share_directory("rosbot_xl_bringup"), + FindPackageShare("rosbot_xl_bringup"), "launch", "bringup.launch.py", ] diff --git a/rosbot_xl_gazebo/package.xml b/rosbot_xl_gazebo/package.xml index 6eb3d7c..cde7d19 100644 --- a/rosbot_xl_gazebo/package.xml +++ b/rosbot_xl_gazebo/package.xml @@ -25,7 +25,7 @@ ament_index_python rosbot_xl_bringup - husarion_office_gz + husarion_gz_worlds ros_gz_sim