add stadium
This commit is contained in:
parent
cbdb57768d
commit
b75f827af2
|
@ -24,7 +24,7 @@ class BuildingScene(Scene):
|
|||
collisionId = p.createCollisionShape(p.GEOM_MESH, fileName=filename, meshScale=original, flags=p.GEOM_FORCE_CONCAVE_TRIMESH)
|
||||
print(filename)
|
||||
#visualId = p.createVisualShape(p.GEOM_MESH, fileName=filename, meshScale=original, rgbaColor = [93/255.0,95/255.0, 96/255.0,0.75], specularColor=[0.4, 0.4, 0.4])
|
||||
boundaryUid = p.createMultiBody(baseCollisionShapeIndex = collisionId, baseVisualShapeIndex = 0)
|
||||
boundaryUid = p.createMultiBody(baseCollisionShapeIndex = collisionId, baseVisualShapeIndex = -1)
|
||||
#visualId = p.loadTexture(os.path.join(os.path.dirname(os.path.abspath(__file__)), "tex256.png"))
|
||||
#p.changeVisualShape(boundaryUid, -1, textureUniqueId=visualId)
|
||||
#self.building_obj = [collisionId]
|
||||
|
@ -39,7 +39,9 @@ class BuildingScene(Scene):
|
|||
#collisionId = p.createCollisionShape(p.GEOM_MESH, fileName=filename, meshScale=[1, 1, 1], flags=p.GEOM_FORCE_CONCAVE_TRIMESH)
|
||||
#p.changeVisualShape(boundaryUid, -1, textureUniqueId=visualId)
|
||||
#p.changeVisualShape(i,-1,rgbaColor=[93/255.0,95/255.0, 96/255.0,0.75], specularColor=[0.4, 0.4, 0.4])
|
||||
|
||||
|
||||
|
||||
class SinglePlayerBuildingScene(BuildingScene):
|
||||
multiplayer = False
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@ class StadiumScene(Scene):
|
|||
for i in self.ground_plane_mjcf:
|
||||
p.changeVisualShape(i,-1,rgbaColor=[0,0,0,0])
|
||||
|
||||
|
||||
|
||||
self.building_obj = self.stadium
|
||||
|
||||
|
||||
class SinglePlayerStadiumScene(StadiumScene):
|
||||
"This scene created by environment, to work in a way as if there was no concept of scene visible to user."
|
||||
multiplayer = False
|
||||
|
|
|
@ -56,7 +56,7 @@ class MJCFBaseEnv(gym.Env):
|
|||
self.set_window(-1, -1, 512, 512)
|
||||
else:
|
||||
self.physicsClientId = p.connect(p.DIRECT)
|
||||
|
||||
|
||||
def configure(self, args):
|
||||
self.robot.args = args
|
||||
def _seed(self, seed=None):
|
||||
|
@ -71,11 +71,20 @@ class MJCFBaseEnv(gym.Env):
|
|||
p.configureDebugVisualizer(p.COV_ENABLE_SHADOWS, 1)
|
||||
#p.configureDebugVisualizer(p.COV_ENABLE_RENDERING, 1)
|
||||
|
||||
SCENE = 'building'
|
||||
##TODO: move to config file
|
||||
|
||||
if self.scene is None:
|
||||
self.scene = self.create_single_player_scene()
|
||||
self.scene = self.create_single_player_scene(SCENE)
|
||||
if not self.scene.multiplayer:
|
||||
self.scene.episode_restart()
|
||||
|
||||
#visualid = p.createVisualShape(p.GEOM_MESH, fileName=os.path.join(pybullet_data.getDataPath(), 'cube.obj'),
|
||||
# meshScale=[0.3, 0.3, 0.3], rgbaColor=[1, 0, 0, 0.7])
|
||||
#physicsid = p.createMultiBody(baseVisualShapeIndex=visualid, baseCollisionShapeIndex=-1, basePosition=[0, 0, 2])
|
||||
#keep code here for reference
|
||||
|
||||
|
||||
self.robot.scene = self.scene
|
||||
|
||||
self.frame = 0
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
from realenv.core.physics.scene_building import SinglePlayerBuildingScene
|
||||
from realenv.core.physics.scene_stadium import SinglePlayerStadiumScene
|
||||
|
||||
from realenv.data.datasets import ViewDataSet3D, get_model_path, MAKE_VIDEO
|
||||
from realenv.core.render.show_3d2 import PCRenderer
|
||||
from realenv.envs.env_bases import MJCFBaseEnv
|
||||
|
@ -206,8 +208,14 @@ class SensorRobotEnv(MJCFBaseEnv):
|
|||
return top_k
|
||||
|
||||
|
||||
def create_single_player_scene(self):
|
||||
self.building_scene = SinglePlayerBuildingScene(gravity=9.8, timestep=self.timestep, frame_skip=self.frame_skip)
|
||||
def create_single_player_scene(self, scene = 'building'):
|
||||
if scene == 'building':
|
||||
self.building_scene = SinglePlayerBuildingScene(gravity=9.8, timestep=self.timestep, frame_skip=self.frame_skip)
|
||||
elif scene == 'stadium':
|
||||
self.building_scene = SinglePlayerStadiumScene(gravity=9.8, timestep=self.timestep, frame_skip=self.frame_skip)
|
||||
else:
|
||||
self.building_scene = None
|
||||
print("Scene not created")
|
||||
return self.building_scene
|
||||
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@ class HuskySensorEnv(HuskyEnv, SensorRobotEnv):
|
|||
SensorRobotEnv.__init__(self)
|
||||
self.nframe = 0
|
||||
|
||||
|
||||
|
||||
def _reset(self):
|
||||
obs = SensorRobotEnv._reset(self)
|
||||
self.nframe = 0
|
||||
|
|
Loading…
Reference in New Issue