-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgz_sensor_demo.launch.py
105 lines (90 loc) · 3.76 KB
/
gz_sensor_demo.launch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright 2024 Open Navigation LLC
#
# 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.
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription
from launch.conditions import IfCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
def generate_launch_description():
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim')
dir = os.getcwd()
world = dir + '/world.sdf'
rviz_config = dir + '/demo.rviz'
# Simulator
gz_sim = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')),
launch_arguments={
'gz_args': '-r ' + world
}.items(),
)
# RViz
rviz = Node(
package='rviz2',
executable='rviz2',
arguments=['-d', rviz_config],
)
# Bridge, but can be put into a yaml file and loaded instead
bridge = Node(
package='ros_gz_bridge',
executable='parameter_bridge',
arguments=['/lidar_planar@sensor_msgs/msg/[email protected]',
'/lidar_planar/points@sensor_msgs/msg/[email protected]',
'/lidar_3d@sensor_msgs/msg/[email protected]',
'/lidar_3d/points@sensor_msgs/msg/[email protected]',
'/depth_camera/image@sensor_msgs/msg/[email protected]',
'/depth_camera/camera_info@sensor_msgs/msg/[email protected]',
'/depth_camera/depth_image@sensor_msgs/msg/[email protected]',
'/depth_camera/points@sensor_msgs/msg/[email protected]'],
output='screen'
)
# Specialized image transport-powered bridge
# There's also a specialized bridge for pointclouds
# image_bridge = Node(
# package='ros_gz_image',
# executable='image_bridge',
# arguments=['camera', 'depth_camera', 'depth_camera/image', 'depth_camera/depth_image'],
# output='screen'
# )
# Minimizing TF, so just setting sensor frames to global frame for visualization
static_transform_one = Node(
package='tf2_ros',
executable='static_transform_publisher',
output='screen',
arguments=['0', '0', '0', '0', '0', '0', 'global_frame', 'invisible_robot/invisible_robot_link/gpu_planar_lidar'],
)
static_transform_two = Node(
package='tf2_ros',
executable='static_transform_publisher',
output='screen',
arguments=['0', '0', '0', '0', '0', '0', 'global_frame', 'invisible_robot/invisible_robot_link/gpu_lidar'],
)
static_transform_three = Node(
package='tf2_ros',
executable='static_transform_publisher',
output='screen',
arguments=['0', '0', '0', '0', '0', '0', 'global_frame', 'invisible_robot/invisible_robot_link/rgbd_camera'],
)
return LaunchDescription([
gz_sim,
bridge,
rviz,
static_transform_one,
static_transform_two,
static_transform_three
])