Dynamic Spans have a maximum extent for the Control<Span<Type>> but a variable number of elements for the ControlValue in the ControlInfo. For dynamic Spans with a single element, this previously caused the exception std::length_error since a vector with "maximum extent" (dynamic_extent) elements was constructed. Additionally, libcamera allows controls to have default and min/max values of different types than the control.
This PR thus changes the behaviour of how libcamera controls are mapped and converted to ROS parameters in the following way:
ignore the control extent of a Span for conversion of default ControlValue and use the actual number of elements to prevent memory allocation with the "maximum extent"
enforce from now on that an extent of 0 means that the original Control contains a scalar type, such as Control<Type>, and not a Span, such as Control<Span<Type>>
check compatible libcamera control to ROS parameter type conversions based on the Control type and not the ControlValue
Altogether, this will ensure that we do not attempt to convert controls that are typed with an unsupported type, such as arrays of complex types (e.g. Control<Span<const Rectangle>>), independently of the variable types in the ControlInfo which is set by the IPA or pipeline.
Dynamic Spans have a maximum extent for the
Control<Span<Type>>
but a variable number of elements for theControlValue
in theControlInfo
. For dynamic Spans with a single element, this previously caused the exceptionstd::length_error
since a vector with "maximum extent" (dynamic_extent
) elements was constructed. Additionally, libcamera allows controls to have default and min/max values of different types than the control.This PR thus changes the behaviour of how libcamera controls are mapped and converted to ROS parameters in the following way:
ControlValue
and use the actual number of elements to prevent memory allocation with the "maximum extent"Control
contains a scalar type, such asControl<Type>
, and not a Span, such asControl<Span<Type>>
Control
type and not theControlValue
Altogether, this will ensure that we do not attempt to convert controls that are typed with an unsupported type, such as arrays of complex types (e.g.
Control<Span<const Rectangle>>
), independently of the variable types in theControlInfo
which is set by the IPA or pipeline.Fixes #13, Fixes #50.