Skip to content

Commit

Permalink
fix(pointcloud_preprocessor): fix launch error (autowarefoundation#4431)
Browse files Browse the repository at this point in the history
* update launch file

Signed-off-by: ismetatabay <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: ismetatabay <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ismetatabay and pre-commit-ci[bot] authored Aug 1, 2023
1 parent a859597 commit ec9a392
Showing 1 changed file with 33 additions and 32 deletions.
65 changes: 33 additions & 32 deletions sensing/pointcloud_preprocessor/launch/preprocessor.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,25 @@
import launch
from launch.actions import DeclareLaunchArgument
from launch.actions import LogInfo
from launch.actions import OpaqueFunction
from launch.substitutions import LaunchConfiguration
from launch.substitutions import PythonExpression
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode


def generate_launch_description():
def launch_setup(context, *args, **kwargs):
ns = "pointcloud_preprocessor"
pkg = "pointcloud_preprocessor"

# declare launch arguments
input_points_raw_list_param = DeclareLaunchArgument(
"input_points_raw_list",
default_value="['/points_raw']",
description="Input pointcloud topic_name list as a string_array. "
"To subscribe multiple topics, write as: \"['/points_raw0', '/points_raw1', ...]\"",
)

output_points_raw_param = DeclareLaunchArgument(
"output_points_raw", default_value="/points_raw/cropbox/filtered"
)

tf_output_frame_param = DeclareLaunchArgument("tf_output_frame", default_value="base_link")

# set concat filter as a component
separate_concatenate_node_and_timesync_node_str = DeclareLaunchArgument(
"separate_concatenate_node_and_timesync_node",
default_value="false",
description="Set True to separate concatenate node and timesync node. which will cause to larger memory usage.",
)
separate_concatenate_node_and_timesync_node = (
separate_concatenate_node_and_timesync_node_str.lower() == "true"
separate_concatenate_node_and_timesync_node = LaunchConfiguration(
"separate_concatenate_node_and_timesync_node"
).perform(context)
is_separate_concatenate_node_and_timesync_node = (
separate_concatenate_node_and_timesync_node.lower() == "true"
)

if not separate_concatenate_node_and_timesync_node:
if not is_separate_concatenate_node_and_timesync_node:
sync_and_concat_component = ComposableNode(
package=pkg,
plugin="pointcloud_preprocessor::PointCloudConcatenateDataSynchronizerComponent",
Expand Down Expand Up @@ -150,13 +134,30 @@ def generate_launch_description():
]
)
)
return [container, log_info]

return launch.LaunchDescription(
[
input_points_raw_list_param,
output_points_raw_param,
tf_output_frame_param,
container,
log_info,
]

def generate_launch_description():
launch_arguments = []

def add_launch_arg(name: str, default_value=None, description=None):
# a default_value of None is equivalent to not passing that kwarg at all
launch_arguments.append(
DeclareLaunchArgument(name, default_value=default_value, description=description)
)

add_launch_arg(
"input_points_raw_list",
["/points_raw"],
"Input pointcloud topic_name list as a string_array. "
"To subscribe multiple topics, write as: \"['/points_raw0', '/points_raw1', ...]\"",
)
add_launch_arg("output_points_raw", "/points_raw/cropbox/filtered")
add_launch_arg("tf_output_frame", "base_link")
add_launch_arg(
"separate_concatenate_node_and_timesync_node",
"true",
"Set True to separate concatenate node and timesync node. which will cause to larger memory usage.",
)

return launch.LaunchDescription(launch_arguments + [OpaqueFunction(function=launch_setup)])

0 comments on commit ec9a392

Please sign in to comment.