# Path: osim/env/utils/mygym.py
# def convert_to_gym(space):
#     return spaces.Box(np.array(space[0]), np.array(space[1]) )


import math
import numpy as np
import os
import gym
import opensim
import random
from .utils.mygym import convert_to_gym
        from envs.target import VTgtField
# - open a model
# - actuate
# - integrate
# - read the high level description of the state
# The objective, stop condition, and other gym-related
# methods are enclosed in the OsimEnv class
class OsimModel(object):
    # Initialize simulation
    stepsize = 0.01

    model = None
    state = None
    state0 = None
    joints = []
    bodies = []
    brain = None
    verbose = False
    istep = 0
    
    state_desc_istep = None
    prev_state_desc = None
    state_desc = None
    integrator_accuracy = None

    maxforces = []
    curforces = []

    def __init__(self, model_path, visualize, integrator_accuracy = 5e-5):
        self.integrator_accuracy = integrator_accuracy
        self.model = opensim.Model(model_path)

# Path: osim/env/utils/mygym.py
# def convert_to_gym(space):
#     return spaces.Box(np.array(space[0]), np.array(space[1]) )


# Path: osim/env/osim.py
import math
import numpy as np
import os
import gym
import opensim
import random
from .utils.mygym import convert_to_gym
        from envs.target import VTgtField

# - open a model
# - actuate
# - integrate
# - read the high level description of the state
# The objective, stop condition, and other gym-related
# methods are enclosed in the OsimEnv class
class OsimModel(object):
    # Initialize simulation
    stepsize = 0.01

    model = None
    state = None
    state0 = None
    joints = []
    bodies = []
    brain = None
    verbose = False
    istep = 0
    
    state_desc_istep = None
    prev_state_desc = None
    state_desc = None
    integrator_accuracy = None

    maxforces = []
    curforces = []

    def __init__(self, model_path, visualize, integrator_accuracy = 5e-5):
        self.integrator_accuracy = integrator_accuracy
        self.model = opensim.Model(model_path)

        self.model_state = self.model.initSystem()