Added config to slambox

This commit is contained in:
Tim Korjakow 2023-07-09 16:36:43 +08:00
parent 4d41485c47
commit 481087197f
4 changed files with 39 additions and 2 deletions
src
dcaiti_control/launch
dcaitirobot

@ -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.

@ -0,0 +1,3 @@
slam_toolbox:
ros__parameters:
base_frame: base_link

@ -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
])

@ -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,