WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
warpos::MagUpdate Class Reference

GNC App for performing the magnetometer measurement update step of an EKF when a 3-axis magnetometer is available to report the local magnetic field vector. This app implements the EKF measurement correction step by comparing the measured magnetic field in the magnetometer frame to the expected magnetic field derived from an internal model (e.g., WMM, IGRF, lookup table) and the current state estimate. More...

#include <MagUpdate.h>

Inheritance diagram for warpos::MagUpdate:

Classes

struct  Params
struct  Inputs
struct  Outputs

Public Member Functions

 MagUpdate (FlightExecutive &executive)
virtual ~MagUpdate ()
int16 activate () override
 Activate the app. The app will step when active.
int16 deactivate () override
 Deactivate the app. The app will not step when deactivated.
int16 command (uint16 apid, uint8 *buffer, uint16 size) override
 Process commands issued to the app.
inertial_nav::MagMeasVector getResidual ()
 Getter function to grab the internal residual.
Public Member Functions inherited from warpos::App
 App (FlightExecutive &executive, const char *name, uint16 apid, uint8 instance=0)
 Executive-based constructor for the task.
virtual ~App ()
 Destructor. Doesn't really do anything.
int16 startup ()
 Initialize the app. Should be called once before step.
int16 step ()
 Step the app by a single step. Maps params, inputs, etc. to outputs.
log_level_e logLevel ()
 Get the log level set for the executive.
void logLevel (log_level_e log_level)
 Set the executive log level.
bool isStarted ()
 Return whether task startup has been run.
uint16 apid ()
 Get the apid for this app.
uint8 & instance ()
 Get the instance of this app (used to differentiate between multiple instances of the same app).
Public Member Functions inherited from clockwerk::GraphTreeObject
 GraphTreeObject (const char *gt_nme="", GraphTreeObject **storage_array=nullptr, uint32 storage_size=0)
 Name-based constructor for GraphTreeObject which will have no children by default.
virtual ~GraphTreeObject ()
 Destructor.
GraphTreeObjectparent ()
 Functions to get object's parent/children.
GraphTreeObject ** children ()
GraphTreeObjectchildAtIndex (uint8 i) const
int16 parent (GraphTreeObject *new_parent)
 Function to assign the node's parent via pointer.
int16 parent (GraphTreeObject &new_parent)
 Function to assign the node's parent via reference.
uint8 nChildren () const
 Getters for number of children and descendants.
uint16 nDescendants () const
uint8 capacity () const
const char * name () const
 Getter and setter for object name.
int16 name (const char *new_name)
uint8 rank ()
 Getter for the object rank.
int8 type ()
 Function to indicate type – -1 by default unless implemented downstream.
bool loggable ()
 Getter for object logability flag – note no setter because should only be set by this or a derived class in its definition.
GraphTreeObjectgetRootDataPointer ()
 Get the pointer to the highest object in the graph tree.
virtual int16 str (char *output, size_t size) const
 Get object represented as string.
virtual int16 fromStr (const char *val)
 Set value of graphtreeobject from string.

Public Attributes

Params params = Params(this, "params")
Inputs inputs = Inputs(this, "inputs")
Outputs outputs = Outputs(this, "outputs")
Public Attributes inherited from warpos::App
clockwerk::DataIO< bool > active = clockwerk::DataIO<bool>(this, "active", true)
 The active flag for the task – set to true by default.

Protected Member Functions

int16 start () override
int16 execute () override
Protected Member Functions inherited from clockwerk::GraphTreeObject
int16 _setStorage (GraphTreeObject **storage_array, uint8 storage_size)
 Getter for object's string address.
void _recalculateDescendants ()
 Function to recursively re-calculate the number of descendants of a given node on the tree.
void _recalculateRank ()
 Function to recursively re-calculate the rank of a given node on the tree.
int16 _addChild (GraphTreeObject *child)
 Function to decompose a string into a series of substrings via indexing.
int16 _removeChild (GraphTreeObject *child)
 Function to remove a child from the graph node's children.

Protected Attributes

PointingVectorMeasurements< inertial_nav::STATE_SIZE_measurements
 Reference variable to the internal Measurements.
