Python pybullet_data.getDataPath() Examples
The following are 30
code examples of pybullet_data.getDataPath().
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_data
, or try the search function
.
Example #1
Source File: scene_stadium.py From soccer-matlab with BSD 2-Clause "Simplified" License | 6 votes |
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
Example #2
Source File: ant_env.py From midlevel-reps with MIT License | 6 votes |
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
Example #3
Source File: ant_env.py From midlevel-reps with MIT License | 6 votes |
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 self.visualid = -1 self.lastid = None 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.5, 0.2])
Example #4
Source File: husky_env.py From midlevel-reps with MIT License | 6 votes |
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
Example #5
Source File: __init__.py From real_robots with MIT License | 6 votes |
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)
Example #6
Source File: boxstack_pybullet_sim.py From soccer-matlab with BSD 2-Clause "Simplified" License | 6 votes |
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)
Example #7
Source File: balancebot_env.py From balance-bot with MIT License | 6 votes |
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 #8
Source File: kuka.py From soccer-matlab with BSD 2-Clause "Simplified" License | 6 votes |
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()
Example #9
Source File: simulation_manager.py From qibullet with Apache License 2.0 | 5 votes |
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)
Example #10
Source File: pepper_lasers.py From qibullet with Apache License 2.0 | 5 votes |
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 #11
Source File: scene_stadium.py From midlevel-reps with MIT License | 5 votes |
def __init__(self, robot, gravity, timestep, frame_skip, env=None): Scene.__init__(self, gravity, timestep, frame_skip, env) 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: pos, orn = p.getBasePositionAndOrientation(i) p.resetBasePositionAndOrientation(i, [pos[0], pos[1], pos[2] - 0.005], orn) for i in self.ground_plane_mjcf: p.changeVisualShape(i, -1, rgbaColor=[1, 1, 1, 0.5]) self.scene_obj_list = self.stadium
Example #12
Source File: kuka.py From robotics-rl-srl with MIT License | 5 votes |
def __init__(self, urdf_root_path=pybullet_data.getDataPath(), timestep=0.01, use_inverse_kinematics=True, small_constraints=True): self.urdf_root_path = urdf_root_path self.timestep = timestep self.max_velocity = .35 self.max_force = 200. self.fingerA_force = 2 self.fingerB_force = 2.5 self.finger_tip_force = 2 self.use_inverse_kinematics = use_inverse_kinematics self.use_simulation = True self.use_null_space = False self.use_orientation = True self.kuka_end_effector_index = 6 self.kuka_gripper_index = 8 # Finger A # 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.kuka_uid = None # affects the clipping of the end_effector_pos if small_constraints: self.min_x, self.max_x = 0.50, 0.65 self.min_y, self.max_y = -0.17, 0.22 self.min_z, self.max_z = 0, 0.5 else: self.min_x, self.max_x = 0.35, 0.65 self.min_y, self.max_y = -0.30, 0.30 self.min_z, self.max_z = 0, 0.5 self.reset()
Example #13
Source File: world_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 5 votes |
def get_ycb_objects_list(): obj_list = [dir for dir in os.listdir(ycb_objects.getDataPath()) if not dir.startswith('__') and not dir.endswith('.py')] return obj_list
Example #14
Source File: mobile_robots_env.py From midlevel-reps with MIT License | 5 votes |
def _flag_reposition(self): target_pos = self.robot.target_pos self.flag = None if self.gui and not self.config["display_ui"]: self.visual_flagId = 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.last_flagId = p.createMultiBody(baseVisualShapeIndex=self.visual_flagId, baseCollisionShapeIndex=-1, basePosition=[target_pos[0], target_pos[1], 0.5])
Example #15
Source File: world_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 5 votes |
def reset(self): p.loadURDF(os.path.join(pybullet_data.getDataPath(), "plane.urdf"), [0, 0, 0], physicsClientId=self._physics_client_id) # Load table and object self.table_id = p.loadURDF(os.path.join(pybullet_data.getDataPath(), "table/table.urdf"), basePosition=[0.85, 0.0, 0.0], useFixedBase=True, physicsClientId=self._physics_client_id) table_info = p.getCollisionShapeData(self.table_id, -1, physicsClientId=self._physics_client_id)[0] self._h_table = table_info[5][2] + table_info[3][2]/2 # set ws limit on z according to table height self._ws_lim[2][:] = [self._h_table, self._h_table + 0.3] self.load_object(self._obj_name)
Example #16
Source File: mobile_robots_env.py From midlevel-reps with MIT License | 5 votes |
def _flag_reposition(self): target_pos = self.robot.target_pos self.flag = None if self.gui and not self.config["display_ui"]: self.visual_flagId = 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.last_flagId = p.createMultiBody(baseVisualShapeIndex=self.visual_flagId, baseCollisionShapeIndex=-1, basePosition=[target_pos[0], target_pos[1], 0.5])
Example #17
Source File: husky_env.py From midlevel-reps with MIT License | 5 votes |
def __init__(self, config, gpu_count=0): #assert(self.config["envname"] == self.__class__.__name__ or self.config["envname"] == "TestEnv") self.config = self.parse_config(config) SemanticRobotEnv.__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 self.semantic_flagIds = [] debug_semantic = 1 if debug_semantic: for i in range(self.semantic_pos.shape[0]): pos = self.semantic_pos[i] pos[2] += 0.2 # make flag slight above object visualId = p.createVisualShape(p.GEOM_MESH, fileName=os.path.join(pybullet_data.getDataPath(), 'cube.obj'), meshScale=[0.1, 0.1, 0.1], rgbaColor=[1, 0, 0, 0.7]) flagId = p.createMultiBody(baseVisualShapeIndex=visualId, baseCollisionShapeIndex=-1, basePosition=pos) self.semantic_flagIds.append(flagId)
Example #18
Source File: world_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 5 votes |
def load_object(self, obj_name): # Load object. Randomize its start position if requested self._obj_name = obj_name self._obj_init_pose = self._sample_pose() self.obj_id = p.loadURDF(os.path.join(pybullet_data.getDataPath(), obj_name + ".urdf"), basePosition=self._obj_init_pose[:3], baseOrientation=self._obj_init_pose[3:7], flags=p.URDF_USE_MATERIAL_COLORS_FROM_MTL, physicsClientId=self._physics_client_id)
Example #19
Source File: husky_env.py From midlevel-reps with MIT License | 5 votes |
def _flag_reposition(self): target_pos = self.robot.target_pos self.flag = None if self.gui and not self.config["display_ui"]: self.visual_flagId = 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.last_flagId = p.createMultiBody(baseVisualShapeIndex=self.visual_flagId, baseCollisionShapeIndex=-1, basePosition=[target_pos[0], target_pos[1], 0.5])
Example #20
Source File: humanoid_env.py From midlevel-reps with MIT License | 5 votes |
def _flag_reposition(self): walk_target_x, walk_target_y, _ = self.robot.get_target_position() self.flag = None if self.gui and not self.config["display_ui"]: self.visual_flagId = 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]) self.last_flagId = p.createMultiBody(baseVisualShapeIndex=self.visual_flagId, baseCollisionShapeIndex=-1, basePosition=[walk_target_x, walk_target_y, 0.5])
Example #21
Source File: world_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 5 votes |
def load_object(self, obj_name): # Load object. Randomize its start position if requested self._obj_name = obj_name self._obj_init_pose = self._sample_pose() self.obj_id = p.loadURDF(os.path.join(ycb_objects.getDataPath(), obj_name, "model.urdf"), basePosition=self._obj_init_pose[:3], baseOrientation=self._obj_init_pose[3:7], physicsClientId=self._physics_client_id)
Example #22
Source File: world_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 5 votes |
def load_object(self, obj_name): # Load object. Randomize its start position if requested self._obj_name = obj_name self._obj_init_pose = self._sample_pose() self.obj_id = p.loadURDF(os.path.join(superquadric_objects.getDataPath(), obj_name, "model.urdf"), basePosition=self._obj_init_pose[:3], baseOrientation=self._obj_init_pose[3:7], physicsClientId=self._physics_client_id)
Example #23
Source File: ant_env.py From midlevel-reps with MIT License | 5 votes |
def _flag_reposition(self): walk_target_x = self.robot.get_position()[0] / self.robot.mjcf_scaling walk_target_y = self.robot.get_position()[1] / self.robot.mjcf_scaling self.flag = None if self.gui and not self.config["display_ui"]: self.visual_flagId = 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.last_flagId = p.createMultiBody(baseVisualShapeIndex=self.visual_flagId, baseCollisionShapeIndex=-1, basePosition=[walk_target_x, walk_target_y, 0.5])
Example #24
Source File: minitaur_stand_gym_env.py From soccer-matlab with BSD 2-Clause "Simplified" License | 5 votes |
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)
Example #25
Source File: testMJCF.py From soccer-matlab with BSD 2-Clause "Simplified" License | 5 votes |
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 #26
Source File: racecarGymEnv.py From soccer-matlab with BSD 2-Clause "Simplified" License | 5 votes |
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
Example #27
Source File: racecarZEDGymEnv.py From soccer-matlab with BSD 2-Clause "Simplified" License | 5 votes |
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
Example #28
Source File: robot_locomotors.py From soccer-matlab with BSD 2-Clause "Simplified" License | 5 votes |
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)
Example #29
Source File: robot_locomotors.py From soccer-matlab with BSD 2-Clause "Simplified" License | 5 votes |
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)
Example #30
Source File: robot_bases.py From soccer-matlab with BSD 2-Clause "Simplified" License | 5 votes |
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