1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- import os
16-
17- from ament_index_python .packages import get_package_share_directory
1815import launch
1916from launch .actions import DeclareLaunchArgument
2017from launch .actions import LogInfo
2118from launch .actions import OpaqueFunction
2219from launch .substitutions import LaunchConfiguration
20+ from launch .substitutions import PathJoinSubstitution
2321from launch .substitutions import PythonExpression
2422from launch_ros .actions import ComposableNodeContainer
2523from launch_ros .descriptions import ComposableNode
2624from launch_ros .parameter_descriptions import ParameterFile
25+ from launch_ros .substitutions import FindPackageShare
2726
2827
2928def launch_setup (context , * args , ** kwargs ):
@@ -165,9 +164,6 @@ def launch_setup(context, *args, **kwargs):
165164
166165def generate_launch_description ():
167166 launch_arguments = []
168- autoware_pointcloud_preprocessor_share_dir = get_package_share_directory (
169- "autoware_pointcloud_preprocessor"
170- )
171167
172168 def add_launch_arg (name : str , default_value = None , description = None ):
173169 # a default_value of None is equivalent to not passing that kwarg at all
@@ -185,37 +181,45 @@ def add_launch_arg(name: str, default_value=None, description=None):
185181 add_launch_arg ("tf_output_frame" , "base_link" )
186182 add_launch_arg (
187183 "concatenate_and_time_sync_node_param_path" ,
188- os .path .join (
189- autoware_pointcloud_preprocessor_share_dir ,
190- "config" ,
191- "concatenate_and_time_sync_node.param.yaml" ,
184+ PathJoinSubstitution (
185+ [
186+ FindPackageShare ("autoware_pointcloud_preprocessor" ),
187+ "config" ,
188+ "concatenate_and_time_sync_node.param.yaml" ,
189+ ]
192190 ),
193191 description = "path to parameter file of concatenate and time sync node" ,
194192 )
195193 add_launch_arg (
196194 "concatenate_pointclouds_node_param_path" ,
197- os .path .join (
198- autoware_pointcloud_preprocessor_share_dir ,
199- "config" ,
200- "concatenate_pointclouds.param.yaml" ,
195+ PathJoinSubstitution (
196+ [
197+ FindPackageShare ("autoware_pointcloud_preprocessor" ),
198+ "config" ,
199+ "concatenate_pointclouds.param.yaml" ,
200+ ]
201201 ),
202202 description = "path to parameter file of concatenate pointclouds node" ,
203203 )
204204 add_launch_arg (
205205 "time_synchronizer_node_param_path" ,
206- os .path .join (
207- autoware_pointcloud_preprocessor_share_dir ,
208- "config" ,
209- "time_synchronizer_node.param.yaml" ,
206+ PathJoinSubstitution (
207+ [
208+ FindPackageShare ("autoware_pointcloud_preprocessor" ),
209+ "config" ,
210+ "time_synchronizer_node.param.yaml" ,
211+ ]
210212 ),
211213 description = "path to parameter file of time synchronizer node" ,
212214 )
213215 add_launch_arg (
214216 "crop_box_filter_node_param_path" ,
215- os .path .join (
216- autoware_pointcloud_preprocessor_share_dir ,
217- "config" ,
218- "crop_box_filter_node.param.yaml" ,
217+ PathJoinSubstitution (
218+ [
219+ FindPackageShare ("autoware_pointcloud_preprocessor" ),
220+ "config" ,
221+ "crop_box_filter_node.param.yaml" ,
222+ ]
219223 ),
220224 description = "path to parameter file of crop box filter node" ,
221225 )
0 commit comments