nicrusso7 / rex-gym

OpenAI Gym environments for an open-source quadruped robot (SpotMicro)
Apache License 2.0
973 stars 130 forks source link

Update rex_gym_env.py #13

Closed fgolemo closed 3 years ago

fgolemo commented 3 years ago

smol bugfix

nicrusso7 commented 3 years ago

The self._terrain_type = "plane" assignation is just a placeholder (otherwise this variable is None as no values are injected at the creation) before running the Reset step of the child class (that then will overwrite this var): https://github.com/nicrusso7/rex-gym/blob/82dea26bcd8896da06240bcc3abd4de5b4696430/rex_gym/envs/rex_gym_env.py#L272.

After this, the variable is reassigned https://github.com/nicrusso7/rex-gym/blob/82dea26bcd8896da06240bcc3abd4de5b4696430/rex_gym/envs/rex_gym_env.py#L273

With your patch you won't be able to use the --terrain flag.

fgolemo commented 3 years ago

Gotcha, sorry my mistake.

fgolemo commented 3 years ago

Oh but I just noticed something else: according to the gym specification, I think you shouldn't call self.reset() in the init function because it's standard that it's always called before the first loop (i.e. env = gym.make("xyz"); env.reset()).