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:
{
size_t bufferSize = 0;
{
...
}
}
{
size_t bufferSize = 0;
...
...
}
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.
◆ dwGlobalEgomotionStateElement
struct dwGlobalEgomotionStateElement |
◆ dwGlobalEgomotionDeserializerConstHandle_t
◆ dwGlobalEgomotionDeserializerHandle_t
◆ dwGlobalEgomotionSerializerConstHandle_t
◆ dwGlobalEgomotionSerializerHandle_t
◆ dwGlobalEgomotion_deserialize()
Deserialize the global egomotion state history from the provided buffer.
This call replaces any existing state history.
- Parameters
-
[in] | buffer | Buffer containing serialized state history. |
[in] | bufferSize | Number of elements in buffer . |
[in] | globalEgomotion | Handle 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()
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] | handle | A pointer to the handle for the created deserializer object. |
[in] | historySize | Size of the internal history, |
- See also
- dwGlobalEgomotionParameters.historySize. The size does not have to match that of the serialized module.
- Parameters
-
[in] | ctx | Handle 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()
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] | buffer | Buffer containing serialized state history. |
[out] | bufferSize | Number of elements written to buffer . |
[in] | bufferCapacity | Capacity of buffer in number of elements. |
[in] | handle | Handle 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.