Conversation
…ces the rate if we get close to the budget end
jaagut
requested changes
Apr 12, 2026
| if self.gamestate is not None and not self.gamestate.penalized: | ||
| return False | ||
| #if we are close to our message budget, we dont want to continue publishing | ||
| if self.gamestate is not None and (self.gamestate.message_budget > 40): |
Member
There was a problem hiding this comment.
Please add reasoning about 40 and swapp > for <
| def reduce_rate(self): | ||
| self.rate = 1 | ||
| self.timer.cancel() | ||
| self.timer = self.node.create_timer(1 / self.rate, self.send_message, callback_group=MutuallyExclusiveCallbackGroup()) |
Member
There was a problem hiding this comment.
Please move this timer creation to a separate function, as this is duplicated from above.
| return transforms3d.euler.quat2euler([quaternion.w, quaternion.x, quaternion.y, quaternion.z]) | ||
|
|
||
| def reduce_rate(self): | ||
| self.rate = 1 |
Member
There was a problem hiding this comment.
Please add a self.logger.warning message about reducing the rate.
| @@ -52,6 +52,7 @@ def __init__(self): | |||
| self.rate: int = self.node.get_parameter("rate").value | |||
Member
There was a problem hiding this comment.
Please add a parameter reduced_rate and use that instead of hardcoded 1
| def send_message(self): | ||
|
|
||
| if not self.rate_is_reduced: | ||
| if self.gamestate is not None and self.gamestate.secs_remaining > 180 and (self.gamestate.message_budget / self.gamestate.secs_remaining) < 11.2: |
Member
There was a problem hiding this comment.
Please move this logic to a method should_reduce_rate(self, ...) -> bool
Please add some reasoning for the magic values.
Member
|
Also please address the failing code style checks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related issues
Checklist
pixi run build