[Communication] PR8: Modify Simulation and SimManager#220
[Communication] PR8: Modify Simulation and SimManager#220Joseph0120 wants to merge 2 commits intojoseph/communication_delay_PR7from
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 24 minutes and 22 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🧱 Stack PR · Part of stack (9 PRs total) Stack Structure:
|
There was a problem hiding this comment.
Code Review
This pull request updates the default simulation configuration to a new swarm-based scenario and implements a mailbox cleanup process in the EndSimulation method. Feedback indicates that clearing the mailbox only at the end of a simulation may be insufficient due to Unity's delayed destruction phase and manual resets, which could allow "zombie" messages to persist into subsequent runs. It is suggested to also clear the mailbox at the start of the simulation to guarantee a clean state.
| if (Mailbox.Instance != null) { | ||
| Mailbox.Instance.ClearPendingMessages(); | ||
| } |
There was a problem hiding this comment.
Clearing the mailbox in EndSimulation is a good step towards ensuring a clean state between runs. However, there are two scenarios where this might be insufficient:
- Manual Resets: If
ResetAndStartSimulationis called directly (e.g., from a UI button or external script),EndSimulationis bypassed, and the mailbox won't be cleared. - Destruction Phase Messages: Since
Destroy()in Unity is delayed until the end of the frame, any messages sent by agents during theirOnDestroyorOnDisablemethods will be added to the mailbox after this clear call. These "zombie" messages will then persist into the next simulation run, which is particularly problematic for simulations involving communication delays.
Consider moving or also adding the ClearPendingMessages() call to the beginning of StartSimulation() to ensure the mailbox is always empty right before new agents are initialized. This would provide a more robust guarantee of a clean state.
ca99e18 to
24b5957
Compare
0fe4232 to
dbe07cf
Compare
Files Added:
4_swarms_1_ucav.pbtxt
Files Modified:
SimManager.cs
Description:
In SimManager, now it makes sure that it clears pending message in mailbox every time.
Created new simple simulation case 4_swarms_1_ucav.pbtxt and set it to default.