Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceed Covariance Norm #830

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Exceed Covariance Norm #830

wants to merge 15 commits into from

Conversation

samuelqian01
Copy link
Member

Modified Attitude_estimator ptest case and supporting files for a scenario that has been constructed (nothing written inside) for exceeding covariance norm. Added logic in attitude_estimator suite of files to trigger a reset when state field attitude_estimator_reset_persistance_reached becomes true (which triggers exceed_persistence), which could first be tested by manually triggering it in the ptest case but then adding the logic within attitude_estimator to trigger upon reaching some covariance.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…e field to trigger reset, added ptest case and am waiting to receive values to write the state field to trigger the reset
@@ -56,6 +56,7 @@ jobs:
!(python -m ptest runsim -c ptest/configs/hootl_speedup.json -t FailingEmptyCase -ni)
!(python -m ptest runsim -c ptest/configs/hootl_speedup.json -t FailingEmptySimCase -ni)
python -m ptest runsim -c ptest/configs/hootl.json -t AttitudeNoSunVectorsInitializationCase -ni
python -m ptest runsim -c ptest/configs/hootl.json -t AttitudePersistanceExceededCase - ni
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space -ni

@@ -217,7 +221,7 @@ void AttitudeEstimator::_execute()
gnc::attitude_estimator_reset(
_state, time_s, {0.0f, 0.0f, 0.0f, 1.0f});
}
else if (adcs_ssa_valid)
else if ((adcs_ssa_valid) || (exceed_persistance))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the logic we want? a comment explaining the logic/reasoning would be helpful here

Copy link
Member Author

@samuelqian01 samuelqian01 Oct 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a closer look at the code I realized I need to account for ssa valid vs invalid. In terms of what this does, I wanted to write something that would trigger attitude estimator reset if value is exceeded, but was unsure as to which reset it would be "gnc::attitude_estimator_reset(
_state, time_s, {0.0f, 0.0f, 0.0f, 1.0f});" or "gnc::attitude_estimator_reset(
_state, time_s, orbit_pos, b_body, adcs_ssa);"

@@ -0,0 +1,855 @@
#!/bin/bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think we need this file

@@ -43,6 +44,7 @@ AttitudeEstimator::AttitudeEstimator(StateFieldRegistry &registry)
attitude_estimator_reset_cmd_f("attitude_estimator.reset_cmd", Serializer<bool>()),
attitude_estimator_mag_flag_f("attitude_estimator.mag_flag", Serializer<bool>(), 1),
attitude_estimator_ignore_sun_vectors_f("attitude_estimator.ignore_sun_vectors", Serializer<bool>(), 1),
attitude_estimator_reset_persistance_reached("attitude_estimator.reset_persistance_reached", Serializer<bool>(), 0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why an eeprom save field value of zero here?

Comment on lines 204 to 230
/* The Current Frobenius Norm */

float fro_norm= lin::fro(lin::nans<lin::Vector3d>());

/* Make sure to set the attitude_estimator_reset_persistance_reached to false check this, this is the logic
that triggers the state field to allow for a reset of attitude_estimator. Once you exceed baseline frobenius norm
* 1000 (for the safety factor), trigger the persistance state field, accounting for SSA valid and invalid. */

if (fro_norm > 3.86e-7 * 1000 && !adcs_ssa_valid) {
attitude_estimator_reset_persistance_reached.set(true);
}

else if (fro_norm > 8.35e-10 * 1000 && adcs_ssa_valid) {
attitude_estimator_reset_persistance_reached.set(true);
}

auto const exceed_persistance = attitude_estimator_reset_persistance_reached.get();

/* One if statement for no ssa covariance and one if statement for ssa valid covariance */

if (!adcs_ssa_valid && exceed_persistance) {
gnc::attitude_estimator_reset(_state, time_s, {0.0f, 0.0f, 0.0f, 1.0f});
}
else if (adcs_ssa_valid && exceed_persistance) {
gnc::attitude_estimator_reset(_state, time_s, orbit_pos, b_body, adcs_ssa);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelqian01 samuelqian01 changed the title WIP Exceed Covariant Norm Exceed Covariant Norm Oct 16, 2021
@samuelqian01
Copy link
Member Author

Screen Shot 2021-10-16 at 6 08 34 PM

Screen Shot 2021-10-16 at 6 08 22 PM

We added persistence logic, created a writeable state field for the safety factor, and modified our ptest case to trigger the gnc::attitude_estimator_reset. The pictures above show the print statements we used to verify that a reset had occurred, and we tested by setting the safety factor extremely low to guarantee the triggering of exceed_persistance.

@samuelqian01 samuelqian01 changed the title Exceed Covariant Norm Exceed Covariance Norm Oct 17, 2021
@shihaocao
Copy link
Collaborator

We should close this PR as we unfortunately didn't have time to add this to the final FSW package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants