Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- #
- # Copyright 2019 ROBOTIS CO., LTD.
- #
- # 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.
- #
- # Authors: Ryan Shim
- import os
- from ament_index_python.packages import get_package_share_directory
- from launch import LaunchDescription
- from launch_ros.actions import Node
- from launch.actions import IncludeLaunchDescription
- from launch.launch_description_sources import PythonLaunchDescriptionSource
- from launch.substitutions import LaunchConfiguration
- TURTLEBOT3_MODEL = os.environ['TURTLEBOT3_MODEL']
- def generate_launch_description():
- use_sim_time = LaunchConfiguration('use_sim_time', default='true')
- world_file_name = 'turtlebot3_dqn_stage1/' + TURTLEBOT3_MODEL + '.model'
- world = os.path.join(get_package_share_directory('turtlebot3_gazebo'),
- 'worlds', world_file_name)
- launch_file_dir = os.path.join(get_package_share_directory('turtlebot3_gazebo'), 'launch')
- pkg_gazebo_ros = get_package_share_directory('gazebo_ros')
- rviz_config_dir = os.path.join(get_package_share_directory('mbanov_1_1'), 'rviz', 'rviz.rviz')
- return LaunchDescription([
- Node(
- name='position_listener',
- package='mbanov_1_1',
- executable='position_listener',
- namespace='',
- output='screen',
- ),
- IncludeLaunchDescription(
- PythonLaunchDescriptionSource(
- os.path.join(pkg_gazebo_ros, 'launch', 'gzserver.launch.py')
- ),
- launch_arguments={'world': world}.items(),
- ),
- Node(
- name='rviz2',
- package='rviz2',
- executable='rviz2',
- output = 'screen',
- arguments=['-d', rviz_config_dir],
- parameters=[{'use_sim_time': False}]
- ),
- IncludeLaunchDescription(
- PythonLaunchDescriptionSource([launch_file_dir, '/robot_state_publisher.launch.py']),
- launch_arguments={'use_sim_time': use_sim_time}.items(),
- ),
- ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement