DriveWorks SDK Reference
5.16.65 Release
For Test and Development only

Serialization Interface

Detailed Description

Defines the serialization API of the global egomotion module.

The typical use case of the serialization API is transmission of the state history across process and/or machine boundaries. The state is transmitted as a variable-size array of state elements and combined into a full state on deserialization.

Example:

// PRODUCER
{
// buffer that will be transmitted
size_t bufferSize = 0;
// serialize and transmit state
if(dwGlobalEgomotion_serialize(buffer, &bufferSize, CAPACITY, handle) == DW_SUCCESS)
{
// `buffer` now contains `bufferSize` (latest) estimates
// transmit to consumer
...
}
}
// CONSUMER
{
// initialize deserializer module
// dwGlobalEgomotionStateElement buffer[CAPACITY];
size_t bufferSize = 0;
// receive `buffer` and `bufferSize` from producer
...
// deserialize state
dwGlobalEgomotion_deserialize(buffer, bufferSize, deserializer);
// The `deserializer` handle can now be used with all getter APIs of
// dwGlobalEgomotion (identifiable by the const handle input):
...
}
@ DW_SUCCESS
No error.
Definition: ErrorDefs.h:45
DW_API_PUBLIC dwStatus dwGlobalEgomotion_getEstimate(dwGlobalEgomotionResult *result, dwGlobalEgomotionUncertainty *uncertainty, dwGlobalEgomotionConstHandle_t handle)
Get current filter state estimate.
DW_API_PUBLIC dwStatus dwGlobalEgomotion_getTimestamp(dwTime_t *timestamp, dwGlobalEgomotionConstHandle_t handle)
Get timestamp of current filter estimate.
DW_API_PUBLIC dwStatus dwGlobalEgomotion_computeEstimate(dwGlobalEgomotionResult *result, dwGlobalEgomotionUncertainty *uncertainty, dwTime_t timestamp, dwGlobalEgomotionConstHandle_t handle)
Computes global state estimate at given timestamp, if necessary by linear interpolation between avail...
struct dwGlobalEgomotionObject * dwGlobalEgomotionHandle_t
DW_API_PUBLIC dwStatus dwGlobalEgomotion_serialize(dwGlobalEgomotionStateElement *buffer, size_t *bufferSize, size_t const bufferCapacity, dwGlobalEgomotionHandle_t handle)
Serialize the global egomotion state history out into the provided buffer.
DW_API_PUBLIC dwStatus dwGlobalEgomotion_initializeDeserializer(dwGlobalEgomotionHandle_t *handle, size_t historySize, dwContextHandle_t ctx)
Initializes a global egomotion deserializer object.
DW_API_PUBLIC dwStatus dwGlobalEgomotion_deserialize(dwGlobalEgomotionStateElement *buffer, size_t bufferSize, dwGlobalEgomotionHandle_t globalEgomotion)
Deserialize the global egomotion state history from the provided buffer.
Defines global egomotion state element.

Data Structures

struct  dwGlobalEgomotionStateElement
 Defines global egomotion state element. More...
 

Typedefs

typedef struct dwGlobalEgomotionDeserializer const * dwGlobalEgomotionDeserializerConstHandle_t
 
typedef struct dwGlobalEgomotionDeserializer * dwGlobalEgomotionDeserializerHandle_t
 
typedef struct dwGlobalEgomotionSerializer const * dwGlobalEgomotionSerializerConstHandle_t
 
typedef struct dwGlobalEgomotionSerializer * dwGlobalEgomotionSerializerHandle_t
 

Functions

DW_API_PUBLIC dwStatus dwGlobalEgomotion_deserialize (dwGlobalEgomotionStateElement *buffer, size_t bufferSize, dwGlobalEgomotionHandle_t globalEgomotion)
 Deserialize the global egomotion state history from the provided buffer. More...
 
DW_API_PUBLIC dwStatus dwGlobalEgomotion_initializeDeserializer (dwGlobalEgomotionHandle_t *handle, size_t historySize, dwContextHandle_t ctx)
 Initializes a global egomotion deserializer object. More...
 
DW_API_PUBLIC dwStatus dwGlobalEgomotion_serialize (dwGlobalEgomotionStateElement *buffer, size_t *bufferSize, size_t const bufferCapacity, dwGlobalEgomotionHandle_t handle)
 Serialize the global egomotion state history out into the provided buffer. More...
 

