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)
def get_sphere(x, y, z): body = p.loadURDF( os.path.join(pybullet_data.getDataPath(), "sphere2red.urdf"), x, y, z) part_name, _ = p.getBodyInfo(body, 0) part_name = part_name.decode("utf8") bodies = [body] return BodyPart(part_name, bodies, 0, -1)
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)
def get_sphere(_p, x, y, z): body = _p.loadURDF( os.path.join(os.path.join(os.path.dirname(__file__)), "assets/ball_blue.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)
def get_cube(_p, x, y, z): body = _p.loadURDF( os.path.join(os.path.join(os.path.dirname(__file__)), "assets/wall.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)
def get_object(bullet_client, object_file, x, y, z, roll=0, pitch=0, yaw=0): position = [x, y, z] orientation = bullet_client.getQuaternionFromEuler([roll, pitch, yaw]) body = bullet_client.loadURDF( fileName=os.path.join(pybullet_data.getDataPath(), object_file), basePosition=position, baseOrientation=orientation, useFixedBase=False, flags=bullet_client.URDF_USE_INERTIA_FROM_FILE) part_name, _ = bullet_client.getBodyInfo(body) part_name = part_name.decode("utf8") bodies = [body] return BodyPart(bullet_client, part_name, bodies, 0, -1)
from robot_bases import XmlBasedRobot, MJCFBasedRobot, URDFBasedRobot