Skip to content

Commit 3c50e5d

Browse files
Move extras launch into a new service (#185)
* Create a new platform-extras.service, move platform.extras.launch there instead of including it as part of the sensors launch * Add empty-by-default platform extras launch file
1 parent a1b58f5 commit 3c50e5d

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Software License Agreement (BSD)
2+
#
3+
# @author Tony Baltovski <[email protected]>
4+
# @author Roni Kreinin <[email protected]>
5+
# @copyright (c) 2023, Clearpath Robotics, Inc., All rights reserved.
6+
#
7+
# Redistribution and use in source and binary forms, with or without
8+
# modification, are permitted provided that the following conditions are met:
9+
# * Redistributions of source code must retain the above copyright notice,
10+
# this list of conditions and the following disclaimer.
11+
# * Redistributions in binary form must reproduce the above copyright notice,
12+
# this list of conditions and the following disclaimer in the documentation
13+
# and/or other materials provided with the distribution.
14+
# * Neither the name of Clearpath Robotics nor the names of its contributors
15+
# may be used to endorse or promote products derived from this software
16+
# without specific prior written permission.
17+
#
18+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28+
# POSSIBILITY OF SUCH DAMAGE.
29+
from launch import LaunchDescription
30+
from launch.actions import (
31+
DeclareLaunchArgument,
32+
)
33+
34+
ARGUMENTS = [
35+
DeclareLaunchArgument(
36+
'setup_path',
37+
default_value='/etc/clearpath/'
38+
),
39+
40+
DeclareLaunchArgument(
41+
'use_sim_time',
42+
choices=['true', 'false'],
43+
default_value='false',
44+
description='Use simulation time'
45+
),
46+
47+
DeclareLaunchArgument(
48+
'namespace',
49+
default_value='',
50+
description='Robot namespace'
51+
),
52+
]
53+
54+
def generate_launch_description():
55+
ld = LaunchDescription(ARGUMENTS)
56+
return ld

clearpath_generator_common/clearpath_generator_common/common.py

+3
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ def full_path(self):
276276
class BaseGenerator():
277277
SENSORS_PATH = 'sensors/'
278278
PLATFORM_PATH = 'platform/'
279+
PLATFORM_EXTRAS_PATH = 'platform-extras/'
279280
MANIPULATORS_PATH = 'manipulators/'
280281
LAUNCH_PATH = 'launch/'
281282
PARAM_PATH = 'config/'
@@ -295,6 +296,8 @@ def __init__(self,
295296
self.setup_path, self.PLATFORM_PATH, self.PARAM_PATH)
296297
self.platform_launch_path = os.path.join(
297298
self.setup_path, self.PLATFORM_PATH, self.LAUNCH_PATH)
299+
self.platform_extras_launch_path = os.path.join(
300+
self.setup_path, self.PLATFORM_EXTRAS_PATH, self.LAUNCH_PATH)
298301
self.manipulators_params_path = os.path.join(
299302
self.setup_path, self.MANIPULATORS_PATH, self.PARAM_PATH)
300303
self.manipulators_launch_path = os.path.join(

clearpath_generator_common/clearpath_generator_common/launch/generator.py

+19
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ def __init__(self,
5454
except FileNotFoundError:
5555
pass
5656

57+
try:
58+
shutil.rmtree(self.platform_extras_launch_path)
59+
except FileNotFoundError:
60+
pass
61+
5762
try:
5863
shutil.rmtree(self.manipulators_launch_path)
5964
except FileNotFoundError:
@@ -62,6 +67,7 @@ def __init__(self,
6267
# Make new directories
6368
os.makedirs(os.path.dirname(self.sensors_launch_path), exist_ok=True)
6469
os.makedirs(os.path.dirname(self.platform_launch_path), exist_ok=True)
70+
os.makedirs(os.path.dirname(self.platform_extras_launch_path), exist_ok=True)
6571
os.makedirs(os.path.dirname(self.manipulators_launch_path), exist_ok=True)
6672

6773
self.platform_launch_file = LaunchFile(
@@ -74,6 +80,15 @@ def __init__(self,
7480
('enable_ekf', str(self.clearpath_config.platform.enable_ekf).lower()),
7581
])
7682

83+
self.platform_extras_launch_file = LaunchFile(
84+
name='platform_extras',
85+
package=self.pkg_clearpath_common,
86+
args=[
87+
('setup_path', self.setup_path),
88+
('use_sim_time', 'false'),
89+
('namespace', self.namespace),
90+
])
91+
7792
self.manipulators_launch_file = LaunchFile(
7893
name='manipulators',
7994
package=self.pkg_clearpath_manipulators,
@@ -92,6 +107,10 @@ def __init__(self,
92107
name='platform-service',
93108
path=self.platform_launch_path)
94109

110+
self.platform_extras_service_launch_file = LaunchFile(
111+
name='platform-extras-service',
112+
path=self.platform_extras_launch_path)
113+
95114
self.manipulators_service_launch_file = LaunchFile(
96115
name='manipulators-service',
97116
path=self.manipulators_launch_path

0 commit comments

Comments
 (0)