fixed some issues with SimpleReacher rendering

This commit is contained in:
ottofabian 2020-08-31 10:18:59 +02:00
parent 31156cec4d
commit 2ff850328b
2 changed files with 7 additions and 4 deletions

View File

@ -1,3 +1,5 @@
import os
import gym import gym
import numpy as np import numpy as np
from gym import spaces, utils from gym import spaces, utils
@ -6,7 +8,8 @@ from gym.utils import seeding
import matplotlib as mpl import matplotlib as mpl
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
mpl.use('Qt5Agg') # or can use 'TkAgg', whatever you have/prefer if not os.environ.get("DISPLAY", None):
mpl.use('Qt5Agg')
class SimpleReacherEnv(gym.Env, utils.EzPickle): class SimpleReacherEnv(gym.Env, utils.EzPickle):
@ -80,7 +83,7 @@ class SimpleReacherEnv(gym.Env, utils.EzPickle):
return np.clip(action, lb, ub) return np.clip(action, lb, ub)
def _get_obs(self): def _get_obs(self):
return [self._joint_angle, self._angle_velocity, self.end_effector - self._goal_pos, self._steps] return np.hstack([self._joint_angle, self._angle_velocity, self.end_effector - self._goal_pos, self._steps])
def _update_joints(self): def _update_joints(self):
""" """

View File

@ -2,5 +2,5 @@ from setuptools import setup
setup(name='alr_envs', setup(name='alr_envs',
version='0.0.1', version='0.0.1',
install_requires=['gym'] # And any other dependencies foo needs install_requires=['gym', 'PyQt5'] # And any other dependencies foo needs
) )