Skip to content

Fix cartpole dynamics equations#594

Open
devshahofficial wants to merge 1 commit into
PufferAI:4.0from
devshahofficial:devshahofficial/fix-cartpole-dynamics
Open

Fix cartpole dynamics equations#594
devshahofficial wants to merge 1 commit into
PufferAI:4.0from
devshahofficial:devshahofficial/fix-cartpole-dynamics

Conversation

@devshahofficial

Copy link
Copy Markdown

Summary

  • Correct the cartpole dynamics equations for pole mass length and theta acceleration.
  • Add a C-level regression that compiles cartpole.h and validates c_step against the reference equations.

Root cause

polemass_length used total_mass + pole_mass instead of pole_mass * pole_length, and the theta acceleration denominator canceled total_mass instead of scaling by pole_mass / total_mass.

Validation

  • python -m pytest tests/test_cartpole_dynamics.py tests/test_import_performance.py -q

Ports the active fix for the 4.0 branch.

Fixes #447

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.

Incorrect cartpole dynamics

1 participant