-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrobot_description.launch.py
executable file
·67 lines (57 loc) · 2.57 KB
/
robot_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
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
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, RegisterEventHandler
from launch.event_handlers import OnProcessExit
from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable, TimerAction
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.descriptions import ParameterValue
from launch.substitutions import Command, FindExecutable, PathJoinSubstitution
from launch.substitutions.launch_configuration import LaunchConfiguration
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
ARGUMENTS = [
DeclareLaunchArgument(
'use_sim_time',
default_value='false',
choices=['true', 'false'],
description='use_sim_time'
),
DeclareLaunchArgument(
"use_fake_hardware",
default_value="true",
description="Start robot with fake hardware mirroring command to its states.",
),
DeclareLaunchArgument(
"fake_sensor_commands",
default_value="false",
description="Enable fake command interfaces for sensors used for simple simulations. Used only if 'use_fake_hardware' parameter is true.",
),
]
def generate_launch_description():
is_simulation = LaunchConfiguration("use_sim_time")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
fake_sensor_commands = LaunchConfiguration("fake_sensor_commands")
pkg_robot_description = get_package_share_directory(
'zinger_description')
base_launch = PathJoinSubstitution(
[pkg_robot_description, 'launch', 'base.launch.py'])
controllers_launch = PathJoinSubstitution(
[pkg_robot_description, 'launch', 'controllers.launch.py'])
base_launch_include = IncludeLaunchDescription(
PythonLaunchDescriptionSource([base_launch]),
launch_arguments=[
('use_sim_time', is_simulation),
('use_fake_hardware', use_fake_hardware),
('fake_sensor_commands', fake_sensor_commands)]
)
controllers_launch_include = IncludeLaunchDescription(
PythonLaunchDescriptionSource([controllers_launch]),
launch_arguments=[
('use_sim_time', is_simulation),
('use_fake_hardware', use_fake_hardware),
('fake_sensor_commands', fake_sensor_commands)]
)
ld = LaunchDescription(ARGUMENTS)
ld.add_action(base_launch_include)
ld.add_action(controllers_launch_include)
return ld