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

Update osim.py #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion osim/env/osim.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import gym
import opensim
import random
from gym.utils import seeding

## OpenSim interface
# The amin purpose of this class is to provide wrap all
Expand Down Expand Up @@ -298,7 +299,8 @@ def is_done(self):

def __init__(self, visualize = True, integrator_accuracy = 5e-5):
self.osim_model = OsimModel(self.model_path, visualize, integrator_accuracy = integrator_accuracy)


self.seed()
# Create specs, action and observation spaces mocks for compatibility with OpenAI gym
self.spec = Spec()
self.spec.timestep_limit = self.time_limit
Expand All @@ -311,6 +313,10 @@ def __init__(self, visualize = True, integrator_accuracy = 5e-5):
self.action_space = convert_to_gym(self.action_space)
self.observation_space = convert_to_gym(self.observation_space)

def seed(self, seed=None):
self.np_random, seed = seeding.np_random(seed)
return [seed]

def get_state_desc(self):
return self.osim_model.get_state_desc()

Expand Down