feat: support Yahboom in shared Nav2 perception

This commit is contained in:
2026-09-22 11:12:05 +09:00
parent 2c1c31817d
commit 2a559eda07
2 changed files with 22 additions and 1 deletions
@@ -6,11 +6,14 @@ def build_perception_commands(config):
level = config.get("level") level = config.get("level")
robot = config.get("robot", "") robot = config.get("robot", "")
sim_mode = str(config.get("sim_mode", False)).lower() sim_mode = str(config.get("sim_mode", False)).lower()
# Yahboom's vehicle/Agent already provide scan, odometry and sensor TF.
# Do not start a second odometry or point-cloud conversion pipeline.
yahboom_direct_scan = robot == "yahboom" and level == "2d"
# Gazebo's TurtleBot3 model publishes LaserScan directly. Launching the # Gazebo's TurtleBot3 model publishes LaserScan directly. Launching the
# pointcloud conversion stack here is both redundant and unsupported. # pointcloud conversion stack here is both redundant and unsupported.
if sim_mode == "true" and robot == "turtlebot3": if sim_mode == "true" and robot == "turtlebot3":
return cmds return cmds
if level and level != "None": if level and level != "None" and not yahboom_direct_scan:
cmds.append(["ros2", "launch", f"perception{level}_pkg", cmds.append(["ros2", "launch", f"perception{level}_pkg",
"perception.launch.py", f"robot:={robot}", f"sim_mode:={sim_mode}"]) "perception.launch.py", f"robot:={robot}", f"sim_mode:={sim_mode}"])
for entry in config.get("perception") or []: for entry in config.get("perception") or []:
@@ -1,6 +1,24 @@
from perception_pkg.launch_spec import build_perception_commands from perception_pkg.launch_spec import build_perception_commands
def test_yahboom_does_not_duplicate_scan_and_tf():
for simulation in (True, False):
assert build_perception_commands({
"level": "2d", "robot": "yahboom", "sim_mode": simulation}) == []
def test_yahboom_keeps_explicit_extra_processing():
commands = build_perception_commands({
"level": "2d", "robot": "yahboom", "sim_mode": True,
"perception": [{"package": "custom_detector"}]})
assert commands == [["ros2", "launch", "custom_detector", "perception.launch.py"]]
def test_turtlebot_simulation_remains_direct_scan():
assert build_perception_commands({
"level": "2d", "robot": "turtlebot3", "sim_mode": True}) == []
def test_level_only(): def test_level_only():
cmds = build_perception_commands({"level": "3d", "robot": "mkmini", "sim_mode": True}) cmds = build_perception_commands({"level": "3d", "robot": "mkmini", "sim_mode": True})
assert ["ros2", "launch", "perception3d_pkg", "perception.launch.py", "robot:=mkmini", "sim_mode:=true"] in cmds assert ["ros2", "launch", "perception3d_pkg", "perception.launch.py", "robot:=mkmini", "sim_mode:=true"] in cmds