EkfMeasurementUpdate< inertial_nav::STATE_SIZE, POINTING_MEASUREMENT_MEASUREMENT_VECTOR_ELEMENTS, POINTING_MEASUREMENT_OBSERVER_VECTOR_ELEMENTS_measUpdate
 Reference variable to the internal EkfMeasurementsUpdate.
std::array< floating_point, 3 > _dummy3
 Dummy temporary array for swapping between std::array and clockwerk::CartesianVector.
std::array< floating_point, 4 > _dummy4
inertial_nav::MagObsVector _dummyObs
inertial_nav::StateVector _state_input_array
 Temporary variables for the array input/outputs passed into the EkfMeasurementUpdate object.
inertial_nav::StateVector _state_output_array
inertial_nav::MagObsVector _state_observer_array
 Temporary variables for the array input/outputs passed into the EkfMeasurementUpdate object.
inertial_nav::MagMeasVector _measurement_array
 Temporary variables for the array input/outputs passed into the EkfMeasurementUpdate object.
inertial_nav::MagMeasVector _residual
clockwerk::CartesianVector< 3 > _expected_mag_vec__pI
 Internal variables for the transformed measurements.
clockwerk::CartesianVector< 3 > _mag_meas_vec__B
clockwerk::Quaternion _unit_quat
 Temporary variable for unitizing a quaternion.
tlm_gnc_mag_update_state _tlm_a_posteriori_state
 Packet to hold state after measurement incorporation.
clockwerk::Time _repeat_check_time
 Variables to verify we are not processing stale measurements.
clockwerk::CartesianVector< 3 > _repeat_check_meas
Protected Attributes inherited from warpos::App
FlightExecutiveexc
 Override our executive to include the FlightExecutive instead.
int16 _error = 0
 Internal variable to track and return error on app step through.
uint16 _apid = 0
 Internal variable to hold the APID for this app.
bool _is_started = false
 Flag indicating whether app has been started or not.
log_level_e _local_log_level = log_level_e::LOG_WARNING
 The log level for this particular app.
GraphTreeObject_app_children [MAXIMUM_APP_CHILDREN]
 Local storage for App children so it can live on the graph tree.
uint8 _instance
 Instance number of this app. Used to differentiate between multiple instances of the same app.
Protected Attributes inherited from clockwerk::GraphTreeObject
GraphTreeObject_parent = nullptr
GraphTreeObject ** _children_ptr = nullptr
uint32 _max_num_children = 0
uint16 _num_descendants = 0
char _name [MAXIMUM_NAME_CHARS] = ""
 String name for object.
uint8 _num_children = 0
 Number of direct children of the tree (not including the tree itself).
uint8 _rank = 0
int8 _graph_tree_type = BASE_GRAPH_TREE
 Variable to store graph tree object type.
bool _loggable = false
 Variable to indicate whether the selected object is loggable. Set to false by default.
uint32 _index = 0
 Index pointing to the next write location for the graph tree children.

Detailed Description

GNC App for performing the magnetometer measurement update step of an EKF when a 3-axis magnetometer is available to report the local magnetic field vector. This app implements the EKF measurement correction step by comparing the measured magnetic field in the magnetometer frame to the expected magnetic field derived from an internal model (e.g., WMM, IGRF, lookup table) and the current state estimate.

This update step is primarily used to improve the estimation of vehicle attitude, particularly in scenarios where gyroscope bias and drift can degrade the accuracy of dead-reckoning propagation. The method assumes that the magnetic field vector at the vehicle's location is known or can be reasonably approximated in a reference frame (e.g., ECEF or NED), and that the transformation between the magnetometer frame and the body frame is known.

Attention
See InertialNavigationDefinition.hpp for in depth description

TODO: Need to add params for magnetometer shapping ellipse or magnetometer bias

Author: James Tabony james.nosp@m..tab.nosp@m.ony@a.nosp@m.ttx..nosp@m.tech

Constructor & Destructor Documentation

◆ MagUpdate()

warpos::MagUpdate::MagUpdate ( FlightExecutive & executive)

◆ ~MagUpdate()

virtual warpos::MagUpdate::~MagUpdate ( )
inlinevirtual

Member Function Documentation

◆ activate()

