diff --git a/rosbot_xl_bringup/launch/combined.launch.py b/rosbot_xl_bringup/launch/combined.launch.py index f41dbce..ce39e54 100644 --- a/rosbot_xl_bringup/launch/combined.launch.py +++ b/rosbot_xl_bringup/launch/combined.launch.py @@ -23,7 +23,11 @@ SetEnvironmentVariable, ) from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir +from launch.substitutions import ( + LaunchConfiguration, + PathJoinSubstitution, + ThisLaunchFileDir, +) from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare @@ -130,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_controller/test/test_xacro.py b/rosbot_xl_controller/test/test_xacro.py index ec6a8fd..afa9485 100644 --- a/rosbot_xl_controller/test/test_xacro.py +++ b/rosbot_xl_controller/test/test_xacro.py @@ -13,9 +13,9 @@ # limitations under the License. import itertools -import os import xacro +from launch.substitutions import PathJoinSubstitution from launch_ros.substitutions import FindPackageShare @@ -69,8 +69,9 @@ def test_rosbot_description_parsing(): "lidar_model": lidar_model, "camera_model": camera_model, } - rosbot_xl_description = FindPackageShare("rosbot_xl_description") - xacro_path = os.path.join(rosbot_xl_description, "urdf/rosbot_xl.urdf.xacro") + xacro_path = PathJoinSubstitution( + [FindPackageShare("rosbot_xl_description"), "urdf", "rosbot_xl.urdf.xacro"] + ) try: xacro.process_file(xacro_path, mappings=mappings) except xacro.XacroException as e: diff --git a/rosbot_xl_gazebo/package.xml b/rosbot_xl_gazebo/package.xml index 12ca19e..cde7d19 100644 --- a/rosbot_xl_gazebo/package.xml +++ b/rosbot_xl_gazebo/package.xml @@ -22,6 +22,7 @@ ros2launch launch launch_ros + ament_index_python rosbot_xl_bringup husarion_gz_worlds diff --git a/rosbot_xl_utils/rosbot_xl_utils/flash_firmware.py b/rosbot_xl_utils/rosbot_xl_utils/flash_firmware.py index 01bb447..5ce127a 100644 --- a/rosbot_xl_utils/rosbot_xl_utils/flash_firmware.py +++ b/rosbot_xl_utils/rosbot_xl_utils/flash_firmware.py @@ -21,8 +21,8 @@ import subprocess import sys +import ament_index_python.packages import requests -from launch_ros.substitutions import FindPackageShare # Global variable to hold the subprocess reference subproc = None @@ -49,7 +49,9 @@ def download_firmware(firmware_url, firmware_path): def find_firmware_file(): # Find the install directory of 'rosbot_utils' package - package_install_directory = FindPackageShare("rosbot_xl_utils") + package_install_directory = ament_index_python.packages.get_package_share_directory( + "rosbot_xl_utils" + ) # Construct the path to the firmware directory firmware_dir = os.path.join(package_install_directory, "firmware")