parse_unsafe_results
parse_unsafe_results(pointer: int, *, height: int, width: int, frame_stack_size: int, observation_shape_order: Literal['hwf', 'fhw'], observation_dtype: np.dtype) -> list[MultiEnvResult]Parse one OakEmu MultiEnvironment.UnsafeDequeueResults buffer into result objects.
A failure record raises immediately, abandoning any sibling results in the (reused) buffer. That is deliberate: an environment failure is a bug to fix, so every caller treats it as fatal and nothing may catch-and-continue past it.
The buffer starts with {int ResultCount, int ByteLength} followed by ResultCount variable-size records of scalars, an observation pointer, per-step replay observation entries, and any trajectory block bytes inline. Everything is read with two ctypes copies (header, then body) and parsed in pure Python; observations are copied straight from their pointers into numpy arrays. No pythonnet objects are accessed.
The buffer and the pointers within it are only valid until the environment is used again, so all data is copied out eagerly. Numeric StepResult.Data entries cross inline as key/double pairs; when none are present, episode data for completed episodes is synthesized from the trajectory's episode end values. Failed results raise RuntimeError carrying the environment exception text.
Parameters:
pointer(int) – The address returned byMultiEnvironment.UnsafeDequeueResults.height(int) – The configured observation height.width(int) – The configured observation width.frame_stack_size(int) – The configured frame-stack size used to rebuild replay stacks.observation_shape_order(Literal['hwf', 'fhw']) – The configured observation layout.observation_dtype(dtype) – The configured observation dtype.
Returns:
list[MultiEnvResult]– The parsed results; empty if no results were queued.