Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
# replace serials with your owns
SERIALS = {0: "<serial 1>", 1: "<serial 2>", 2: "<serial 3>", 3: "<serial 4>"}
def generate_launch_description() -> LaunchDescription:
# Camera model (force value)
camera_model = "zed2i"
num_zed = 4
# Define LaunchDescription variable
ld = LaunchDescription()
for idx in range(num_zed):
# ZED Wrapper node
zed_wrapper_launch = IncludeLaunchDescription(
launch_description_source=PythonLaunchDescriptionSource(
[
get_package_share_directory("zed_wrapper"),
"/launch/include/zed_camera.launch.py",
]
),
launch_arguments={
"camera_model": camera_model,
"camera_name": f"{camera_model}{idx}",
"zed_id": str(idx),
"serial_number": SERIALS[idx],
}.items()
)
# Add nodes to LaunchDescription
ld.add_action(zed_wrapper_launch)
return ld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment