Skip to content

Commit

Permalink
feat: bag play remap (#44)
Browse files Browse the repository at this point in the history
* feat: remap topics

Signed-off-by: Hayato Mizushima <[email protected]>

* fix: remap command

Signed-off-by: Hayato Mizushima <[email protected]>

---------

Signed-off-by: Hayato Mizushima <[email protected]>
  • Loading branch information
hayato-m126 authored Nov 7, 2024
1 parent f310093 commit 61ca6a9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion driving_log_replayer_v2/launch/driving_log_replayer_v2.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def get_launch_arguments() -> list:
record_only
override_topics_regex
storage
remap
"""
launch_arguments = []

Expand Down Expand Up @@ -109,6 +110,11 @@ def add_launch_arg(
default_value="sqlite3", # Settings are adjusted to ros distro standards. Currently autoware is humble, so use sqlite3. Change to mcap when updated to jazzy.
description="select storage type mcap or sqlite3",
)
add_launch_arg(
"remap",
default_value="", # Settings are adjusted to ros distro standards. Currently autoware is humble, so use sqlite3. Change to mcap when updated to jazzy.
description="use comma separated string. Ex: remap:=/tf,/sensing/lidar/concatenated/pointcloud",
)

return launch_arguments

Expand Down Expand Up @@ -368,6 +374,12 @@ def launch_bag_player(
remap_list.append(
"/planning/mission_planning/route:=/unused/planning/mission_planning/route",
)
# user defined remap
if conf["remap"] != "":
remap_topics: list[str] = conf["remap"].split(",")
for topic in remap_topics:
if topic.startswith("/") and topic not in remap_list:
remap_list.append(f"{topic}:=/unused{topic}")
if len(remap_list) != 1:
play_cmd.extend(remap_list)
bag_player = (
Expand All @@ -379,7 +391,7 @@ def launch_bag_player(
if conf["record_only"] == "true"
else ExecuteProcess(cmd=play_cmd, output="screen")
)
return [bag_player]
return [bag_player, LogInfo(msg=f"remap_command is {remap_list}")]


def launch_bag_recorder(context: LaunchContext) -> list:
Expand Down

0 comments on commit 61ca6a9

Please sign in to comment.