Data Structure Documentation

◆ dwGlobalEgomotionStateElement

struct dwGlobalEgomotionStateElement
Data Fields
dwGlobalEgomotionResult estimate
dwGlobalEgomotionUncertainty uncertainty

Typedef Documentation

◆ dwGlobalEgomotionDeserializerConstHandle_t

typedef struct dwGlobalEgomotionDeserializer const* dwGlobalEgomotionDeserializerConstHandle_t

Definition at line 105 of file GlobalEgomotionSerialization.h.

◆ dwGlobalEgomotionDeserializerHandle_t

typedef struct dwGlobalEgomotionDeserializer* dwGlobalEgomotionDeserializerHandle_t

Definition at line 104 of file GlobalEgomotionSerialization.h.

◆ dwGlobalEgomotionSerializerConstHandle_t

typedef struct dwGlobalEgomotionSerializer const* dwGlobalEgomotionSerializerConstHandle_t

Definition at line 102 of file GlobalEgomotionSerialization.h.

◆ dwGlobalEgomotionSerializerHandle_t

typedef struct dwGlobalEgomotionSerializer* dwGlobalEgomotionSerializerHandle_t

Definition at line 101 of file GlobalEgomotionSerialization.h.

Function Documentation

◆ dwGlobalEgomotion_deserialize()

DW_API_PUBLIC dwStatus dwGlobalEgomotion_deserialize ( dwGlobalEgomotionStateElement buffer,
size_t  bufferSize,
dwGlobalEgomotionHandle_t  globalEgomotion 
)

Deserialize the global egomotion state history from the provided buffer.

This call replaces any existing state history.

Parameters
[in]bufferBuffer containing serialized state history.
[in]bufferSizeNumber of elements in buffer.
[in]globalEgomotionHandle of a global egomotion object storing the deserialized history.
Returns
DW_INVALID_ARGUMENT - if the provided buffer is nullptr or the data is invalid.
DW_INVALID_HANDLE - if provided deserializer handle is invalid
DW_SUCCESS - buffer has been deserialized into corresponding global egomotion object.

◆ dwGlobalEgomotion_initializeDeserializer()

DW_API_PUBLIC dwStatus dwGlobalEgomotion_initializeDeserializer ( dwGlobalEgomotionHandle_t handle,
size_t  historySize,
dwContextHandle_t  ctx 
)

Initializes a global egomotion deserializer object.

This object does not support the dwGlobalEgomotion_addRelativeMotion and dwGlobalEgomotion_addGPSMeasurement APIs.

The deserializer is released with dwGlobalEgomotion_release.

Parameters
[out]handleA pointer to the handle for the created deserializer object.
[in]historySizeSize of the internal history,
See also
dwGlobalEgomotionParameters.historySize. The size does not have to match that of the serialized module.
Parameters
[in]ctxHandle of the context under which the objects are created.
Returns
DW_INVALID_HANDLE - if the provided context handle is invalid
DW_SUCCESS - if initialization succeeded

◆ dwGlobalEgomotion_serialize()

DW_API_PUBLIC dwStatus dwGlobalEgomotion_serialize ( dwGlobalEgomotionStateElement buffer,
size_t *  bufferSize,
size_t const  bufferCapacity,
dwGlobalEgomotionHandle_t  handle 
)

Serialize the global egomotion state history out into the provided buffer.

Fills out the provided buffer with the current global egomotion state history. The most recent state history is serialized, up to the buffer capacity. Filling order is oldest to most recent state history element.

Provide a buffer with capacity larger or equal to the historySize parameter of the global egomotion module to be serialized in order to ensure the full state history can be stored. If the buffer capacity is too low to fit the state history, the buffer is filled with the latest history elements that fit.

Parameters
[out]bufferBuffer containing serialized state history.
[out]bufferSizeNumber of elements written to buffer.
[in]bufferCapacityCapacity of buffer in number of elements.
[in]handleHandle of a global egomotion object from which to serialize data.
Returns
DW_INVALID_ARGUMENT - buffer or bufferSize is nullptr.
DW_INVALID_HANDLE - global egomotion handle is invalid.
DW_NOT_AVAILABLE - no state history to be serialized.
DW_SUCCESS - buffer has been filled with state history.