|
| 1 | +# Copyright 2019 Open Source Robotics Foundation, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +import os |
| 16 | + |
| 17 | +from ament_index_python.packages import get_package_share_directory |
| 18 | + |
| 19 | +from launch import LaunchDescription |
| 20 | +from launch.actions import DeclareLaunchArgument |
| 21 | +from launch.actions import IncludeLaunchDescription |
| 22 | +from launch.conditions import IfCondition |
| 23 | +from launch.launch_description_sources import PythonLaunchDescriptionSource |
| 24 | +from launch.substitutions import LaunchConfiguration |
| 25 | + |
| 26 | +from launch_ros.actions import Node |
| 27 | + |
| 28 | + |
| 29 | +def generate_launch_description(): |
| 30 | + |
| 31 | + pkg_ros_ign_gazebo = get_package_share_directory('ros_ign_gazebo') |
| 32 | + |
| 33 | + ign_gazebo = IncludeLaunchDescription( |
| 34 | + PythonLaunchDescriptionSource( |
| 35 | + os.path.join(pkg_ros_ign_gazebo, 'launch', 'ign_gazebo.launch.py')), |
| 36 | + launch_arguments={ |
| 37 | + 'ign_args': '-v 4 -r spherical_coordinates.sdf' |
| 38 | + }.items(), |
| 39 | + ) |
| 40 | + |
| 41 | + # RQt |
| 42 | + rqt = Node( |
| 43 | + package='rqt_topic', |
| 44 | + executable='rqt_topic', |
| 45 | + arguments=['-t'], |
| 46 | + condition=IfCondition(LaunchConfiguration('rqt')) |
| 47 | + ) |
| 48 | + |
| 49 | + # Bridge |
| 50 | + bridge = Node( |
| 51 | + package='ros_ign_bridge', |
| 52 | + executable='parameter_bridge', |
| 53 | + arguments=['/navsat@sensor_msgs/msg/NavSatFix@ignition.msgs.NavSat'], |
| 54 | + output='screen' |
| 55 | + ) |
| 56 | + |
| 57 | + return LaunchDescription([ |
| 58 | + ign_gazebo, |
| 59 | + DeclareLaunchArgument('rqt', default_value='true', |
| 60 | + description='Open RQt.'), |
| 61 | + bridge, |
| 62 | + rqt |
| 63 | + ]) |
0 commit comments