當前位置: 首頁>>代碼示例>>Python>>正文


Python pybullet_data.getDataPath方法代碼示例

本文整理匯總了Python中pybullet_data.getDataPath方法的典型用法代碼示例。如果您正苦於以下問題:Python pybullet_data.getDataPath方法的具體用法?Python pybullet_data.getDataPath怎麽用?Python pybullet_data.getDataPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pybullet_data的用法示例。


在下文中一共展示了pybullet_data.getDataPath方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def __init__(self, urdfRootPath=pybullet_data.getDataPath(), timeStep=0.01):
    self.urdfRootPath = urdfRootPath
    self.timeStep = timeStep
    self.maxVelocity = .35
    self.maxForce = 200.
    self.fingerAForce = 2 
    self.fingerBForce = 2.5
    self.fingerTipForce = 2
    self.useInverseKinematics = 1
    self.useSimulation = 1
    self.useNullSpace =21
    self.useOrientation = 1
    self.kukaEndEffectorIndex = 6
    self.kukaGripperIndex = 7
    #lower limits for null space
    self.ll=[-.967,-2 ,-2.96,0.19,-2.96,-2.09,-3.05]
    #upper limits for null space
    self.ul=[.967,2 ,2.96,2.29,2.96,2.09,3.05]
    #joint ranges for null space
    self.jr=[5.8,4,5.8,4,5.8,4,6]
    #restposes for null space
    self.rp=[0,0,0,0.5*math.pi,0,-math.pi*0.5*0.66,0]
    #joint damping coefficents
    self.jd=[0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001,0.00001]
    self.reset() 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:27,代碼來源:kuka.py

示例2: episode_restart

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def episode_restart(self, bullet_client):
		self._p = bullet_client
		Scene.episode_restart(self, bullet_client)   # contains cpp_world.clean_everything()
		if (self.stadiumLoaded==0):
			self.stadiumLoaded=1
			
			# stadium_pose = cpp_household.Pose()
			# if self.zero_at_running_strip_start_line:
			#	 stadium_pose.set_xyz(27, 21, 0)  # see RUN_STARTLINE, RUN_RAD constants
			
			filename = os.path.join(pybullet_data.getDataPath(),"plane_stadium.sdf")
			self.ground_plane_mjcf=self._p.loadSDF(filename)
			#filename = os.path.join(pybullet_data.getDataPath(),"stadium_no_collision.sdf")
			#self.ground_plane_mjcf = self._p.loadSDF(filename)
			#	
			for i in self.ground_plane_mjcf:
				self._p.changeDynamics(i,-1,lateralFriction=0.8, restitution=0.5)
				self._p.changeVisualShape(i,-1,rgbaColor=[1,1,1,0.8])
				self._p.configureDebugVisualizer(pybullet.COV_ENABLE_PLANAR_REFLECTION,1)

			#	for j in range(p.getNumJoints(i)):
			#		self._p.changeDynamics(i,j,lateralFriction=0)
			#despite the name (stadium_no_collision), it DID have collision, so don't add duplicate ground 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:25,代碼來源:scene_stadium.py

示例3: __init__

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def __init__(self,
               pybullet_client,
               urdf_root= pybullet_data.getDataPath(),
               time_step=0.01):
    """Constructs an example simulation and reset it to the initial states.

    Args:
      pybullet_client: The instance of BulletClient to manage different
        simulations.
      urdf_root: The path to the urdf folder.
      time_step: The time step of the simulation.
    """
    self._pybullet_client = pybullet_client
    self._urdf_root = urdf_root
    self.m_actions_taken_since_reset=0
    self.time_step = time_step
    self.stateId = -1
    self.Reset(reload_urdf=True) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:20,代碼來源:boxstack_pybullet_sim.py

示例4: copy_over_data_into_pybullet

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def copy_over_data_into_pybullet(force_copy=False):
    """
    If the package specific data has not already
    been copied over into pybullet_data, then
    copy them over.
    """
    import pybullet_data

    pybullet_data_path = pybullet_data.getDataPath()
    is_data_absent = \
        "kuka_gripper_description" not in os.listdir(pybullet_data_path)
    if force_copy or is_data_absent:
        import shutil
        source_data_path = os.path.join(
                                getPackageDataPath(),
                                "kuka_gripper_description")
        target_data_path = os.path.join(
                                pybullet_data_path,
                                "kuka_gripper_description")
        print(
            "[REALRobot] Copying over data into pybullet_data_path."
            "This is a one time operation.")
        shutil.copytree(source_data_path, target_data_path) 
開發者ID:AIcrowd,項目名稱:real_robots,代碼行數:25,代碼來源:__init__.py

