Example #1
0
    def _reset(self):
        if self.stateId >= 0:
            # print("restoreState self.stateId:",self.stateId)
            self._p.restoreState(self.stateId)

        r = MJCFBaseBulletEnv._reset(self)
        self._p.configureDebugVisualizer(pybullet.COV_ENABLE_RENDERING, 0)

        self.parts, self.jdict, self.ordered_joints, self.robot_body = self.robot.addToScene(
            self._p, self.stadium_scene.ground_plane_mjcf)
        self.ground_ids = set([(
            self.parts[f].bodies[self.parts[f].bodyIndex],
            self.parts[f].bodyPartIndex,
        ) for f in self.foot_ground_object_names])
        self._p.configureDebugVisualizer(pybullet.COV_ENABLE_RENDERING, 1)

        return r
Example #2
0
	def _reset(self):
		if (self.stateId>=0):
			self._p.restoreState(self.stateId)

		rr = MJCFBaseBulletEnv._reset(self)
		self.beakerCam = BeakerCam(self._p)
		
		if(THROWBALLS and self.stateId < 0):
			self.frames_since_ball_thrown = 0
			mass = .04
			visualShapeId = -1
			sphereRadius = 0.05
			useMaximalCoordinates = 0
			position = [0.3,0.3,0.2]
			colSphereId = self._p.createCollisionShape(p.GEOM_SPHERE,radius=sphereRadius)
			self.sphereUid = p.createMultiBody(mass,colSphereId,visualShapeId,position,useMaximalCoordinates=useMaximalCoordinates)
			self._throw_ball()

		if (self.stateId<0):
			self.stateId = self._p.saveState()

		return rr