int16 warpos::MagUpdate::activate ( )
overridevirtual

Activate the app. The app will step when active.

Returns
Flag indicating success/failure

Reimplemented from warpos::App.

◆ command()

int16 warpos::MagUpdate::command ( uint16 apid,
uint8 * buffer,
uint16 size )
overridevirtual

Process commands issued to the app.

Parameters
apidThe APID of the command sent
bufferPointer to the location of the buffer holding the command
sizeThe size of the command being sent
Returns
Flag indicating success/failure

Reimplemented from warpos::App.

◆ deactivate()

int16 warpos::MagUpdate::deactivate ( )
overridevirtual

Deactivate the app. The app will not step when deactivated.

Returns
Flag indicating success/failure

Reimplemented from warpos::App.

◆ execute()

int16 warpos::MagUpdate::execute ( )
overrideprotectedvirtual

Reimplemented from warpos::App.

◆ getResidual()

inertial_nav::MagMeasVector warpos::MagUpdate::getResidual ( )
inline

Getter function to grab the internal residual.

Returns
Measurement residual

◆ start()

int16 warpos::MagUpdate::start ( )
overrideprotectedvirtual

Reimplemented from warpos::App.

Member Data Documentation

◆ _dummy3

std::array<floating_point, 3> warpos::MagUpdate::_dummy3
protected

Dummy temporary array for swapping between std::array and clockwerk::CartesianVector.

◆ _dummy4

std::array<floating_point, 4> warpos::MagUpdate::_dummy4
protected

◆ _dummyObs

inertial_nav::MagObsVector warpos::MagUpdate::_dummyObs
protected

◆ _expected_mag_vec__pI

clockwerk::CartesianVector<3> warpos::MagUpdate::_expected_mag_vec__pI
protected

Internal variables for the transformed measurements.

◆ _mag_meas_vec__B

clockwerk::CartesianVector<3> warpos::MagUpdate::_mag_meas_vec__B
protected

◆ _measUpdate

Reference variable to the internal EkfMeasurementsUpdate.

◆ _measurement_array

inertial_nav::MagMeasVector warpos::MagUpdate::_measurement_array
protected

Temporary variables for the array input/outputs passed into the EkfMeasurementUpdate object.

◆ _measurements

PointingVectorMeasurements<inertial_nav::STATE_SIZE> warpos::MagUpdate::_measurements
protected

Reference variable to the internal Measurements.

◆ _repeat_check_meas

clockwerk::CartesianVector<3> warpos::MagUpdate::_repeat_check_meas
protected

◆ _repeat_check_time

clockwerk::Time warpos::MagUpdate::_repeat_check_time
protected

Variables to verify we are not processing stale measurements.

◆ _residual

inertial_nav::MagMeasVector warpos::MagUpdate::_residual
protected

◆ _state_input_array

inertial_nav::StateVector warpos::MagUpdate::_state_input_array
protected

Temporary variables for the array input/outputs passed into the EkfMeasurementUpdate object.

◆ _state_observer_array

inertial_nav::MagObsVector warpos::MagUpdate::_state_observer_array
protected

Temporary variables for the array input/outputs passed into the EkfMeasurementUpdate object.

◆ _state_output_array

inertial_nav::StateVector warpos::MagUpdate::_state_output_array
protected

◆ _tlm_a_posteriori_state

tlm_gnc_mag_update_state warpos::MagUpdate::_tlm_a_posteriori_state
protected

Packet to hold state after measurement incorporation.

◆ _unit_quat

clockwerk::Quaternion warpos::MagUpdate::_unit_quat
protected

Temporary variable for unitizing a quaternion.

◆ inputs

Inputs warpos::MagUpdate::inputs = Inputs(this, "inputs")

◆ outputs

Outputs warpos::MagUpdate::outputs = Outputs(this, "outputs")

◆ params

Params warpos::MagUpdate::params = Params(this, "params")

The documentation for this class was generated from the following files:
  • /Users/mickey/Documents/Projects/warptwin/warpos/src/apps/gnc/InertialNavigationEKF/MagUpdate.h
  • /Users/mickey/Documents/Projects/warptwin/warpos/src/apps/gnc/InertialNavigationEKF/MagUpdate.cpp