Program Listing for File inertial.h
↰ Return to documentation for file (api/include/pntos/plugins/inertial.h)
#pragma once
#include <pntos/aspn.h>
#include <pntos/plugins/common.h>
#include <pntos/stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
PNTOS_ASSUME_NONNULL_BEGIN
typedef enum PntosInertialFrame {
PNTOS_INERTIAL_FRAME_NED
} PntosInertialFrame;
typedef struct PntosInertialForcesRates {
PntosManagedMemory* memory;
AspnMeasurementImu* forces_and_rates;
PntosInertialFrame frame;
} PntosInertialForcesRates;
typedef struct PntosStandardInertialErrors {
PntosManagedMemory* memory;
double accel_biases[3];
double gyro_biases[3];
double accel_scale_factors[3];
double gyro_scale_factors[3];
/* TODO: more terms? Possibly sensor misalignment angles?*/
} PntosStandardInertialErrors;
typedef enum PntosInertialSolutionRangeType {
PNTOS_INERTIAL_BEST_KNOWN_SOLUTION,
PNTOS_INERTIAL_NO_UPDATES_WITHIN_RANGE
} PntosInertialSolutionRangeType;
typedef enum PntosInertialType {
PNTOS_STANDARD_INERTIAL_MECHANIZATION,
PNTOS_EXTERNAL_INERTIAL,
PNTOS_NON_ORTHOGONAL_INERTIAL_MECHANIZATION
} PntosInertialType;
typedef struct PntosCommonInertial {
PntosManagedMemory* memory;
PntosInertialType inertial_type;
PntosMessageType (*request_solution_message_type)(struct PntosCommonInertial* self);
PntosMessage* (*request_current_solution)(struct PntosCommonInertial* self);
PntosMessage* PNTOS_NULLABLE (*request_solution)(struct PntosCommonInertial* self,
AspnTypeTimestamp time);
PntosMessageArray* PNTOS_NULLABLE (*request_solutions)(struct PntosCommonInertial* self,
AspnTypeTimestamp* times,
size_t num_times,
PntosInertialSolutionRangeType type);
bool (*is_time_in_range)(struct PntosCommonInertial* self, AspnTypeTimestamp time);
AspnTypeTimestamp (*request_earliest_time)(struct PntosCommonInertial* self);
AspnTypeTimestamp (*request_latest_time)(struct PntosCommonInertial* self);
PntosMessageTypeArray* (*request_process_pntos_message_types)(struct PntosCommonInertial* self);
void (*process_pntos_message)(struct PntosCommonInertial* self, PntosMessage* message);
PntosInertialForcesRates* PNTOS_NULLABLE (*request_forces_and_rates)(
struct PntosCommonInertial* self, AspnTypeTimestamp time);
PntosInertialForcesRates* PNTOS_NULLABLE (*request_average_forces_and_rates)(
struct PntosCommonInertial* self, AspnTypeTimestamp time1, AspnTypeTimestamp time2);
} PntosCommonInertial;
typedef PntosCommonInertial PntosExternalInertial;
typedef struct PntosStandardInertialMechanization {
PntosCommonInertial common;
PntosMessageTypeArray* PNTOS_NULLABLE (*request_reset_message_types)(
struct PntosStandardInertialMechanization* self);
void (*reset_solution)(struct PntosStandardInertialMechanization* self, PntosMessage* message);
void (*correct_sensor_errors)(struct PntosStandardInertialMechanization* self,
AspnTypeTimestamp time,
PntosStandardInertialErrors* errors);
PntosStandardInertialErrors* PNTOS_NULLABLE (*request_sensor_errors)(
struct PntosStandardInertialMechanization* self, AspnTypeTimestamp time);
} PntosStandardInertialMechanization;
typedef struct PntosInertialPlugin {
PntosCommonPlugin common;
bool (*is_inertial_type_supported)(struct PntosInertialPlugin* self, PntosInertialType type);
PntosCommonInertial* PNTOS_NULLABLE (*new_inertial)(struct PntosInertialPlugin* self,
PntosInertialType type,
PntosMessage* solution,
char* PNTOS_NULLABLE config_group);
} PntosInertialPlugin;
#ifdef __cplusplus
}
#endif
PNTOS_ASSUME_NONNULL_END