示例#1
0
    def _set_physics_client(self, render=0):
        if self.physicsClient_ID != -1:
            pybullet.disconnect(self.physicsClient_ID)
        self.physicsClient_ID = pybullet.connect(
            pybullet.GUI) if render else pybullet.connect(pybullet.DIRECT)

        # Load door
        pybullet.setAdditionalSearchPath(self.xml_path)
        pybullet.loadURDF(fileName="room_with_door.urdf",
                          basePosition=self.door_init_pos,
                          physicsClientId=self.physicsClient_ID)
        # flags=pybullet.URDF_USE_INERTIA_FROM_FILE | pybullet.URDF_USE_SELF_COLLISION | pybullet.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS)
        # Load humanoid
        #pybullet.loadURDF(fileName='humanoid.urdf', basePosition=self.robot_init_pos, physicsClientId=self.physicsClient_ID)
        # flags=pybullet.URDF_USE_INERTIA_FROM_FILE | pybullet.URDF_USE_SELF_COLLISION | pybullet.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS)
        pybullet.loadMJCF("mjcf/humanoid_symmetric.xml")
        #cubeId = pybullet.loadURDF("cube_small.urdf", 0, 0, 3)
        #cid = pybullet.createConstraint(cubeId, -1, -1, -1, p.JOINT_FIXED, [0, 0, 0], [0, 0, 0], [0, 0, 1])

        # Set and store  physics parameters
        pybullet.setDefaultContactERP(.90)
        pybullet.setGravity(0, 0, -0.981)
        pybullet.setPhysicsEngineParameter(
            fixedTimeStep=self.time_step * self.frame_skip,
            numSolverIterations=self.num_solver_iterations,
            numSubSteps=self.frame_skip)
示例#2
0
    def _set_physics_client(self, render=0):
        if self.physicsClient_ID != -1:
            pybullet.disconnect(self.physicsClient_ID)
        self.physicsClient_ID = pybullet.connect(
            pybullet.GUI) if render else pybullet.connect(pybullet.DIRECT)

        # Load door
        pybullet.setAdditionalSearchPath(self.xml_path)
        pybullet.loadURDF(
            fileName="room_with_door.urdf",
            basePosition=self.door_init_pos,
            physicsClientId=self.physicsClient_ID,
            flags=pybullet.URDF_USE_INERTIA_FROM_FILE
            | pybullet.URDF_USE_SELF_COLLISION
            | pybullet.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS)
        # Load humanoid
        pybullet.loadURDF(
            fileName='humanoid.urdf',
            basePosition=self.robot_init_pos,
            physicsClientId=self.physicsClient_ID,
            flags=pybullet.URDF_USE_INERTIA_FROM_FILE
            | pybullet.URDF_USE_SELF_COLLISION
            | pybullet.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS)

        # Set and store  physics parameters
        pybullet.setDefaultContactERP(.90)
        pybullet.setGravity(0, 0, -9.81)
        pybullet.setPhysicsEngineParameter(
            fixedTimeStep=self.time_step * self.frame_skip,
            numSolverIterations=self.num_solver_iterations,
            numSubSteps=self.frame_skip)
示例#3
0
 def clean_everything(self):
     #p.resetSimulation()
     p.setGravity(0, 0, -self.gravity)
     p.setDefaultContactERP(0.9)
     p.setPhysicsEngineParameter(fixedTimeStep=self.timestep *
                                 self.frame_skip,
                                 numSolverIterations=5,
                                 numSubSteps=self.frame_skip)
示例#4
0
	def clean_everything(self):
		#p.resetSimulation()
		p.setGravity(0, 0, -self.gravity)
		p.setDefaultContactERP(0.9)
		p.setPhysicsEngineParameter(fixedTimeStep=self.timestep*self.frame_skip, numSolverIterations=5, numSubSteps=self.frame_skip)