Python pybullet.setAdditionalSearchPath() Examples

The following are 5 code examples of pybullet.setAdditionalSearchPath(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pybullet , or try the search function .
Example #1
Source File: balancebot_env.py    From balance-bot with MIT License 6 votes vote down vote up
def __init__(self, render=False):
        self._observation = []
        self.action_space = spaces.Discrete(9)
        self.observation_space = spaces.Box(np.array([-math.pi, -math.pi, -5]), 
                                            np.array([math.pi, math.pi, 5])) # pitch, gyro, com.sp.

        if (render):
            self.physicsClient = p.connect(p.GUI)
        else:
            self.physicsClient = p.connect(p.DIRECT)  # non-graphical version

        p.setAdditionalSearchPath(pybullet_data.getDataPath())  # used by loadURDF

        self._seed()
        
        # paramId = p.addUserDebugParameter("My Param", 0, 100, 50) 
Example #2
Source File: testMJCF.py    From soccer-matlab with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test(args):	
	p.connect(p.GUI)
	p.setAdditionalSearchPath(pybullet_data.getDataPath())
	fileName = os.path.join("mjcf", args.mjcf)
	print("fileName")
	print(fileName)
	p.loadMJCF(fileName)
	while (1):
		p.stepSimulation()
		p.getCameraImage(320,240)
		time.sleep(0.01) 
Example #3
Source File: renderer.py    From mvp_grasp with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, im_width, im_height, fov, near_plane, far_plane, DEBUG=False):
        self.im_width = im_width
        self.im_height = im_height
        self.fov = fov
        self.near_plane = near_plane
        self.far_plane = far_plane
        aspect = self.im_width/self.im_height
        self.pm = pb.computeProjectionMatrixFOV(fov, aspect, near_plane, far_plane)
        self.camera_pos = np.array([0, 0, 0.5])
        self.camera_rot = self._rotation_matrix([0, np.pi, 0])

        self.objects = []

        if DEBUG:
            self.cid = pb.connect(pb.GUI)
        else:
            self.cid = pb.connect(pb.DIRECT)

        pb.setAdditionalSearchPath(pybullet_data.getDataPath())

        pb.setGravity(0, 0, -10)
        self.draw_camera_pos()

        self._rendered = None
        self._rendered_pos = None
        self._rendered_rot = None 
Example #4
Source File: pepper_lasers.py    From qibullet with Apache License 2.0 5 votes vote down vote up
def main():
    simulation_manager = SimulationManager()
    client = simulation_manager.launchSimulation(gui=True)
    pepper = simulation_manager.spawnPepper(client, spawn_ground_plane=True)

    pybullet.setAdditionalSearchPath(pybullet_data.getDataPath())

    pybullet.loadURDF(
        "duck_vhacd.urdf",
        basePosition=[1, -1, 0.5],
        globalScaling=10.0,
        physicsClientId=client)

    pepper.showLaser(True)
    pepper.subscribeLaser()
    pepper.goToPosture("Stand", 0.6)

    while True:
        laser_list = pepper.getRightLaserValue()
        laser_list.extend(pepper.getFrontLaserValue())
        laser_list.extend(pepper.getLeftLaserValue())

        if all(laser == 5.6 for laser in laser_list):
            print("Nothing detected")
        else:
            print("Detected")
            pass 
Example #5
Source File: simulation_manager.py    From qibullet with Apache License 2.0 5 votes vote down vote up
def _spawnGroundPlane(self, physics_client):
        """
        INTERNAL METHOD, Loads a ground plane

        Parameters:
            physics_client - The id of the simulated instance in which the
            ground plane is supposed to be spawned
        """
        pybullet.setAdditionalSearchPath(pybullet_data.getDataPath())
        pybullet.loadMJCF(
            "mjcf/ground_plane.xml",
            physicsClientId=physics_client)