示例5: __init__

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def __init__(self, config, gpu_count=0):
        self.config = self.parse_config(config)
        assert(self.config["envname"] == self.__class__.__name__ or self.config["envname"] == "TestEnv")

        CameraRobotEnv.__init__(self, self.config, gpu_count, 
                                scene_type="building",
                                tracking_camera=tracking_camera)

        self.robot_introduce(Ant(self.config, env=self))
        self.scene_introduce()
        self.gui = self.config["mode"] == "gui"
        self.total_reward = 0
        self.total_frame = 0
        self.flag_timeout = 1

        if self.gui:
            self.visualid = p.createVisualShape(p.GEOM_MESH, fileName=os.path.join(pybullet_data.getDataPath(), 'cube.obj'), meshScale=[0.5, 0.5, 0.5], rgbaColor=[1, 0, 0, 0.7])
        self.lastid = None 
開發者ID:alexsax,項目名稱:midlevel-reps,代碼行數:20,代碼來源:ant_env.py

示例6: __init__

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def __init__(self, config, gpu_count=0):
        self.config = self.parse_config(config)
        print(self.config["envname"])
        assert(self.config["envname"] == self.__class__.__name__ or self.config["envname"] == "TestEnv")
        CameraRobotEnv.__init__(self, self.config, gpu_count, 
                                scene_type="building",
                                tracking_camera=tracking_camera)

        self.robot_introduce(Husky(self.config, env=self))
        self.scene_introduce()

        self.total_reward = 0
        self.total_frame = 0
        self.flag_timeout = 1
        self.visualid = -1
        self.lastid = None
        self.gui = self.config["mode"] == "gui"
        
        if self.gui:
            self.visualid = p.createVisualShape(p.GEOM_MESH, fileName=os.path.join(pybullet_data.getDataPath(), 'cube.obj'), meshScale=[0.2, 0.2, 0.2], rgbaColor=[1, 0, 0, 0.7])
        self.colisionid = p.createCollisionShape(p.GEOM_MESH, fileName=os.path.join(pybullet_data.getDataPath(), 'cube.obj'), meshScale=[0.2, 0.2, 0.2])

        self.lastid = None
        self.obstacle_dist = 100 
開發者ID:alexsax,項目名稱:midlevel-reps,代碼行數:26,代碼來源:husky_env.py

示例7: __init__

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
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) 
開發者ID:yconst,項目名稱:balance-bot,代碼行數:18,代碼來源:balancebot_env.py

示例8: __init__

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def __init__(self,
               urdf_root=pybullet_data.getDataPath(),
               self_collision_enabled=True,
               pd_control_enabled=False,
               leg_model_enabled=True,
               on_rack=False,
               render=False):
    """Initialize the minitaur and ball gym environment.

    Args:
      urdf_root: The path to the urdf data folder.
      self_collision_enabled: Whether to enable self collision in the sim.
      pd_control_enabled: Whether to use PD controller for each motor.
      leg_model_enabled: Whether to use a leg motor to reparameterize the action
        space.
      on_rack: Whether to place the minitaur on rack. This is only used to debug
        the walking gait. In this mode, the minitaur's base is hanged midair so
        that its walking gait is clearer to visualize.
      render: Whether to render the simulation.
    """
    super(MinitaurBallGymEnv, self).__init__(
        urdf_root=urdf_root,
        self_collision_enabled=self_collision_enabled,
        pd_control_enabled=pd_control_enabled,
        leg_model_enabled=leg_model_enabled,
        on_rack=on_rack,
        render=render)
    self._cam_dist = 2.0
    self._cam_yaw = -70
    self._cam_pitch = -30
    self.action_space = spaces.Box(np.array([-1]), np.array([1]))
    self.observation_space = spaces.Box(np.array([-math.pi, 0]),
                                        np.array([math.pi, 100])) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:35,代碼來源:minitaur_ball_gym_env.py

示例9: __init__

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def __init__(self,
               urdf_root=pybullet_data.getDataPath(),
               action_repeat=1,
               observation_noise_stdev=minitaur_gym_env.SENSOR_NOISE_STDDEV,
               self_collision_enabled=True,
               motor_velocity_limit=np.inf,
               pd_control_enabled=False,
               render=False):
    """Initialize the minitaur standing up gym environment.

    Args:
      urdf_root: The path to the urdf data folder.
      action_repeat: The number of simulation steps before actions are applied.
      observation_noise_stdev: The standard deviation of observation noise.
      self_collision_enabled: Whether to enable self collision in the sim.
      motor_velocity_limit: The velocity limit of each motor.
      pd_control_enabled: Whether to use PD controller for each motor.
      render: Whether to render the simulation.
    """
    super(MinitaurStandGymEnv, self).__init__(
        urdf_root=urdf_root,
        action_repeat=action_repeat,
        observation_noise_stdev=observation_noise_stdev,
        self_collision_enabled=self_collision_enabled,
        motor_velocity_limit=motor_velocity_limit,
        pd_control_enabled=pd_control_enabled,
        accurate_motor_model_enabled=True,
        motor_overheat_protection=True,
        render=render)
    # Set the action dimension to 1, and reset the action space.
    action_dim = 1
    action_high = np.array([self._action_bound] * action_dim)
    self.action_space = spaces.Box(-action_high, action_high) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:35,代碼來源:minitaur_stand_gym_env.py

