Skip to content

Fix ER-Force simulator dribbling physics and reported ball model - #3947

Draft
Andrewyx wants to merge 1 commit into
masterfrom
Andrewyx/erforce_sim_physics_fixes
Draft

Andrewyx wants to merge 1 commit into
masterfrom
Andrewyx/erforce_sim_physics_fixes

Conversation

@Andrewyx

@Andrewyx Andrewyx commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Description

WIP Claude Template

Our ER-Force simulator is a fork of robotics-erlangen/framework taken at upstream 73e139db (2021-12-16). This is the first of four stacked PRs that port what upstream has changed in their simulator since then (#3912).

A note on the approach, since it differs from what the issue describes: re-importing upstream wholesale would mean redoing our Qt removal (upstream is on Qt6 now), our synchronous stepSimulation API and our own ball model, and the payoff would be about 500 lines of simulator logic — almost all of upstream's work in the last 4.5 years went into Ra, strategy and tracking, which we don't vendor. So these PRs port the simulator changes onto our fork commit by commit instead, and record the sync point in the extlib README (last PR of the stack) so the next sync is a diff away.

This PR carries the changes that affect the simulator's default behaviour:

  • Perfect dribbler hold ball constraint (upstream ee58ccd0): the hinge between robot and ball becomes a point to point constraint plus a constraint that keeps a dribbling robot upright. Two robots duelling for the same ball used to flip each other over, and Simulator::resetFlipped then teleports a flipped robot off to the side of the field. All our simulated tests run with the perfect dribbler, so this was happening on the default path.
  • Quaternion component order in SimRobot::update and restoreState (upstream 5ae9dd8c). We read the separate angle field, so this only affects the rotation field of SimulatorState and restoring a saved simulator state.
  • Reported ball model: the geometry packet now advertises the ball model this simulator actually implements (ours replaced upstream's in Er Force simulator improved ball friction #2653/Tune Pass Speed with Pass Distance #2918), instead of ER-Force's values for their own model.

Testing Done

  • New er_force_simulator_test cases: two dribbling robots driven into the same ball stay upright and on the field, and the rotation in SimulatorState matches the robot's orientation. The duel test is a real regression guard: with the old hinge constraint both robots flip and end up teleported to y ≈ 3.19 m on a 6 m wide field, which I confirmed by reverting just that hunk.
  • bazel test over the CI software test set: 121/121 pass.
  • Simulated gameplay suite (//software/ai/hl/..., //software/ai/navigator/..., ball model test) and a 3 minute autoref'd AI vs AI game, run on the full stack.

Resolved Issues

Part of #3912

Length Justification and Key Files to Review

149 lines. Key file: src/extlibs/er_force_sim/src/amun/simulator/simrobot.cpp.

Review Checklist

  • Function & Class comments
  • Remove all commented out code
  • Remove extra print statements
  • Resolve all TODO's

Ports three upstream ER-Force fixes onto our fork (upstream 73e139db..38563d11):

- Perfect dribbler hold ball constraint (upstream ee58ccd0): the hinge between
  robot and ball is replaced by a point to point constraint plus a constraint
  that keeps the robot upright. Two robots duelling for the same ball used to
  flip each other over, and a flipped robot is teleported to the side of the
  field by Simulator::resetFlipped. Since all our simulated tests run with the
  perfect dribbler, this happened on the default path.
- Quaternion component order in SimRobot::update and restoreState
  (upstream 5ae9dd8c). We read the separate angle field, so this only affects
  the rotation field of SimulatorState and restoring a saved simulator state.
- The ball model reported in the geometry packet now describes the ball model
  this simulator actually implements, instead of the values ER-Force reports
  for their own model (ours was replaced in #2653/#2918).

Adds a test that drives two dribbling robots into the same ball and checks that
they stay upright and on the field, which fails without the first fix, and a
test for the rotation reported in SimulatorState.
@Andrewyx
Andrewyx force-pushed the Andrewyx/erforce_sim_physics_fixes branch from a296186 to 5403f40 Compare September 12, 2026 08:45
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.

1 participant