当前位置: 首页>>代码示例>>Python>>正文


Python pybullet_data.getDataPath函数代码示例

本文整理汇总了Python中pybullet_data.getDataPath函数的典型用法代码示例。如果您正苦于以下问题:Python getDataPath函数的具体用法?Python getDataPath怎么用?Python getDataPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getDataPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reset

  def reset(self, bullet_client):

    self._p = bullet_client
    #print("Created bullet_client with id=", self._p._client)
    if (self.doneLoading == 0):
      self.ordered_joints = []
      self.doneLoading = 1
      if self.self_collision:
        self.objects = self._p.loadMJCF(os.path.join(pybullet_data.getDataPath(), "mjcf",
                                                     self.model_xml),
                                        flags=pybullet.URDF_USE_SELF_COLLISION |
                                        pybullet.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS)
        self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(
            self._p, self.objects)
      else:
        self.objects = self._p.loadMJCF(
            os.path.join(pybullet_data.getDataPath(), "mjcf", self.model_xml))
        self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(
            self._p, self.objects)
    self.robot_specific_reset(self._p)

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

    return s
开发者ID:bulletphysics,项目名称:bullet3,代码行数:25,代码来源:robot_bases.py

示例2: reset

	def reset(self):
		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(
				p.loadURDF(os.path.join(pybullet_data.getDataPath(), self.model_urdf),
				basePosition=self.basePosition,
				baseOrientation=self.baseOrientation,
				useFixedBase=self.fixed_base,
				flags=p.URDF_USE_SELF_COLLISION))
		else:
			self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(
				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()

		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:AndrewMeadows,项目名称:bullet3,代码行数:25,代码来源:robot_bases.py

示例3: episode_restart

	def episode_restart(self):
		Scene.episode_restart(self)   # contains cpp_world.clean_everything()
		# 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(),"stadium_no_collision.sdf")
		self.stadium = p.loadSDF(filename)
		planeName = os.path.join(pybullet_data.getDataPath(),"mjcf/ground_plane.xml")
		
		self.ground_plane_mjcf = p.loadMJCF(planeName)
		for i in self.ground_plane_mjcf:
			p.changeVisualShape(i,-1,rgbaColor=[0,0,0,0])
开发者ID:Valentactive,项目名称:bullet3,代码行数:12,代码来源:scene_stadium.py

示例4: reset

	def reset(self):
		self.ordered_joints = []

		if self.self_collision:
			self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(
				p.loadMJCF(os.path.join(pybullet_data.getDataPath(),"mjcf", self.model_xml), flags=p.URDF_USE_SELF_COLLISION+p.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS))
		else:
			self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(
				p.loadMJCF(os.path.join(pybullet_data.getDataPath(),"mjcf", self.model_xml)))

		self.robot_specific_reset()

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

		return s
开发者ID:Valentactive,项目名称:bullet3,代码行数:15,代码来源:robot_bases.py

示例5: build_world

def build_world(args, enable_draw):
  arg_parser = build_arg_parser(args)
  print("enable_draw=", enable_draw)
  env = PyBulletDeepMimicEnv(arg_parser, enable_draw)
  world = RLWorld(env, arg_parser)
  #world.env.set_playback_speed(playback_speed)

  motion_file = arg_parser.parse_string("motion_file")
  print("motion_file=", motion_file)
  bodies = arg_parser.parse_ints("fall_contact_bodies")
  print("bodies=", bodies)
  int_output_path = arg_parser.parse_string("int_output_path")
  print("int_output_path=", int_output_path)
  agent_files = pybullet_data.getDataPath() + "/" + arg_parser.parse_string("agent_files")

  AGENT_TYPE_KEY = "AgentType"

  print("agent_file=", agent_files)
  with open(agent_files) as data_file:
    json_data = json.load(data_file)
    print("json_data=", json_data)
    assert AGENT_TYPE_KEY in json_data
    agent_type = json_data[AGENT_TYPE_KEY]
    print("agent_type=", agent_type)
    agent = PPOAgent(world, id, json_data)

    agent.set_enable_training(False)
    world.reset()
  return world
开发者ID:bulletphysics,项目名称:bullet3,代码行数:29,代码来源:testrl.py

示例6: __init__

  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:jiapei100,项目名称:bullet3,代码行数:33,代码来源:minitaur_ball_gym_env.py

示例7: __init__

 def __init__(self,
              urdfRoot=pybullet_data.getDataPath(),
              actionRepeat=50,
              isEnableSelfCollision=True,
              renders=True):
   print("init")
   self._timeStep = 0.01
   self._urdfRoot = urdfRoot
   self._actionRepeat = actionRepeat
   self._isEnableSelfCollision = isEnableSelfCollision
   self._observation = []
   self._envStepCounter = 0
   self._renders = renders
   self._p = p
   if self._renders:
     p.connect(p.GUI)
   else:
     p.connect(p.DIRECT)
   self._seed()
   self.reset()
   observationDim = len(self.getExtendedObservation())
   #print("observationDim")
   #print(observationDim)
   
   observation_high = np.array([np.finfo(np.float32).max] * observationDim)    
   self.action_space = spaces.Discrete(9)
   self.observation_space = spaces.Box(-observation_high, observation_high)
   self.viewer = None
开发者ID:Valentactive,项目名称:bullet3,代码行数:28,代码来源:simpleHumanoidGymEnv.py

示例8: __init__

  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:AndrewMeadows,项目名称:bullet3,代码行数:33,代码来源:minitaur_stand_gym_env.py

示例9: __init__

 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:AndrewMeadows,项目名称:bullet3,代码行数:25,代码来源:kuka.py

示例10: __init__

 def __init__(self,
              urdfRoot=pybullet_data.getDataPath(),
              actionRepeat=1,
              isEnableSelfCollision=True,
              renders=True):
   print("init")
   self._timeStep = 1./240.
   self._urdfRoot = urdfRoot
   self._actionRepeat = actionRepeat
   self._isEnableSelfCollision = isEnableSelfCollision
   self._observation = []
   self._envStepCounter = 0
   self._renders = renders
   self._width = 341
   self._height = 256
   self.terminated = 0
   self._p = p
   if self._renders:
     cid = p.connect(p.SHARED_MEMORY)
     if (cid<0):
        p.connect(p.GUI)
     p.resetDebugVisualizerCamera(1.3,180,-41,[0.52,-0.2,-0.33])
   else:
     p.connect(p.DIRECT)
   #timinglog = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS, "kukaTimings.json")
   self._seed()
   self.reset()
   observationDim = len(self.getExtendedObservation())
   #print("observationDim")
   #print(observationDim)
   
   observation_high = np.array([np.finfo(np.float32).max] * observationDim)    
   self.action_space = spaces.Discrete(7)
   self.observation_space = spaces.Box(low=0, high=255, shape=(self._height, self._width, 4))
   self.viewer = None
开发者ID:bingjeff,项目名称:bullet3,代码行数:35,代码来源:kukaCamGymEnv.py

示例11: get_cube

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:CGTGPY3G1,项目名称:bullet3,代码行数:7,代码来源:robot_locomotors.py

示例12: build_arg_parser

def build_arg_parser(args):
  arg_parser = ArgParser()
  arg_parser.load_args(args)

  arg_file = arg_parser.parse_string('arg_file', '')
  if (arg_file != ''):
    path = pybullet_data.getDataPath() + "/args/" + arg_file
    succ = arg_parser.load_file(path)
    Logger.print2(arg_file)
    assert succ, Logger.print2('Failed to load args from: ' + arg_file)
  return arg_parser
开发者ID:bulletphysics,项目名称:bullet3,代码行数:11,代码来源:testrl.py

示例13: test

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:AndrewMeadows,项目名称:bullet3,代码行数:11,代码来源:testMJCF.py

示例14: __init__

  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:bulletphysics,项目名称:bullet3,代码行数:15,代码来源:boxstack_pybullet_sim.py

示例15: episode_restart

	def episode_restart(self):
		
		Scene.episode_restart(self)   # 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(),"stadium_no_collision.sdf")
			self.ground_plane_mjcf = p.loadSDF(filename)
			
			for i in self.ground_plane_mjcf:
				p.changeDynamics(i,-1,lateralFriction=0.8, restitution=0.5)
				for j in range(p.getNumJoints(i)):
					p.changeDynamics(i,j,lateralFriction=0)
开发者ID:GaborPuhr,项目名称:bullet3,代码行数:16,代码来源:scene_stadium.py


注:本文中的pybullet_data.getDataPath函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。