Python pybullet.loadURDF() Examples
The following are 30
code examples of pybullet.loadURDF().
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: world_creation.py From assistive-gym with MIT License | 7 votes |
def init_jaco(self, print_joints=False): # Enable self collisions to prevent the arm from going through the torso if self.task == 'arm_manipulation': robot = p.loadURDF(os.path.join(self.directory, 'jaco', 'j2s7s300_gym_arm_manipulation.urdf'), useFixedBase=True, basePosition=[0, 0, 0], flags=p.URDF_USE_SELF_COLLISION, physicsClientId=self.id) # Disable collisions between the fingers and the tool for i in range(10, 16): p.setCollisionFilterPair(robot, robot, i, 9, 0, physicsClientId=self.id) else: robot = p.loadURDF(os.path.join(self.directory, 'jaco', 'j2s7s300_gym.urdf'), useFixedBase=True, basePosition=[0, 0, 0], flags=p.URDF_USE_SELF_COLLISION, physicsClientId=self.id) robot_arm_joint_indices = [1, 2, 3, 4, 5, 6, 7] if print_joints: self.print_joint_info(robot, show_fixed=True) # Initialize and position p.resetBasePositionAndOrientation(robot, [-2, -2, 0.975], [0, 0, 0, 1], physicsClientId=self.id) # Grab and enforce robot arm joint limits lower_limits, upper_limits = self.enforce_joint_limits(robot) return robot, lower_limits, upper_limits, robot_arm_joint_indices, robot_arm_joint_indices
Example #2
Source File: panda_ik_controller.py From robosuite with MIT License | 6 votes |
def setup_inverse_kinematics(self): """ This function is responsible for doing any setup for inverse kinematics. Inverse Kinematics maps end effector (EEF) poses to joint angles that are necessary to achieve those poses. """ # Set up a connection to the PyBullet simulator. p.connect(p.DIRECT) p.resetSimulation() # get paths to urdfs self.robot_urdf = pjoin( self.bullet_data_path, "panda_description/urdf/panda_arm.urdf" ) # load the urdfs self.ik_robot = p.loadURDF(self.robot_urdf, (0, 0, 0.9), useFixedBase=1) # Simulation will update as fast as it can in real time, instead of waiting for # step commands like in the non-realtime case. p.setRealTimeSimulation(1)
Example #3
Source File: blocks.py From costar_plan with Apache License 2.0 | 6 votes |
def _addTower(self, pos, blocks, urdf_dir): ''' Helper function that generats a tower containing listed blocks at the specific position ''' z = 0.025 ids = [] for block in blocks: urdf_filename = os.path.join( urdf_dir, self.model, self.block_urdf % block) obj_id = pb.loadURDF(urdf_filename) r = self._sampleRotation() block_pos = self._samplePos(pos[0], pos[1], z) pb.resetBasePositionAndOrientation( obj_id, block_pos, r) self.addObject("block", "%s_block" % block, obj_id) z += 0.05 ids.append(obj_id) return ids
Example #4
Source File: ringsalbert.py From costar_plan with Apache License 2.0 | 6 votes |
def _addTower(self, pos, blocks, urdf_dir): ''' Helper function that generats a tower containing listed blocks at the specific position ''' z = 0.025 ids = [] for block in blocks: urdf_filename = os.path.join( urdf_dir, self.model, self.block_urdf % block) obj_id = pb.loadURDF(urdf_filename) pb.resetBasePositionAndOrientation( obj_id, (pos[0], pos[1], z), (0, 0, 0, 1)) self.addObject("block", "%s_block" % block, obj_id) z += 0.05 ids.append(obj_id) return ids
Example #5
Source File: sorting.py From costar_plan with Apache License 2.0 | 6 votes |
def _setup(self): ''' Create the mug at a random position on the ground, handle facing roughly towards the robot. Robot's job is to grab and lift. ''' rospack = rospkg.RosPack() path = rospack.get_path('costar_simulation') urdf_dir = os.path.join(path, self.urdf_dir) tray_filename = os.path.join(urdf_dir, self.tray_dir, self.tray_urdf) red_filename = os.path.join(urdf_dir, self.model, self.red_urdf) blue_filename = os.path.join(urdf_dir, self.model, self.blue_urdf) for position in self.tray_poses: obj_id = pb.loadURDF(tray_filename) pb.resetBasePositionAndOrientation(obj_id, position, (0, 0, 0, 1)) self._add_balls(self.num_red, red_filename, "red") self._add_balls(self.num_blue, blue_filename, "blue")
Example #6
Source File: obstructions.py From costar_plan with Apache License 2.0 | 6 votes |
def _addTower(self, pos, blocks, urdf_dir): ''' Helper function that generats a tower containing listed blocks at the specific position ''' z = 0.025 ids = [] for block in blocks: urdf_filename = os.path.join( urdf_dir, self.model, self.block_urdf % block) obj_id = pb.loadURDF(urdf_filename) pb.resetBasePositionAndOrientation( obj_id, (pos[0], pos[1], z), (0, 0, 0, 1)) self.addObject("block", "%s_block" % block, obj_id) z += 0.05 ids.append(obj_id) return ids
Example #7
Source File: obstacles.py From costar_plan with Apache License 2.0 | 6 votes |
def _addTower(self, pos, blocks, urdf_dir): ''' Helper function that generats a tower containing listed blocks at the specific position ''' z = 0.025 ids = [] for block in blocks: urdf_filename = os.path.join( urdf_dir, self.model, self.block_urdf % block) obj_id = pb.loadURDF(urdf_filename) pb.resetBasePositionAndOrientation( obj_id, (pos[0], pos[1], z), (0, 0, 0, 1)) self.addObject("block", "%s_block" % block, obj_id) z += 0.05 ids.append(obj_id) return ids
Example #8
Source File: pose_env.py From tensor2robot with Apache License 2.0 | 6 votes |
def _setup(self): """Sets up the robot + tray + objects. """ pybullet.resetSimulation(physicsClientId=self.cid) pybullet.setPhysicsEngineParameter(numSolverIterations=150, physicsClientId=self.cid) # pybullet.setTimeStep(self._time_step, physicsClientId=self.cid) pybullet.setGravity(0, 0, -10, physicsClientId=self.cid) plane_path = os.path.join(self._urdf_root, 'plane.urdf') pybullet.loadURDF(plane_path, [0, 0, -1], physicsClientId=self.cid) table_path = os.path.join(self._urdf_root, 'table/table.urdf') pybullet.loadURDF(table_path, [0.0, 0.0, -.65], [0., 0., 0., 1.], physicsClientId=self.cid) # Load the target object duck_path = os.path.join(self._urdf_root, 'duck_vhacd.urdf') pos = [0]*3 orn = [0., 0., 0., 1.] self._target_uid = pybullet.loadURDF( duck_path, pos, orn, physicsClientId=self.cid)
Example #9
Source File: sorting2.py From costar_plan with Apache License 2.0 | 6 votes |
def _addTower(self, pos, blocks, urdf_dir): ''' Helper function that generats a tower containing listed blocks at the specific position ''' z = 0.025 ids = [] for block in blocks: urdf_filename = os.path.join( urdf_dir, self.model, self.block_urdf % block) obj_id = pb.loadURDF(urdf_filename) pb.resetBasePositionAndOrientation( obj_id, (pos[0], pos[1], z), (0, 0, 0, 1)) self.addObject("block", "%s_block" % block, obj_id) z += 0.05 ids.append(obj_id) return ids
Example #10
Source File: trays.py From costar_plan with Apache License 2.0 | 6 votes |
def _addTower(self, pos, blocks, urdf_dir): ''' Helper function that generats a tower containing listed blocks at the specific position ''' z = 0.025 ids = [] for block in blocks: urdf_filename = os.path.join( urdf_dir, self.model, self.block_urdf % block) obj_id = pb.loadURDF(urdf_filename) pb.resetBasePositionAndOrientation( obj_id, (pos[0], pos[1], z), (0, 0, 0, 1)) self.addObject("block", "%s_block" % block, obj_id) z += 0.05 ids.append(obj_id) return ids
Example #11
Source File: turtlebot.py From costar_plan with Apache License 2.0 | 6 votes |
def load(self): ''' This is an example of a function that allows you to load a robot from file based on command line arguments. It just needs to find the appropriate directory, use xacro to create a temporary robot urdf, and then load that urdf with PyBullet. ''' rospack = rospkg.RosPack() path = rospack.get_path('costar_simulation') filename = os.path.join(path, self.xacro_filename) urdf_filename = os.path.join(path, 'robot', self.urdf_filename) urdf = open(urdf_filename, "w") # Recompile the URDF to make sure it's up to date subprocess.call(['rosrun', 'xacro', 'xacro.py', filename], stdout=urdf) self.handle = pb.loadURDF(urdf_filename) self.grasp_idx = self.findGraspFrame() #self.loadKinematicsFromURDF(urdf_filename, "base_link") return self.handle
Example #12
Source File: iiwa_robotiq_3_finger.py From costar_plan with Apache License 2.0 | 6 votes |
def load(self): ''' This is an example of a function that allows you to load a robot from file based on command line arguments. It just needs to find the appropriate directory, use xacro to create a temporary robot urdf, and then load that urdf with PyBullet. ''' rospack = rospkg.RosPack() path = rospack.get_path('costar_simulation') filename = os.path.join(path, self.xacro_filename) urdf_filename = os.path.join(path, 'robot', self.urdf_filename) urdf = open(urdf_filename, "w") # Recompile the URDF to make sure it's up to date subprocess.call(['rosrun', 'xacro', 'xacro.py', filename], stdout=urdf) self.handle = pb.loadURDF(urdf_filename) return self.handle
Example #13
Source File: ur5_robotiq.py From costar_plan with Apache License 2.0 | 6 votes |
def load(self): ''' This is an example of a function that allows you to load a robot from file based on command line arguments. It just needs to find the appropriate directory, use xacro to create a temporary robot urdf, and then load that urdf with PyBullet. ''' rospack = rospkg.RosPack() path = rospack.get_path('costar_simulation') filename = os.path.join(path, self.xacro_filename) urdf_filename = os.path.join(path, 'robot', self.urdf_filename) urdf = open(urdf_filename, "w") # Recompile the URDF to make sure it's up to date subprocess.call(['rosrun', 'xacro', 'xacro.py', filename], stdout=urdf) self.handle = pb.loadURDF(urdf_filename) self.grasp_idx = self.findGraspFrame() self.loadKinematicsFromURDF(urdf_filename, "base_link") return self.handle
Example #14
Source File: widowx_controller.py From visual_foresight with MIT License | 6 votes |
def __init__(self, robot_name, print_debug, email_cred_file='', log_file='', control_rate=100, gripper_attached='default'): super(WidowXController, self).__init__(robot_name, print_debug, email_cred_file, log_file, control_rate, gripper_attached) self._redist_rate = rospy.Rate(50) self._arbotix = ArbotiX('/dev/ttyUSB0') assert self._arbotix.syncWrite(MAX_TORQUE_L, [[servo_id, 255, 0] for servo_id in SERVO_IDS]) != -1, "failure during servo configuring" assert self._arbotix.syncWrite(TORQUE_LIMIT, [[servo_id, 255, 0] for servo_id in SERVO_IDS]) != -1, "failure during servo configuring" self._joint_lock = Lock() self._angles, self._velocities = {}, {} rospy.Subscriber("/joint_states", JointState, self._joint_callback) time.sleep(1) self._joint_pubs = [rospy.Publisher('/{}/command'.format(name), Float64, queue_size=1) for name in JOINT_NAMES[:-1]] self._gripper_pub = rospy.Publisher('/gripper_prismatic_joint/command', Float64, queue_size=1) p.connect(p.DIRECT) widow_x_urdf = '/'.join(__file__.split('/')[:-1]) + '/widowx/widowx.urdf' self._armID = p.loadURDF(widow_x_urdf, useFixedBase=True) p.resetBasePositionAndOrientation(self._armID, [0, 0, 0], p.getQuaternionFromEuler([np.pi, np.pi, np.pi])) self._n_errors = 0
Example #15
Source File: sawyer_ik_controller.py From robosuite with MIT License | 6 votes |
def setup_inverse_kinematics(self): """ This function is responsible for doing any setup for inverse kinematics. Inverse Kinematics maps end effector (EEF) poses to joint angles that are necessary to achieve those poses. """ # Set up a connection to the PyBullet simulator. p.connect(p.DIRECT) p.resetSimulation() # get paths to urdfs self.robot_urdf = pjoin( self.bullet_data_path, "sawyer_description/urdf/sawyer_arm.urdf" ) # load the urdfs self.ik_robot = p.loadURDF(self.robot_urdf, (0, 0, 0.9), useFixedBase=1) # Simulation will update as fast as it can in real time, instead of waiting for # step commands like in the non-realtime case. p.setRealTimeSimulation(1)
Example #16
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 #17
Source File: kukaCamGymEnv.py From soccer-matlab with BSD 2-Clause "Simplified" License | 6 votes |
def _reset(self): self.terminated = 0 p.resetSimulation() p.setPhysicsEngineParameter(numSolverIterations=150) p.setTimeStep(self._timeStep) p.loadURDF(os.path.join(self._urdfRoot,"plane.urdf"),[0,0,-1]) p.loadURDF(os.path.join(self._urdfRoot,"table/table.urdf"), 0.5000000,0.00000,-.820000,0.000000,0.000000,0.0,1.0) xpos = 0.5 +0.2*random.random() ypos = 0 +0.25*random.random() ang = 3.1415925438*random.random() orn = p.getQuaternionFromEuler([0,0,ang]) self.blockUid =p.loadURDF(os.path.join(self._urdfRoot,"block.urdf"), xpos,ypos,-0.1,orn[0],orn[1],orn[2],orn[3]) p.setGravity(0,0,-10) self._kuka = kuka.Kuka(urdfRootPath=self._urdfRoot, timeStep=self._timeStep) self._envStepCounter = 0 p.stepSimulation() self._observation = self.getExtendedObservation() return np.array(self._observation)
Example #18
Source File: cartpole_bullet.py From soccer-matlab with BSD 2-Clause "Simplified" License | 6 votes |
def _reset(self): # print("-----------reset simulation---------------") p.resetSimulation() self.cartpole = p.loadURDF(os.path.join(pybullet_data.getDataPath(),"cartpole.urdf"),[0,0,0]) self.timeStep = 0.01 p.setJointMotorControl2(self.cartpole, 1, p.VELOCITY_CONTROL, force=0) p.setGravity(0,0, -10) p.setTimeStep(self.timeStep) p.setRealTimeSimulation(0) initialCartPos = self.np_random.uniform(low=-0.5, high=0.5, size=(1,)) initialAngle = self.np_random.uniform(low=-0.5, high=0.5, size=(1,)) p.resetJointState(self.cartpole, 1, initialAngle) p.resetJointState(self.cartpole, 0, initialCartPos) self.state = p.getJointState(self.cartpole, 1)[0:2] + p.getJointState(self.cartpole, 0)[0:2] return np.array(self.state)
Example #19
Source File: kukaGymEnv.py From soccer-matlab with BSD 2-Clause "Simplified" License | 6 votes |
def _reset(self): #print("KukaGymEnv _reset") self.terminated = 0 p.resetSimulation() p.setPhysicsEngineParameter(numSolverIterations=150) p.setTimeStep(self._timeStep) p.loadURDF(os.path.join(self._urdfRoot,"plane.urdf"),[0,0,-1]) p.loadURDF(os.path.join(self._urdfRoot,"table/table.urdf"), 0.5000000,0.00000,-.820000,0.000000,0.000000,0.0,1.0) xpos = 0.55 +0.12*random.random() ypos = 0 +0.2*random.random() ang = 3.14*0.5+3.1415925438*random.random() orn = p.getQuaternionFromEuler([0,0,ang]) self.blockUid =p.loadURDF(os.path.join(self._urdfRoot,"block.urdf"), xpos,ypos,-0.15,orn[0],orn[1],orn[2],orn[3]) p.setGravity(0,0,-10) self._kuka = kuka.Kuka(urdfRootPath=self._urdfRoot, timeStep=self._timeStep) self._envStepCounter = 0 p.stepSimulation() self._observation = self.getExtendedObservation() return np.array(self._observation)
Example #20
Source File: balancebot_env.py From balance-bot with MIT License | 6 votes |
def _reset(self): # reset is called once at initialization of simulation self.vt = 0 self.vd = 0 self.maxV = 24.6 # 235RPM = 24,609142453 rad/sec self._envStepCounter = 0 p.resetSimulation() p.setGravity(0,0,-10) # m/s^2 p.setTimeStep(0.01) # sec planeId = p.loadURDF("plane.urdf") cubeStartPos = [0,0,0.001] cubeStartOrientation = p.getQuaternionFromEuler([0,0,0]) path = os.path.abspath(os.path.dirname(__file__)) self.botId = p.loadURDF(os.path.join(path, "balancebot_simple.xml"), cubeStartPos, cubeStartOrientation) # you *have* to compute and return the observation from reset() self._observation = self._compute_observation() return np.array(self._observation)
Example #21
Source File: panda_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 5 votes |
def reset(self): # Load robot model flags = p.URDF_ENABLE_CACHED_GRAPHICS_SHAPES | p.URDF_USE_INERTIA_FROM_FILE self.robot_id = p.loadURDF(os.path.join(franka_panda.get_data_path(), "panda_model.urdf"), basePosition=self._base_position, useFixedBase=True, flags=flags, physicsClientId=self._physics_client_id) assert self.robot_id is not None, "Failed to load the panda model" # reset joints to home position num_joints = p.getNumJoints(self.robot_id, physicsClientId=self._physics_client_id) idx = 0 for i in range(num_joints): joint_info = p.getJointInfo(self.robot_id, i, physicsClientId=self._physics_client_id) joint_name = joint_info[1].decode("UTF-8") joint_type = joint_info[2] if joint_type is p.JOINT_REVOLUTE or joint_type is p.JOINT_PRISMATIC: assert joint_name in self.initial_positions.keys() self._joint_name_to_ids[joint_name] = i p.resetJointState(self.robot_id, i, self.initial_positions[joint_name], physicsClientId=self._physics_client_id) p.setJointMotorControl2(self.robot_id, i, p.POSITION_CONTROL, targetPosition=self.initial_positions[joint_name], positionGain=0.2, velocityGain=1.0, physicsClientId=self._physics_client_id) idx += 1 self.ll, self.ul, self.jr, self.rs = self.get_joint_ranges() if self._use_IK: self._home_hand_pose = [0.2, 0.0, 0.8, min(m.pi, max(-m.pi, m.pi)), min(m.pi, max(-m.pi, 0)), min(m.pi, max(-m.pi, 0))] self.apply_action(self._home_hand_pose) p.stepSimulation(physicsClientId=self._physics_client_id)
Example #22
Source File: jaco_robotiq.py From costar_plan with Apache License 2.0 | 5 votes |
def load(self): ''' This is an example of a function that allows you to load a robot from file based on command line arguments. It just needs to find the appropriate directory, use xacro to create a temporary robot urdf, and then load that urdf with PyBullet. ''' rospack = rospkg.RosPack() path = rospack.get_path('costar_simulation') filename = os.path.join(path, self.xacro_filename) urdf_filename = os.path.join(path, 'robot', self.urdf_filename) urdf = open(urdf_filename, "r") # urdf = # open("/home/albert/costar_ws/src/costar_plan/costar_simulation/robot/jaco_robot.urdf", # "r") # Recompile the URDF to make sure it's up to date # subprocess.call(['rosrun', 'xacro', 'xacro.py', filename], # stdout=urdf) self.handle = pb.loadURDF(urdf_filename) self.grasp_idx = self.findGraspFrame() self.loadKinematicsFromURDF(urdf_filename, "robot_root") return self.handle
Example #23
Source File: robot_bases.py From GtS with MIT License | 5 votes |
def _load_model(self): if self.model_type == "MJCF": self.robot_ids = p.loadMJCF(os.path.join(self.physics_model_dir, self.model_file), flags=p.URDF_USE_SELF_COLLISION+p.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS) if self.model_type == "URDF": self.robot_ids = (p.loadURDF(os.path.join(self.physics_model_dir, self.model_file), globalScaling = self.scale), ) self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(self.robot_ids)
Example #24
Source File: robot_bases.py From midlevel-reps with MIT License | 5 votes |
def _load_model(self): if self.model_type == "MJCF": self.robot_ids = p.loadMJCF(os.path.join(self.physics_model_dir, self.model_file), flags=p.URDF_USE_SELF_COLLISION+p.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS) if self.model_type == "URDF": self.robot_ids = (p.loadURDF(os.path.join(self.physics_model_dir, self.model_file), globalScaling = self.scale), ) self.parts, self.jdict, self.ordered_joints, self.robot_body = self.addToScene(self.robot_ids)
Example #25
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 #26
Source File: oranges.py From costar_plan with Apache License 2.0 | 5 votes |
def _setup(self): ''' Create the mug at a random position on the ground, handle facing roughly towards the robot. Robot's job is to grab and lift. ''' rospack = rospkg.RosPack() path = rospack.get_path('costar_simulation') urdf_dir = os.path.join(path, self.urdf_dir) tray_filename = os.path.join(urdf_dir, self.tray_dir, self.tray_urdf) for position in self.tray_poses: obj_id = pb.loadURDF(tray_filename) pb.resetBasePositionAndOrientation(obj_id, position, (0, 0, 0, 1))
Example #27
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 #28
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 #29
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 #30
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)