-
Notifications
You must be signed in to change notification settings - Fork 2
/
rviz.launch.py
executable file
·51 lines (43 loc) · 1.54 KB
/
rviz.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
from launch import LaunchDescription
from launch_ros.actions import Node, PushRosNamespace
from launch.actions import DeclareLaunchArgument, OpaqueFunction
from launch.substitutions import EnvironmentVariable, LaunchConfiguration
def launch_setup(context, *args, **kwargs):
robot_namespace = LaunchConfiguration("robot_namespace").perform(context)
tf_remap = []
if robot_namespace:
tf_remap.append(("/tf", f"/{robot_namespace}/tf"))
tf_remap.append(("/tf_static", f"/{robot_namespace}/tf_static"))
rviz = Node(
package="rviz2",
executable="rviz2",
name="rviz2",
arguments=["-d", "/default.rviz"],
remappings=tf_remap,
output="screen",
)
decoder = Node(
package="image_transport",
executable="republish",
name="republish",
arguments=[
"ffmpeg",
"in/ffmpeg:=camera/color/image_raw/ffmpeg",
"raw",
"out:=camera/color/image_uncompressed",
],
remappings=tf_remap,
output="screen",
)
return [PushRosNamespace(robot_namespace), rviz, decoder]
def generate_launch_description():
return LaunchDescription(
[
DeclareLaunchArgument(
"robot_namespace",
default_value=EnvironmentVariable("ROBOT_NAMESPACE", default_value=""),
description="Namespace which will appear in front of all topics (including /tf and /tf_static).",
),
OpaqueFunction(function=launch_setup),
]
)