Skip to content

move variable resettting to periodics #218

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

Merged
merged 2 commits into from
Apr 30, 2025

Conversation

LucienMorey
Copy link
Contributor

I think this technically fits the docs better for something that resets after every control cycle better than it only happening in teleop and auto. Maybe there is a case in which people don't want this to run in disabled but I cant think of what it might be off the top of my head. I can probably make a test for this calling do_periodics like in test_magicbot_feedback.py is there any value in making it more complicated to check that it does the bits in all modes? rather than just doing it on periodic?

@@ -729,6 +729,9 @@ def _do_periodics(self) -> None:
self.onException()
else:
setter(value)

for reset_dict, component in self._reset_components:
component.__dict__.update(reset_dict)

watchdog.addEpoch("@magicbot.feedback")

Copy link
Member

Choose a reason for hiding this comment

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

I probably should've written a test for this, but this PR as proposed reintroduces what I considered a bug: the will_reset_to attributes shouldn't reset before robotPeriodic is called, since it can be useful to observe its value there, e.g. for logging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved the thing after all periodics

@LucienMorey LucienMorey requested a review from auscompgeek April 28, 2025 13:11
@LucienMorey LucienMorey force-pushed the handle_resettables_in_test branch from 6e261f2 to d15cd42 Compare April 28, 2025 13:16
@auscompgeek auscompgeek merged commit bd2bf5e into robotpy:main Apr 30, 2025
18 checks passed
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.

2 participants