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

MultiFrame acquisition #11

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all 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
30 changes: 23 additions & 7 deletions acquire_zarr/launch/oryx_to_zarr.launch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from launch_ros.substitutions import FindPackageShare

from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import OpaqueFunction, IncludeLaunchDescription, DeclareLaunchArgument as LaunchArg
Expand All @@ -13,14 +12,27 @@
'dump_node_map': False,
'frame_rate_auto': 'Off',
'buffer_queue_size': 10,
# Stack acquisition parameters
'acquisition_mode': 'MultiFrame', # For finite stack capture
'frame_count': LaunchConfig('stack_size'), # Number of images in stack
# GPIO configuration
'line_selector': LaunchConfig('gpio_line'), # Select GPIO line
'line_linemode': 'Output', # Configure as output
'line_source': 'ExposureActive', # Signal during exposure
# Timing configuration
'frame_rate_enable': True,
'frame_rate': LaunchConfig('frame_rate'),
'exposure_mode': 'Timed',
'exposure_auto': 'Off',
'exposure_time': LaunchConfig('exposure_time'),
}

def launch_setup(context, *args, **kwargs):
"""Launch camera driver node."""
parameter_file = PathJoinSubstitution(
[FindPackageShare('spinnaker_camera_driver'), 'config', 'oryx.yaml']
)

camera_node = Node(
package='spinnaker_camera_driver',
executable='camera_driver_node',
Expand All @@ -31,25 +43,25 @@ def launch_setup(context, *args, **kwargs):
{
'ffmpeg_image_transport.encoding': 'hevc_nvenc',
'parameter_file': parameter_file,
'serial_number': [LaunchConfig('serial')], #"'23011970'",
'serial_number': [LaunchConfig('serial')],
},
],
)

zarr_writer_node = Node(
package='acquire_zarr',
executable='zarr_writer_node_exe',
parameters=[{
'zarr_out_path': LaunchConfig('zarr_out_path'),
'dimension_sizes': [0, LaunchConfig('image_height'), LaunchConfig('image_width')],
'chunk_sizes': [1, LaunchConfig('image_height'), LaunchConfig('image_width')],
'dimension_sizes': [LaunchConfig('stack_size'), LaunchConfig('image_height'), LaunchConfig('image_width')],
'chunk_sizes': [LaunchConfig('stack_size'), LaunchConfig('image_height'), LaunchConfig('image_width')],
}],
remappings=[
('image_raw', '/oryx/image_raw'),
],
output='screen'
)

return [camera_node, zarr_writer_node]

def generate_launch_description():
Expand All @@ -58,5 +70,9 @@ def generate_launch_description():
LaunchArg('image_width', default_value='2448', description='Image width'),
LaunchArg('image_height', default_value='2048', description='Image height'),
LaunchArg('zarr_out_path', default_value='/tmp/out.zarr', description='zarr output path'),
LaunchArg('stack_size', default_value='100', description='Number of images in stack'),
LaunchArg('gpio_line', default_value='Line2', description='GPIO line for timing signals'),
LaunchArg('frame_rate', default_value='10.0', description='Frame rate in Hz'),
LaunchArg('exposure_time', default_value='10000.0', description='Exposure time in microseconds'),
OpaqueFunction(function=launch_setup)
])