forked from ros-controls/ros2_control_demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rrbot_system_with_external_sensor.launch.py
executable file
·90 lines (81 loc) · 3.21 KB
/
rrbot_system_with_external_sensor.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright (c) 2021, Stogl Robotics Consulting UG (haftungsbeschränkt)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Authors: Subhas Das, Denis Stogl
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir
def generate_launch_description():
# Declare arguments
declared_arguments = []
declared_arguments.append(
DeclareLaunchArgument(
"prefix",
default_value='""',
description="Prefix of the joint names, useful for multi-robot setup. \
If changed than also joint names in the controllers configuration have to be updated.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"use_fake_hardware",
default_value="false",
description="Start robot with fake hardware mirroring command to its states.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"mock_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.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"slowdown",
default_value="50.0",
description="Slowdown factor of the RRbot.",
)
)
# Initialize Arguments
prefix = LaunchConfiguration("prefix")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
mock_sensor_commands = LaunchConfiguration("mock_sensor_commands")
slowdown = LaunchConfiguration("slowdown")
base_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([ThisLaunchFileDir(), "/rrbot_base.launch.py"]),
launch_arguments={
"controllers_file": "rrbot_with_external_sensor_controllers.yaml",
"description_file": "rrbot_system_with_external_sensor.urdf.xacro",
"prefix": prefix,
"use_fake_hardware": use_fake_hardware,
"mock_sensor_commands": mock_sensor_commands,
"slowdown": slowdown,
}.items(),
)
# add the spawner node for the fts_broadcaster
fts_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["fts_broadcaster", "--controller-manager", "/controller_manager"],
)
# collect all the nodes here
nodes = [
fts_broadcaster_spawner,
]
return LaunchDescription(declared_arguments + [base_launch] + nodes)