示例10: test

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
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) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:13,代碼來源:testMJCF.py

示例11: __init__

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def __init__(self,
               urdfRoot=pybullet_data.getDataPath(),
               actionRepeat=50,
               isEnableSelfCollision=True,
               isDiscrete=False,
               renders=False):
    print("init")
    self._timeStep = 0.01
    self._urdfRoot = urdfRoot
    self._actionRepeat = actionRepeat
    self._isEnableSelfCollision = isEnableSelfCollision
    self._observation = []
    self._ballUniqueId = -1
    self._envStepCounter = 0
    self._renders = renders
    self._isDiscrete = isDiscrete
    if self._renders:
      self._p = bullet_client.BulletClient(
          connection_mode=pybullet.GUI)
    else:
      self._p = bullet_client.BulletClient()

    self._seed()
    #self.reset()
    observationDim = 2 #len(self.getExtendedObservation())
    #print("observationDim")
    #print(observationDim)
    # observation_high = np.array([np.finfo(np.float32).max] * observationDim)
    observation_high = np.ones(observationDim) * 1000 #np.inf
    if (isDiscrete):
      self.action_space = spaces.Discrete(9)
    else:
       action_dim = 2
       self._action_bound = 1
       action_high = np.array([self._action_bound] * action_dim)
       self.action_space = spaces.Box(-action_high, action_high)
    self.observation_space = spaces.Box(-observation_high, observation_high)
    self.viewer = None 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:40,代碼來源:racecarGymEnv.py

示例12: __init__

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def __init__(self,
               urdfRoot=pybullet_data.getDataPath(),
               actionRepeat=10,
               isEnableSelfCollision=True,
               isDiscrete=False,
               renders=True):
    print("init")
    self._timeStep = 0.01
    self._urdfRoot = urdfRoot
    self._actionRepeat = actionRepeat
    self._isEnableSelfCollision = isEnableSelfCollision
    self._ballUniqueId = -1
    self._envStepCounter = 0
    self._renders = renders
    self._width = 100
    self._height = 10

    self._isDiscrete = isDiscrete
    if self._renders:
      self._p = bullet_client.BulletClient(
          connection_mode=pybullet.GUI)
    else:
      self._p = bullet_client.BulletClient()

    self._seed()
    self.reset()
    observationDim = len(self.getExtendedObservation())
    #print("observationDim")
    #print(observationDim)

    observation_high = np.array([np.finfo(np.float32).max] * observationDim)
    if (isDiscrete):
      self.action_space = spaces.Discrete(9)
    else:
       action_dim = 2
       self._action_bound = 1
       action_high = np.array([self._action_bound] * action_dim)
       self.action_space = spaces.Box(-action_high, action_high)
    self.observation_space = spaces.Box(low=0, high=255, shape=(self._height, self._width, 4))

    self.viewer = None 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:43,代碼來源:racecarZEDGymEnv.py

示例13: get_cube

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def get_cube(_p, x, y, z):	
	body = _p.loadURDF(os.path.join(pybullet_data.getDataPath(),"cube_small.urdf"), [x, y, z])
	_p.changeDynamics(body,-1, mass=1.2)#match Roboschool
	part_name, _ = _p.getBodyInfo(body)
	part_name = part_name.decode("utf8")
	bodies = [body]
	return BodyPart(_p, part_name, bodies, 0, -1) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:9,代碼來源:robot_locomotors.py

示例14: get_sphere

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def get_sphere(_p, x, y, z):
	body = _p.loadURDF(os.path.join(pybullet_data.getDataPath(),"sphere2red_nocol.urdf"), [x, y, z])
	part_name, _ = _p.getBodyInfo(body)
	part_name = part_name.decode("utf8")
	bodies = [body]
	return BodyPart(_p, part_name, bodies, 0, -1) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:8,代碼來源:robot_locomotors.py

示例15: reset

# 需要導入模塊: import pybullet_data [as 別名]
# 或者: from pybullet_data import getDataPath [as 別名]
def reset(self, bullet_client):
		self._p = bullet_client
		self.ordered_joints = []

		print(os.path.join(os.path.dirname(__file__), "data", self.model_urdf))

		if self.self_collision:
			self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(self._p, 
				self._p.loadURDF(os.path.join(pybullet_data.getDataPath(), self.model_urdf),
				basePosition=self.basePosition,
				baseOrientation=self.baseOrientation,
				useFixedBase=self.fixed_base,
				flags=pybullet.URDF_USE_SELF_COLLISION))
		else:
			self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(self._p,
				self._p.loadURDF(os.path.join(pybullet_data.getDataPath(), self.model_urdf),
				basePosition=self.basePosition,
				baseOrientation=self.baseOrientation,
				useFixedBase=self.fixed_base))

		self.robot_specific_reset(self._p)

		s = self.calc_state()  # optimization: calc_state() can calculate something in self.* for calc_potential() to use
		self.potential = self.calc_potential()

		return s 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:28,代碼來源:robot_bases.py


注:本文中的pybullet_data.getDataPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。