Skip to content

team_com disallowed robots to send messages if not intended, and reduces the rate if we get close to the budget end#805

Draft
cleWu03 wants to merge 3 commits intomainfrom
team_com-message_budget-"emergency-stop"

Hidden character warning

The head ref may contain hidden characters: "team_com-message_budget-"emergency-stop""
Draft

team_com disallowed robots to send messages if not intended, and reduces the rate if we get close to the budget end#805
cleWu03 wants to merge 3 commits intomainfrom
team_com-message_budget-"emergency-stop"

Conversation

@cleWu03
Copy link
Copy Markdown
Contributor

@cleWu03 cleWu03 commented Apr 12, 2026

Summary

  • Reduce team com rate if we are getting close to the limit (defenition of "close" depends on the time resuming)
  • Stop sending team com msg if we are very close to the limit ("very close" = 40 msg left, so with delay we can still send 10 msg per robot)
  • NOT ready!!! for merge, we need to check effects on behavior first

Related issues

Checklist

  • Run pixi run build
  • Write documentation
  • Test on your machine
  • Test on the robot
  • Create issues for future work
  • Triage this PR and label it

…ces the rate if we get close to the budget end
@github-project-automation github-project-automation bot moved this to 🆕 New in Software Apr 12, 2026
@jaagut jaagut moved this from 🆕 New to 👀 In review in Software Apr 12, 2026
@jaagut jaagut moved this from 👀 In review to 🏗 In progress in Software Apr 12, 2026
@cleWu03 cleWu03 marked this pull request as draft April 12, 2026 13:36
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):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please move this logic to a method should_reduce_rate(self, ...) -> bool

Please add some reasoning for the magic values.

@jaagut
Copy link
Copy Markdown
Member

jaagut commented Apr 12, 2026

Also please address the failing code style checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

2 participants