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

Bugfix/128 force action desat reset #129

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

LorenzzoQM
Copy link
Contributor

Description

Closes #128

Action_desat was not reducing reaction wheels' momentum if called more than once in a row. This change forces a reset of the action_desat every time it is tasked, resulting in the expected behavior.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How should this pull request be reviewed?

  • By commit
  • All changes at once

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Passes Tests

  • Unit tests (General Environment only) pytest --cov bsk_rl/envs/general_satellite_tasking --cov-report term-missing tests/unittest
  • Integrated tests (General Environment only) pytest --cov bsk_rl/envs/general_satellite_tasking --cov-report term-missing tests/integration
  • Examples (General Environment only) pytest tests/examples

Test Configuration

  • Python: 3.11.6
  • Basilisk: 2.2.2
  • Platform: MacOs 14.4.1

Checklist:

  • My code follows the style guidelines of this project (passes Black, ruff, and isort)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Commit messages are atomic, are in the form Issue #XXX: Message and have a useful message
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@LorenzzoQM LorenzzoQM requested a review from Mark2000 April 23, 2024 21:26
@@ -126,7 +129,7 @@ def __init__(
super().__init__(*args, **kwargs)
setattr(self, fsw_action + "_duration", action_duration)

def act(self, prev_action_key=None) -> str:
def act(self, prev_action_key=None, always_reset=always_reset) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

Does always_reset need to be an argument here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't. I agree that it is better to remove it from there.

env.step(0)
current_speeds = env.satellite.dynamics.wheel_speeds
assert np.linalg.norm(current_speeds) < np.linalg.norm(init_speeds)
init_speeds = current_speeds
Copy link
Contributor

Choose a reason for hiding this comment

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

Good test!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

@LorenzzoQM LorenzzoQM force-pushed the bugfix/128_force_action_desat_reset branch from fb0e04f to 00fd0cb Compare April 24, 2024 17:09
@LorenzzoQM LorenzzoQM requested a review from Mark2000 April 24, 2024 17:10
Copy link
Contributor

@Mark2000 Mark2000 left a comment

Choose a reason for hiding this comment

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

lgtm

@LorenzzoQM LorenzzoQM merged commit d49aa0e into develop Apr 24, 2024
4 checks passed
@LorenzzoQM LorenzzoQM deleted the bugfix/128_force_action_desat_reset branch April 24, 2024 17:37
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.

Action_desat doesn't work as expected if tasked more than once
2 participants