-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrvizlaunch.py
32 lines (29 loc) · 935 Bytes
/
rvizlaunch.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
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
import os
def generate_launch_description():
pkg_description = get_package_share_directory('6dof_robot')
urdf_file = os.path.join(pkg_description, "urdf", '6dof_robot.urdf')
joint_state_publisher_node = Node(
package="joint_state_publisher_gui",
executable="joint_state_publisher_gui",
)
robot_state_publisher_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
output="both",
arguments=[urdf_file],
)
rviz_node = Node(
package="rviz2",
executable="rviz2",
name="rviz2",
output="log",
)
nodes_to_run = [
joint_state_publisher_node,
robot_state_publisher_node,
rviz_node
]
return LaunchDescription(nodes_to_run)