-
Notifications
You must be signed in to change notification settings - Fork 0
/
rrbot.launch.py
33 lines (29 loc) · 1.21 KB
/
rrbot.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
import launch
from launch.substitutions import Command, LaunchConfiguration
import launch_ros
import os
import xacro
def generate_launch_description():
pkgPath = launch_ros.substitutions.FindPackageShare(package='example1').find('example1')
urdfModelPath = os.path.join(pkgPath, 'model/robot.xacro')
robot_desc = xacro.process_file(urdfModelPath).toxml()
params = {'robot_description' : robot_desc}
robot_state_publisher_node = launch_ros.actions.Node(
package='robot_state_publisher',
executable='robot_state_publisher',
output = 'screen',
parameters=[params])
rviz_node = launch_ros.actions.Node(
package='rviz2',
executable='rviz2',
name='rviz2',
output='screen'
)
return launch.LaunchDescription([
launch.actions.DeclareLaunchArgument(name='gui', default_value='True',
description='This is a flag for joint_state_publisher_gui'),
launch.actions.DeclareLaunchArgument(name='model',default_value=urdfModelPath,
description='Path to the urdf model file'),
robot_state_publisher_node,
rviz_node
])