Program Listing for File state_modeling.h

Return to documentation for file (api/include/pntos/plugins/state_modeling.h)

#pragma once

#include <pntos/aspn.h>
#include <pntos/plugins/common.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif

PNTOS_ASSUME_NONNULL_BEGIN

struct PntosStandardFusionEngine;

typedef struct PntosCommonStateModelProvider {
    PntosManagedMemory* memory;

    PntosFusionType engine_type;
} PntosCommonStateModelProvider;

struct PntosStandardDynamicsModel;

typedef PntosMatrix* (*PntosStandardDynamicsModelCallback)(struct PntosStandardDynamicsModel* self,
                                                           PntosMatrix* x);

typedef struct PntosStandardDynamicsModel {
    PntosManagedMemory* memory;

    PntosMatrix* Phi;

    PntosMatrix* Qd;

    PntosStandardDynamicsModelCallback g;
} PntosStandardDynamicsModel;

struct PntosStandardMeasurementModel;

typedef PntosMatrix* (*PntosStandardMeasurementModelCallback)(
    struct PntosStandardMeasurementModel* self, PntosMatrix* x);

typedef struct PntosStandardMeasurementModel {
    PntosManagedMemory* memory;

    PntosMatrix* z;

    PntosStandardMeasurementModelCallback h;

    PntosMatrix* H;

    PntosMatrix* R;
} PntosStandardMeasurementModel;


typedef struct PntosGenXandP {
    PntosManagedMemory* memory;

    PntosEstimateWithCovariance* PNTOS_NULLABLE (*generate)(struct PntosGenXandP* self,
                                                            char** block_labels,
                                                            size_t num_block_labels);
} PntosGenXandP;

typedef struct PntosStandardStateBlock {
    PntosManagedMemory* memory;

    char* label;
    size_t num_states;

    void (*receive_aux_data)(struct PntosStandardStateBlock* self, PntosMessageArray* aux);

    PntosStandardDynamicsModel* PNTOS_NULLABLE (*generate_dynamics)(
        struct PntosStandardStateBlock* self,
        PntosGenXandP* gen_x_and_p_func,
        AspnTypeTimestamp time_from,
        AspnTypeTimestamp time_to);

    struct PntosStandardStateBlock* (*clone)(struct PntosStandardStateBlock* self);
} PntosStandardStateBlock;


typedef struct PntosStandardMeasurementProcessor {
    PntosManagedMemory* memory;

    char* label;

    char** state_block_labels;

    size_t num_state_block_labels;

    void (*receive_aux_data)(struct PntosStandardMeasurementProcessor* self,
                             PntosMessageArray* aux);

    PntosStandardMeasurementModel* PNTOS_NULLABLE (*generate_model)(
        struct PntosStandardMeasurementProcessor* self,
        PntosMessage* message,
        PntosGenXandP* gen_x_and_p_func);

    struct PntosStandardMeasurementProcessor* (*clone)(
        struct PntosStandardMeasurementProcessor* self);
} PntosStandardMeasurementProcessor;

typedef struct PntosVirtualStateBlock {
    PntosManagedMemory* memory;

    void (*receive_aux_data)(struct PntosVirtualStateBlock* self, PntosMessageArray* aux);

    PntosEstimateWithCovariance* (*convert)(struct PntosVirtualStateBlock* self,
                                            PntosEstimateWithCovariance* estimate_with_covariance,
                                            AspnTypeTimestamp time);

    PntosMatrix* (*convert_estimate)(struct PntosVirtualStateBlock* self,
                                     PntosMatrix* estimate,
                                     AspnTypeTimestamp time);

    PntosMatrix* (*jacobian)(struct PntosVirtualStateBlock* self,
                             PntosMatrix* estimate,
                             AspnTypeTimestamp time);

    char* source;

    char* target;

    struct PntosVirtualStateBlock* (*clone)(struct PntosVirtualStateBlock* self);
} PntosVirtualStateBlock;

typedef struct PntosStandardStateModelProvider {
    PntosCommonStateModelProvider common;

    size_t num_processors;

    char** PNTOS_NULLABLE processor_identifiers;

    PntosStandardMeasurementProcessor* PNTOS_NULLABLE (*new_processor)(
        struct PntosStandardStateModelProvider* self,
        size_t processor_index,
        struct PntosStandardFusionEngine* PNTOS_NULLABLE engine,
        char* label,
        char** state_block_labels,
        size_t num_state_block_labels,
        char* PNTOS_NULLABLE config_group);

    size_t num_blocks;

    char** PNTOS_NULLABLE block_identifiers;

    PntosStandardStateBlock* PNTOS_NULLABLE (*new_block)(
        struct PntosStandardStateModelProvider* self,
        size_t block_index,
        struct PntosStandardFusionEngine* PNTOS_NULLABLE engine,
        char* label,
        char* PNTOS_NULLABLE config_group);

    size_t num_virtual_blocks;

    char** PNTOS_NULLABLE virtual_block_identifiers;

    PntosVirtualStateBlock* PNTOS_NULLABLE (*new_virtual_block)(
        struct PntosStandardStateModelProvider* self,
        size_t virtual_block_index,
        char* source_label,
        char* target_label,
        char* PNTOS_NULLABLE config_group);
} PntosStandardStateModelProvider;

typedef struct PntosStateModelingPlugin {
    PntosCommonPlugin common;

    bool (*is_fusion_type_supported)(struct PntosStateModelingPlugin* self, PntosFusionType type);

    PntosCommonStateModelProvider* PNTOS_NULLABLE (*new_state_model_provider)(
        struct PntosStateModelingPlugin* self, PntosFusionType type);
} PntosStateModelingPlugin;

PNTOS_ASSUME_NONNULL_END

#ifdef __cplusplus
}
#endif