Skip to content

Commit 4bbabf8

Browse files
author
tteil
committed
add ground knowledge outlier detection
pop and add to separate branch later
1 parent 8180b72 commit 4bbabf8

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

src/fswAlgorithms/attGuidance/flybyPoint/flybyPoint.cpp

+40
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ void FlybyPoint::UpdateState(uint64_t currentSimNanos)
4646
/*! If this is the first read, seed the algorithm with the solution */
4747
auto [r_BN_N, v_BN_N] = this->readRelativeState();
4848
if (this->firstRead){
49+
this->previousFilterPosition = r_BN_N;
50+
this->previousFilterVelocity = v_BN_N;
4951
this->computeFlybyParameters(r_BN_N, v_BN_N);
5052
this->computeRN(r_BN_N, v_BN_N);
5153
this->firstRead = false;
@@ -58,6 +60,8 @@ void FlybyPoint::UpdateState(uint64_t currentSimNanos)
5860

5961
/*! update lastFilterReadTime to current time and dt to zero */
6062
this->lastFilterReadTime = currentSimNanos;
63+
this->previousFilterPosition = r_BN_N;
64+
this->previousFilterVelocity = v_BN_N;
6165
this->dt = 0;
6266
}
6367
}
@@ -110,6 +114,14 @@ bool FlybyPoint::checkValidity(Eigen::Vector3d &r_BN_N, Eigen::Vector3d &v_BN_N)
110114
if (maxPredictedAcceleration > this->maxAcceleration && this->maxAcceleration > 0) {
111115
valid = false;
112116
}
117+
double deltaPositionNorm = (r_BN_N - (this->previousFilterPosition + this->dt*this->previousFilterVelocity)).norm();
118+
double deltaVelocityNorm = (v_BN_N - this->previousFilterVelocity).norm();
119+
if (deltaPositionNorm > this->positionKnowledgeSigma && this->positionKnowledgeSigma > 0) {
120+
valid = false;
121+
}
122+
if (deltaVelocityNorm > this->velocityKnowledgeSigma && this->velocityKnowledgeSigma > 0) {
123+
valid = false;
124+
}
113125

114126
return valid;
115127
}
@@ -232,3 +244,31 @@ double FlybyPoint::getMaximumRateThreshold() const {
232244
void FlybyPoint::setMaximumRateThreshold(double maxRateThreshold) {
233245
this->maxRate = maxRateThreshold;
234246
}
247+
248+
/*! Get the ground based positional knowledge standard deviation
249+
@return sigma
250+
*/
251+
double FlybyPoint::getPositionKnowledgeSigma() const {
252+
return this->positionKnowledgeSigma;
253+
}
254+
255+
/*! Set the ground based positional knowledge sigma
256+
@param sigma
257+
*/
258+
void FlybyPoint::setPositionKnowledgeSigma(double positionKnowledgeStd) {
259+
this->positionKnowledgeSigma = positionKnowledgeStd;
260+
}
261+
262+
/*! Get the ground based velocity knowledge standard deviation
263+
@return sigma
264+
*/
265+
double FlybyPoint::getVelocityKnowledgeSigma() const {
266+
return this->velocityKnowledgeSigma;
267+
}
268+
269+
/*! Set the ground based velocity knowledge sigma
270+
@param sigma
271+
*/
272+
void FlybyPoint::setVelocityKnowledgeSigma(double velocityKnowledgeStd) {
273+
this->velocityKnowledgeSigma = velocityKnowledgeStd;
274+
}

src/fswAlgorithms/attGuidance/flybyPoint/flybyPoint.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ class FlybyPoint: public SysModel {
5555
void setMaximumAccelerationThreshold(double maxAccelerationThreshold);
5656
double getMaximumRateThreshold() const;
5757
void setMaximumRateThreshold(double maxRateThreshold);
58+
double getPositionKnowledgeSigma() const;
59+
void setPositionKnowledgeSigma(double positionKnowledgeStd);
60+
double getVelocityKnowledgeSigma() const;
61+
void setVelocityKnowledgeSigma(double velocityKnowledgeStd);
5862

59-
ReadFunctor<NavTransMsgPayload> filterInMsg; //!< input msg relative position w.r.t. asteroid
63+
ReadFunctor<NavTransMsgPayload> filterInMsg; //!< input msg relative position w.r.t. asteroid
6064
ReadFunctor<EphemerisMsgPayload> asteroidEphemerisInMsg; //!< input asteroid ephemeris msg
6165
Message<AttRefMsgPayload> attRefOutMsg; //!< Attitude reference output message
6266

@@ -74,6 +78,10 @@ class FlybyPoint: public SysModel {
7478
double gamma0 = 0; //!< flight path angle of the spacecraft at time of read [rad]
7579
uint64_t lastFilterReadTime = 0; //!< time of last filter read
7680
Eigen::Matrix3d R0N; //!< inertial-to-reference DCM at time of read
81+
Eigen::Vector3d previousFilterPosition{}; //!< Last position used to create profile
82+
Eigen::Vector3d previousFilterVelocity{}; //!< Last velocity used to create profile
83+
double positionKnowledgeSigma = 0; //!< Last position used to create profile
84+
double velocityKnowledgeSigma = 0; //!< Last velocity used to create profile
7785

7886
};
7987

0 commit comments

Comments
 (0)