diff --git a/src/dcaiti_control/launch/launch_sim.py b/src/dcaiti_control/launch/launch_sim.py index 30bbc90..670d343 100644 --- a/src/dcaiti_control/launch/launch_sim.py +++ b/src/dcaiti_control/launch/launch_sim.py @@ -25,6 +25,7 @@ def generate_launch_description(): package_name='dcaiti_control' #<--- CHANGE ME use_ros2_control = LaunchConfiguration('use_ros2_control') + world_path='~/.gazebo/models' rsp = IncludeLaunchDescription( PythonLaunchDescriptionSource([os.path.join( @@ -36,7 +37,7 @@ def generate_launch_description(): gazebo = IncludeLaunchDescription( PythonLaunchDescriptionSource([os.path.join( get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')]), - launch_arguments={'params_file': gazebo_params_path}.items() + launch_arguments={'params_file': gazebo_params_path, 'world': world_path }.items() ) # Run the spawner node from the gazebo_ros package. The entity name doesn't really matter if you only have a single robot. diff --git a/src/dcaitirobot/config/slam.yml b/src/dcaitirobot/config/slam.yml new file mode 100644 index 0000000..d17dee9 --- /dev/null +++ b/src/dcaitirobot/config/slam.yml @@ -0,0 +1,3 @@ +slam_toolbox: + ros__parameters: + base_frame: base_link \ No newline at end of file diff --git a/src/dcaitirobot/launch/launch_slam.py b/src/dcaitirobot/launch/launch_slam.py new file mode 100644 index 0000000..daf9f3d --- /dev/null +++ b/src/dcaitirobot/launch/launch_slam.py @@ -0,0 +1,32 @@ +import os +from pathlib import Path + +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch_ros.actions import Node +from ament_index_python import get_package_share_directory + + +def generate_launch_description(): + + slam_params = os.path.join( + get_package_share_directory('dcaitirobot'), # <-- Replace with your package name + 'config', + 'slam.yml' + ) + + print(slam_params) + + slam_toolbox = IncludeLaunchDescription( + PythonLaunchDescriptionSource([os.path.join( + get_package_share_directory('slam_toolbox'),'launch','online_async_launch.py' + )]), + launch_arguments={ + 'use_sim_time': 'false', + 'slam_params_file': slam_params}.items() + ) + + return LaunchDescription([ + slam_toolbox + ]) \ No newline at end of file diff --git a/src/dcaitirobot/setup.py b/src/dcaitirobot/setup.py index 11908f7..c439b80 100644 --- a/src/dcaitirobot/setup.py +++ b/src/dcaitirobot/setup.py @@ -12,7 +12,8 @@ setup( ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), - (os.path.join('share', package_name), glob('launch/*.launch.py')) + (os.path.join('share', package_name), glob('launch/*.py')), + (os.path.join('share', package_name, 'config'), glob('config/*.yml')), ], install_requires=['setuptools'], zip_safe=True,