Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gym/zoo] Fix 'acrobot' and 'cartpole' envs not using wrong integrator. #719

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions python/gym_jiminy/envs/gym_jiminy/envs/acrobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ def _setup(self) -> None:
# Call base implementation
super()._setup()

# Increase stepper accuracy for time-continuous control
# Enforce fixed-timestep integrator.
# It ensures calling 'step' always takes the same amount of time.
engine_options = self.simulator.engine.get_options()
engine_options["stepper"]["solver"] = "runge_kutta_4"
engine_options["stepper"]["odeSolver"] = "runge_kutta_4"
engine_options["stepper"]["dtMax"] = CONTROL_DT
self.simulator.engine.set_options(engine_options)

Expand Down
2 changes: 1 addition & 1 deletion python/gym_jiminy/envs/gym_jiminy/envs/cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _setup(self) -> None:

# OpenAI Gym implementation uses euler explicit integration scheme
engine_options = self.simulator.engine.get_options()
engine_options["stepper"]["solver"] = "euler_explicit"
engine_options["stepper"]["odeSolver"] = "euler_explicit"
engine_options["stepper"]["dtMax"] = CONTROL_DT
self.simulator.engine.set_options(engine_options)

Expand Down