Struct PntosStandardFusionEngine
Defined in File fusion.h
Struct Documentation
-
struct PntosStandardFusionEngine
An implementation of a fusion engine that supports the standard fusion model.
Assumes the system is described by discrete-time matrices and noise inputs are zero-mean white Gaussian. In addition, all covariance matrices / mean vectors are descriptions of jointly-Gaussian multivariate distributions. All noise sources are jointly-Gaussian distributed.
This object requires a PntosStandardFusionStrategy to work. Some implementations may be able to provide their own. Others will require a strategy to be provided via the PntosStandardFusionEngine.set_strategy method. It is possible to check whether a fusion engine needs to be provided a fusion strategy by calling the PntosStandardFusionEngine.get_strategy method (if the return is NULL then this fusion engine needs to be provided a strategy). While PntosStandardFusionEngine.get_strategy returns NULL, all other methods are unsafe to be called.
UNSTABLE: This feature is unstable and is not yet considered part of the stable pntOS API. Usage of this feature is highly discouraged in non-experimental code, and its definition may change at any time.
Public Members
-
PntosCommonFusionEngine common
-
void (*set_time)(struct PntosStandardFusionEngine *self, AspnTypeTimestamp time)
Set the current time of the filter to the parameter.
-
AspnTypeTimestamp (*get_time)(struct PntosStandardFusionEngine *self)
Get the current time of the filter
-
void (*set_strategy)(struct PntosStandardFusionEngine *self, PntosStandardFusionStrategy *strategy)
Set the underlying algorithm used for Bayesian inference - the type of filter (EKF, UKF, etc.)
-
PntosStandardFusionStrategy *(*get_strategy)(struct PntosStandardFusionEngine *self)
- Return
The underlying algorithm used for Bayesian inference - the type of filter (EKF, UKF, etc.). Returns NULL if this fusion engine does not have a strategy. If that is the case, the fusion engine must be provided with a strategy via set_strategy.
-
size_t (*get_num_states)(struct PntosStandardFusionEngine *self)
Get the total number of states currently in the fusion engine that are associated with
PntosStandardStateBlocks.
-
PntosStringArray *(*get_state_block_labels)(struct PntosStandardFusionEngine *self)
Gets a list of the
PntosStandardStateBlocks labels that have been added to this fusion engine. Returns NULL if no state blocks have been added. Guaranteed to not return NULL if get_num_states returns a value other than 0.
-
bool (*has_block)(struct PntosStandardFusionEngine *self, char *block_label)
Returns true if the fusion engine has a
PntosStandardStateBlockwith a matching label.
-
void (*add_state_block)(struct PntosStandardFusionEngine *self, PntosStandardStateBlock *block, PntosEstimateWithCovariance *initial_estimate_covariance, PntosCrossCovariances *cross_covariances)
Add the given PntosStandardStateBlock to the fusion engine. This will expand the state vector being estimated by the value of
block->get_num_states(). Theinitial_estimate_covarianceparameter contains the initial conditions of the states, withinitial_estimate_covariance->estimatebeing an Nx1 matrix andinitial_estimate_covariance->covariancebeing an NxN matrix, where N isblock->get_num_states(). Thecross_covariancesare an optional parameter which, if non-NULL, contains a description of the newly added StateBlock’s cross covariances with respect to a set of StateBlocks which already exist inside the filter (specified bycross_covariances->block_labels). If thecross_covarianceparameter is NULL, cross covariance between the existing states and the added states will be set to zeroes.
-
PntosMatrix *(*get_state_block_estimate)(struct PntosStandardFusionEngine *self, char *block_label)
Find a
PntosStandardStateBlockorPntosVirtualStateBlockwithin the fusion engine matchingblock_label, and return a copy of its current estimate vector. Ifblock_labelreferences a virtual state block (VSB) this will return a converted estimate, converted into the VSBs coordinate frame. Returns NULL ifblock_labeldoes not correspond to a block that has been added to the fusion engine. Guaranteed to not return NULL when has_block returns true forblock_labeland get_strategy does not return NULL.
-
PntosMatrix *(*get_state_block_covariance)(struct PntosStandardFusionEngine *self, char *block_label)
Find a
PntosStandardStateBlockorPntosVirtualStateBlockwithin the fusion engine matchingblock_label, and return a copy of its current covariance matrix. Ifblock_labelreferences a virtual state block (VSB) this will return a converted covariance, converted into the VSBs coordinate frame. Returns NULL ifblock_labeldoes not correspond to a block that has been added to the fusion engine. Guaranteed to not return NULL when has_block returns true forblock_labeland get_strategy does not return NULL.
-
PntosMatrix *(*get_state_block_cross_covariance)(struct PntosStandardFusionEngine *self, char *block_label1, char *block_label2)
Find the
PntosStandardStateBlockswithin the fusion engine matchingblock_label1andblock_label2, and return the cross-covariance matrix between them. Returns NULL ifblock_label1orblock_label2do not correspond to blocks that gave been added to the fusion engine. Guaranteed to not return NULL when has_block returns true for bothblock_labelandblock_label2and get_strategy does not return NULL.
-
void (*set_state_block_estimate)(struct PntosStandardFusionEngine *self, char *block_label, PntosMatrix *estimate)
Find a
PntosStandardStateBlockwithin the fusion engine matchingblock_label, and change its current estimate vector. Note that this function may lead to performance degradation with some implementations and thus its use is discouraged if other options are available.
-
void (*set_state_block_covariance)(struct PntosStandardFusionEngine *self, char *block_label, PntosMatrix *covariance)
Find a
PntosStandardStateBlockwithin the fusion engine matchingblock_label, and change its current covariance matrix. Note that this function may lead to performance degradation with some implementations and thus its use is discouraged if other options are available.
-
void (*set_state_block_cross_covariance)(struct PntosStandardFusionEngine *self, char *block_label1, char *block_label2, PntosMatrix *covariance)
Find the
PntosStandardStateBlocks within the fusion engine matchingblock_label1andblock_label2, and change the current covariance matrix between them. Note that this function may lead to performance degradation with some implementations and thus its use is discouraged if other options are available.
-
void (*remove_state_block)(struct PntosStandardFusionEngine *self, char *block_label)
Remove the
PntosStandardStateBlockpreviously added to the fusion engine using add_state_block based on a matchingblock_label. This will reduce the state vector being estimated by the number of states that the block represents.
-
PntosStringArray *(*get_virtual_state_block_target_labels)(struct PntosStandardFusionEngine *self)
Gets a list of the target labels of virtual state blocks that have been added to this fusion engine.
A label being returned by this list is not a guarantee that the virtual state block has a valid source. For that, call has_virtual_state_block().
Returns NULL if no virtual state blocks have been added to this fusion engine.
-
bool (*has_virtual_state_block)(struct PntosStandardFusionEngine *self, char *vsb_target_label)
Returns true if the fusion engine has a
PntosVirtualStateBlockwith a matching target label that is capable of generating an estimate. That is, the VSB’s source exists and is in a continuous chain to a concrete state block which also exists in the fusion engine.
-
void (*add_virtual_state_block)(struct PntosStandardFusionEngine *self, PntosVirtualStateBlock *virtual_state_block)
Add the given
PntosVirtualStateBlockto the fusion engine. A virtual state block (VSB) convert from an underlying block coordinate frame into the VSB coordinate frame.
-
void (*remove_virtual_state_block)(struct PntosStandardFusionEngine *self, char *vsb_target_label)
Remove the
PntosVirtualStateBlockpreviously added to the fusion engine using add_virtual_state_block based on a matchingvsb_target_label.
-
PntosStringArray *(*get_measurement_processor_labels)(struct PntosStandardFusionEngine *self)
Gets a list of the labels of measurement processors that have been added to this fusion engine. Returns NULL if no measurement processors have been added to this fusion engine.
-
bool (*has_processor)(struct PntosStandardFusionEngine *self, char *processor_label)
Returns true if the fusion engine has a measurement processor with a matching label.
-
void (*add_measurement_processor)(struct PntosStandardFusionEngine *self, PntosStandardMeasurementProcessor *processor)
Add a PntosStandardMeasurementProcessor which can be used to process future measurements that correspond to
processor->get_label();
-
void (*remove_measurement_processor)(struct PntosStandardFusionEngine *self, char *processor_label)
Remove the PntosStandardMeasurementProcessor previously added to the fusion engine using add_measurement_processor based on a matching
processor_label.
-
void (*propagate)(struct PntosStandardFusionEngine *self, AspnTypeTimestamp time)
Propagate the filter estimate forward in time. May be evaluated lazily (when results are requested).
-
void (*update)(struct PntosStandardFusionEngine *self, char *processor_label, PntosMessage *message)
Update the filter with the given measurement. Will propagate first if needed to reach the time encoded inside the measurement.
-
PntosEstimateWithCovariance *(*peek_ahead)(struct PntosStandardFusionEngine *self, AspnTypeTimestamp time, char **block_labels, size_t num_block_labels)
Calculates the estimate and covariance at a requested time using the state blocks listed in
block_labels, without changing the state of the fusion engine or its underlying filter. Blocks are assembled in the order that the labels are passed in.block_labelsis an array ofnum_block_labelspointers to\0terminated C strings.If all of the following are true:
timeis equal to or after the filter time (which can be checked with get_time)all labels in
block_labelscorrespond to a block that has been added to the fusion engine (which can be checked with has_block)num_block_labelsis greater than zero
Then the result returned is guaranteed to not be NULL. Otherwise, if any of the above are false then the result will be NULL.
-
PntosEstimateWithCovariance *(*generate_x_and_p)(struct PntosStandardFusionEngine *self, char **block_labels, size_t num_block_labels)
Generates the current estimate and covariance built corresponding to a list of State Block labels. Blocks are assembled in the order that the labels are passed in.
block_labelsis an array ofnum_block_labelspointers to\0terminated C strings.If all of the following are true:
all labels in
block_labelscorrespond to a block that has been added to the fusion engine (which can be checked with has_block)num_block_labelsis greater than zero
Then the result returned is guaranteed to not be NULL. Otherwise, if any of the above are false then the result will be NULL.
-
void (*give_state_block_aux_data)(struct PntosStandardFusionEngine *self, char *block_label, PntosMessageArray *aux)
Route a
PntosMessageArrayof aux data to aPntosStandardStateBlockpreviously registered using add_state_block based on a matchingblock_label.
-
void (*give_measurement_processor_aux_data)(struct PntosStandardFusionEngine *self, char *processor_label, PntosMessageArray *aux)
Route a
PntosMessageArrayof aux data to aPntosStandardMeasurementProcessorpreviously registered using add_measurement_processor based on a matchingprocessor_label.
-
void (*give_virtual_state_block_aux_data)(struct PntosStandardFusionEngine *self, char *target_label, PntosMessageArray *aux)
Route a
PntosMessageArrayof aux data to aPntosVirtualStateBlockpreviously registered using add_virtual_state_block based on a matchingtarget_label.
-
struct PntosStandardFusionEngine *(*clone)(struct PntosStandardFusionEngine *self)
Produce a deep-copy this fusion engine instance. All state blocks and measurement processors held by the fusion engine will also be cloned. The fusion strategy used by the fusion engine will also be cloned.
-
PntosCommonFusionEngine common