ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
EkfRangeRangerateMeasUpdate.h
1/******************************************************************************
2* Copyright (c) ATTX LLC 2024. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, LLC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX, LLC.
15******************************************************************************/
16/*
17Simple PID header file
18
19Author: Alex Reynolds
20*/
21
22#ifndef GNC_NAVIGATION_EKF_EKF_RANGE_RANGERATE_MEAS_UPDATE_H
23#define GNC_NAVIGATION_EKF_EKF_RANGE_RANGERATE_MEAS_UPDATE_H
24
25#include "core/macros.h"
26#include "architecture/Tasks.h"
27#include "architecture/Time.h"
28#include "core/CartesianVector.hpp"
29
30#include "gnc/navigation/measurements/CalcRangeRangeRate.hpp"
31#include "gnc/navigation/measurements/CalcRangeRangeRateMatrix.hpp"
32#include "utils/RK4Integrator.hpp"
33#include "gnc/navigation/ekf/EkfMeasurementUpdate.hpp"
34
35namespace clockwerk {
36 /**
37 * @brief EKF Measurement Update with Range and Range Rate
38 *
39 * This function performs an EKF measurement update using provided
40 * range and range rate information and an associated timestamp. The
41 * task checks if the timestamp provided differs from previous
42 * timestamps and only performs an update if the timestamp is
43 * different.
44 *
45 * Output data includes the updated state and covariance as well
46 * as measurement residual and covariance information.
47 *
48 * Author: Alex Reynolds <alex.reynolds@attx.tech>
49 */
50 class EkfRangeRangerateMeasUpdate : public clockwerk::Task {
51 public:
52 // Model params
53 // NAME TYPE DEFAULT VALUE
55 /** The covariance in the range measurement which will be used to construct the R matrix*/
56 SIGNAL(range_covariance, double, 1.0e-10)
57 /** The covariance in the range rate measurement which will be used to construct the R matrix*/
58 SIGNAL(range_rate_covariance, double, 1.0e-10)
59 /** The maximum range residual beyond which measurements will not be processed */
60 SIGNAL(range_residual_filter, double, 1.0e10)
61 /** The maximum range rate residual beyond which measurements will not be processed */
64
65 // Model inputs
66 // NAME TYPE DEFAULT VALUE
68 /** The time stamp associated with the range and rangerate update */
69 SIGNAL(time_update, clockwerk::Time, clockwerk::Time())
70 /** The range measurement which will be used in state update */
71 SIGNAL(range, double, 0.0)
72 /** The range rate measurement which will be used in state update */
73 SIGNAL(range_rate, double, 0.0)
74 /** The position estimate for the object before measurement update */
76 /** The velocity estimate for the object before measurement update */
78 /** The covariance matrix for the object before measurement update */
80 /** The position of the observer relative to which measurement is taken */
82 /** The velocity of the observer relative to which measurement is taken */
85
86 // Model outputs
87 // NAME TYPE DEFAULT VALUE
89 /** Flag to indicate whether measurement was processed (true) or not (false) */
90 SIGNAL(meas_processed, int, false)
91 /** The position estimate for the object before measurement update */
93 /** The velocity estimate for the object before measurement update */
95 /** The covariance matrix for the object before measurement update */
97 /** The residual in measurements as [range, range rate] prior to measurement update */
99 /** The residual in measurements as [range, range rate] after measurement update */
101 /** The covariance of measurements prior to measurement update*/
103 /** The covariance of measurements after measurement update*/
106
107 // Model-specific implementations of startup and derivative
108 EkfRangeRangerateMeasUpdate();
109 EkfRangeRangerateMeasUpdate(clockwerk::Task &pnt, int schedule_slot=0, const std::string &m_name="ekf_range_rangerate");
110 EkfRangeRangerateMeasUpdate(clockwerk::Executive &e, int schedule_slot=0, const std::string &m_name="ekf_range_rangerate");
111 virtual ~EkfRangeRangerateMeasUpdate() {}
112 protected:
113 int start();
114 int execute();
115
116 // Measurement EKF functions and class
117 CalcRangeRangeRate<double> _measurement_fun;
118 CalcRangeRangeRateMatrix<double> _H_meas_fun;
121 RANGE_RANGERATE_OBSERVER_STATES> _ekf_meas_update;
122
123 // I/O to EKF
124 std::array<double, 6> _state_input;
125 std::array<double, 6> _observer_state;
126 std::array<double, 6> _state_output;
127 std::array<double, 2> _measurement;
128
129 // Measurement EKF variables
132
133 // Record of previous time
134 clockwerk::Time _prev_time;
135 };
136}
137
138#endif
#define RANGE_RANGERATE_MEASUREMENTS
Definition CalcRangeRangeRate.hpp:31
#define RANGE_RANGERATE_TARGET_STATES
Definition CalcRangeRangeRate.hpp:29
#define RANGE_RANGERATE_OBSERVER_STATES
Definition CalcRangeRangeRate.hpp:30
Definition CalcRangeRangeRateMatrix.hpp:30
Definition CalcRangeRangeRate.hpp:36
DataIO(GraphTreeObject *data_parent, std::string data_name, T initial_value)
Constructor for the DataIO object.
Definition DataIO.hpp:134
Generic, templated EKF measurement update class.
Definition EkfMeasurementUpdate.hpp:50
EKF Measurement Update with Range and Range Rate.
Definition EkfRangeRangerateMeasUpdate.h:50
int start()
Function to perform task startup activities (step once after creation)
Definition EkfRangeRangerateMeasUpdate.cpp:34
int execute()
Function to execute the task. All math and calculations should be here.
Definition EkfRangeRangerateMeasUpdate.cpp:42
Central control mechanism to run simulations and software.
Definition Executive.h:43
Matrix math implementation.
Definition Matrix.hpp:54
This is the base implementation of the task class.
Definition Tasks.h:68
Wrapper to manage and convert time as timespce.
Definition Time.h:45
Time()
Default, copy constructors and default destructor.
Definition Time.h:48
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition macros.h:87
#define Matrix6D
Definition macros.h:37
#define START_PARAMS
Definition macros.h:96
#define CartesianVector3D
Definition macros.h:54
#define END_OUTPUTS
Definition macros.h:90
#define END_PARAMS
Definition macros.h:98
#define CartesianVector2D
Definition macros.h:52
#define START_OUTPUTS
Definition macros.h:88
#define END_INPUTS
Definition macros.h:94
#define Matrix2D
Definition macros.h:32
#define START_INPUTS
Definition macros.h:92
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > vel_minus
Definition EkfRangeRangerateMeasUpdate.h:77
clockwerk::DataIO< clockwerk::Matrix< double, 6, 6 > > cov_minus
Definition EkfRangeRangerateMeasUpdate.h:79
clockwerk::DataIO< double > range_rate
Definition EkfRangeRangerateMeasUpdate.h:73
clockwerk::DataIO< double > range
Definition EkfRangeRangerateMeasUpdate.h:71
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > observer_pos
Definition EkfRangeRangerateMeasUpdate.h:81
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > observer_vel
Definition EkfRangeRangerateMeasUpdate.h:83
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos_minus
Definition EkfRangeRangerateMeasUpdate.h:75
clockwerk::DataIO< clockwerk::Time > time_update
Definition EkfRangeRangerateMeasUpdate.h:69
clockwerk::DataIO< clockwerk::CartesianVector< double, 2 > > meas_post_residual
Definition EkfRangeRangerateMeasUpdate.h:100
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > vel_plus
Definition EkfRangeRangerateMeasUpdate.h:94
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos_plus
Definition EkfRangeRangerateMeasUpdate.h:92
clockwerk::DataIO< clockwerk::Matrix< double, 6, 6 > > cov_plus
Definition EkfRangeRangerateMeasUpdate.h:96
clockwerk::DataIO< clockwerk::Matrix< double, 2, 2 > > meas_post_covariance
Definition EkfRangeRangerateMeasUpdate.h:104
clockwerk::DataIO< int > meas_processed
Definition EkfRangeRangerateMeasUpdate.h:90
clockwerk::DataIO< clockwerk::CartesianVector< double, 2 > > meas_pre_residual
Definition EkfRangeRangerateMeasUpdate.h:98
clockwerk::DataIO< clockwerk::Matrix< double, 2, 2 > > meas_pre_covariance
Definition EkfRangeRangerateMeasUpdate.h:102
clockwerk::DataIO< double > range_residual_filter
Definition EkfRangeRangerateMeasUpdate.h:60
clockwerk::DataIO< double > range_rate_covariance
Definition EkfRangeRangerateMeasUpdate.h:58
clockwerk::DataIO< double > range_covariance
Definition EkfRangeRangerateMeasUpdate.h:56
clockwerk::DataIO< double > range_rate_residual_filter
Definition EkfRangeRangerateMeasUpdate.h:62