Skip to content

Instantly share code, notes, and snippets.

@RDaneelOlivav
Created July 12, 2021 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RDaneelOlivav/a381f4d29500648b6823e2f02138fd64 to your computer and use it in GitHub Desktop.
Save RDaneelOlivav/a381f4d29500648b6823e2f02138fd64 to your computer and use it in GitHub Desktop.
import os
from ament_index_python import get_package_share_directory
import launch
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
import launch_ros.actions
def generate_launch_description():
map_data_prefix = get_package_share_directory('carla_tc')
# map_provider parameter file definition
ndt_map_provider_file_path = os.path.join(
map_data_prefix,
"param",
"map_publisher.param.yaml")
map_provider_param_file = LaunchConfiguration(
"params", default=[ndt_map_provider_file_path])
# map provide map file arguments
map_yaml_file_path = os.path.join(
map_data_prefix, "data/autonomoustuff_parking_lot_lgsvl.yaml"
)
map_pcd_file_path = os.path.join(
map_data_prefix, "data/autonomoustuff_parking_lot_lgsvl.pcd"
)
map_yaml_file_param = DeclareLaunchArgument(
'map_yaml_file_arg',
default_value=map_yaml_file_path,
description='Map YAML file describing map origin'
)
map_pcd_file_param = DeclareLaunchArgument(
'map_pcd_file_arg',
default_value=map_pcd_file_path,
description='Map PCD file containing 3D point cloud data'
)
# map_provide node execution definition
map_provider_node_runner = launch_ros.actions.Node(
package="ndt_nodes",
executable="ndt_map_publisher_exe",
namespace="localization",
parameters=[map_provider_param_file,
{"map_yaml_file": LaunchConfiguration('map_yaml_file_arg')},
{"map_pcd_file": LaunchConfiguration('map_pcd_file_arg')}])
# map downsampler paramter file definition
ndt_map_downsampler_file_path = os.path.join(
get_package_share_directory('ndt_nodes'),
'param',
'pcl_map_voxel_grid_downsample.param.yaml')
map_downsampler_param_file = launch.substitutions.LaunchConfiguration(
'params', default=[ndt_map_downsampler_file_path])
# map downsample node execution definition
map_downsampler_node_runner = launch_ros.actions.Node(
package='voxel_grid_nodes',
executable='voxel_grid_node_exe',
parameters=[map_downsampler_param_file],
remappings=[
("points_in", "viz_ndt_map"),
("points_downsampled", "viz_ndt_map_downsampled")
])
# require a map file location
return launch.LaunchDescription([
map_yaml_file_param,
map_pcd_file_param,
map_provider_node_runner,
map_downsampler_node_runner])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment