Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve converter launch file for better configuration #51

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 46 additions & 11 deletions etsi_its_conversion/etsi_its_conversion/launch/converter.launch.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,60 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import os

from ament_index_python import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node, SetParameter


def generate_launch_description():

config = os.path.join(
get_package_share_directory("etsi_its_conversion"),
"config",
"params.yml"
)
remappable_topics = [
DeclareLaunchArgument("input_topic_udp", default_value="~/udp/in"),
DeclareLaunchArgument("output_topic_udp", default_value="~/udp/out"),
DeclareLaunchArgument("input_topic_cam", default_value="~/cam/in"),
DeclareLaunchArgument("output_topic_cam", default_value="~/cam/out"),
DeclareLaunchArgument("input_topic_cam_ts", default_value="~/cam_ts/in"),
DeclareLaunchArgument("output_topic_cam_ts", default_value="~/cam_ts/out"),
DeclareLaunchArgument("input_topic_cpm_ts", default_value="~/cpm_ts/in"),
DeclareLaunchArgument("output_topic_cpm_ts", default_value="~/cpm_ts/out"),
DeclareLaunchArgument("input_topic_denm", default_value="~/denm/in"),
DeclareLaunchArgument("output_topic_denm", default_value="~/denm/out"),
DeclareLaunchArgument("input_topic_mapem_ts", default_value="~/mapem_ts/in"),
DeclareLaunchArgument("output_topic_mapem_ts", default_value="~/mapem_ts/out"),
DeclareLaunchArgument("input_topic_spatem_ts", default_value="~/spatem_ts/in"),
DeclareLaunchArgument("output_topic_spatem_ts", default_value="~/spatem_ts/out"),
DeclareLaunchArgument("input_topic_vam_ts", default_value="~/vam_ts/in"),
DeclareLaunchArgument("output_topic_vam_ts", default_value="~/vam_ts/out"),
]

return LaunchDescription([
args = [
DeclareLaunchArgument("name", default_value="etsi_its_conversion_node", description="node name"),
DeclareLaunchArgument("namespace", default_value="", description="node namespace"),
DeclareLaunchArgument("params", default_value=os.path.join(get_package_share_directory("etsi_its_conversion"), "config", "params.yml"), description="path to parameter file"),
DeclareLaunchArgument("log_level", default_value="info", description="ROS logging level (debug, info, warn, error, fatal)"),
DeclareLaunchArgument("use_sim_time", default_value="false", description="use simulation clock"),
*remappable_topics,
]

nodes = [
Node(
package="etsi_its_conversion",
executable="etsi_its_conversion_node",
name="etsi_its_conversion",
namespace=LaunchConfiguration("namespace"),
name=LaunchConfiguration("name"),
parameters=[LaunchConfiguration("params")],
arguments=["--ros-args", "--log-level", LaunchConfiguration("log_level")],
remappings=[(la.default_value[0].text, LaunchConfiguration(la.name)) for la in remappable_topics],
output="screen",
emulate_tty=True,
parameters=[config]
)
])
]

return LaunchDescription([
SetParameter("use_sim_time", LaunchConfiguration("use_sim_time")),
*args,
*nodes,
])
Loading