-
Notifications
You must be signed in to change notification settings - Fork 6
/
description.launch.py
31 lines (23 loc) · 1.38 KB
/
description.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
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import Command
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.parameter_descriptions import ParameterValue
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
ld = LaunchDescription()
ld.add_action(DeclareLaunchArgument('urdf_package',
description='The package where the robot description is located'))
ld.add_action(DeclareLaunchArgument('urdf_package_path',
description='The path to the robot description relative to the package root'))
package_dir = FindPackageShare(LaunchConfiguration('urdf_package'))
urdf_path = PathJoinSubstitution([package_dir, LaunchConfiguration('urdf_package_path')])
robot_description_content = ParameterValue(Command(['xacro ', urdf_path]), value_type=str)
robot_state_publisher_node = Node(package='robot_state_publisher',
executable='robot_state_publisher',
parameters=[{
'robot_description': robot_description_content,
}])
ld.add_action(robot_state_publisher_node)
return ld