Skip to content

Fix/rsim teleport bug#109

Merged
energy-in-joles merged 9 commits intomainfrom
fix/rsim_teleport_bug
Feb 26, 2026
Merged

Fix/rsim teleport bug#109
energy-in-joles merged 9 commits intomainfrom
fix/rsim_teleport_bug

Conversation

@energy-in-joles
Copy link
Copy Markdown
Member

@energy-in-joles energy-in-joles commented Feb 25, 2026

fix rsim teleport bug that was causing the filters to go crazy. Essentialy teleporting the robots didn't step the simulator. For some reason, the _frame_to_observation method in StandardSSL has a cache that relies on self.steps incrementing. Hence, after teleporting, the frames we were pulling were stale because the steps didn't increment.

very long and confusing bug, fixed by a single line of code basically.

Also default filtering to False for now.

Also fixed grSim bug caused by mismatch between pre-bounds checked vision frames and post-bounds checked vision. This cause Kalman filters to build for robots that were out of bounds.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an RSim “teleport” issue where the first vision frame after reset_field could be stale, which in turn destabilizes downstream filtering. It also adds/adjusts tests and test setup code to better reflect the actual number of robots spawned in RSim.

Changes:

  • Adjusts RSIM frame gating logic to advance the environment step counter during wait_until_game_valid().
  • Tweaks PositionRefiner Kalman initialization logic to avoid filtering against missing “last frame” data for newly seen robot IDs.
  • Adds a new strategy-runner test for “first frame reflects teleports” and simplifies several motion-planning test reset_field() implementations.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
utama_core/run/game_gater.py Attempts to ensure RSIM observations refresh across teleports by bumping steps.
utama_core/data_processing/refiners/position.py Avoids Kalman filtering when a robot has no corresponding last-frame state.
utama_core/tests/strategy_runner/teleport_position_accuracy_test.py New regression tests asserting first-frame positions match teleports.
utama_core/tests/motion_planning/strategies/random_movement_strategy.py Makes expected-friendly-robot count check strict (==).
utama_core/tests/motion_planning/single_robot_static_obstacle_test.py Simplifies reset to only teleport the robots that exist in the scenario.
utama_core/tests/motion_planning/single_robot_moving_obstacle_test.py Simplifies reset to only teleport the robots that exist in the scenario.
utama_core/tests/motion_planning/random_movement_test.py Makes randomized starts reproducible; simplifies reset and ball placement.
utama_core/tests/motion_planning/multiple_robots_test.py Simplifies reset to only teleport robots used by the scenario.
Comments suppressed due to low confidence (1)

utama_core/tests/strategy_runner/teleport_position_accuracy_test.py:106

  • Leftover debug print("hello!") statements add noise to test output and can make CI logs harder to read. Please remove these prints (the asserts already provide useful failure context).
    print("hello!")
    assert passed, "Test episode did not complete."
    print("hello!")
    assert test_manager.first_frame_position is not None, f"Robot {robot_id} was never seen in the first game frame."

Copilot AI review requested due to automatic review settings February 26, 2026 11:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings February 26, 2026 12:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

utama_core/run/game_gater.py:34

  • The comment "Increment the step count to simulate time passing in the environment" is slightly misleading. The increment is primarily needed to invalidate the observation cache in StandardSSL._frame_to_observations, not to simulate time passing. Consider updating the comment to: "Increment the step count to invalidate the observation cache and get fresh data after teleporting".
                rsim_env.steps += 1  # Increment the step count to simulate time passing in the environment

fred-huang122
fred-huang122 previously approved these changes Feb 26, 2026
@energy-in-joles energy-in-joles merged commit db5f9fc into main Feb 26, 2026
2 checks passed
@energy-in-joles energy-in-joles deleted the fix/rsim_teleport_bug branch February 26, 2026 16:55
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.

3 participants