コード例 #1
0
def dump_body(body, fixed=False):
    print('Body id: {} | Name: {} | Rigid: {} | Fixed: {}'.format(
        body, get_body_name(body), is_rigid_body(body), is_fixed_base(body)))
    for joint in get_joints(body):
        if fixed or is_movable(body, joint):
            print(
                'Joint id: {} | Name: {} | Type: {} | Circular: {} | Limits: {}'
                .format(joint, get_joint_name(body, joint),
                        JOINT_TYPES[get_joint_type(body, joint)],
                        is_circular(body,
                                    joint), get_joint_limits(body, joint)))
    link = NULL_ID
    print('Link id: {} | Name: {} | Mass: {} | Collision: {} | Visual: {}'.
          format(link, get_base_name(body), get_mass(body),
                 len(get_collision_data(body, link)),
                 NULL_ID))  # len(get_visual_data(body, link))))
    for link in get_links(body):
        joint = parent_joint_from_link(link)
        joint_name = JOINT_TYPES[get_joint_type(body, joint)] if is_fixed(
            body, joint) else get_joint_name(body, joint)
        print(
            'Link id: {} | Name: {} | Joint: {} | Parent: {} | Mass: {} | Collision: {} | Visual: {}'
            .format(link, get_link_name(body, link), joint_name,
                    get_link_name(body, get_link_parent(body, link)),
                    get_mass(body, link), len(get_collision_data(body, link)),
                    NULL_ID))  # len(get_visual_data(body, link))))
コード例 #2
0
def clone_collision_shape(body, link, client=None):
    from pybullet_planning.interfaces.env_manager.shape_creation import get_collision_data
    client = get_client(client)
    collision_data = get_collision_data(body, link)
    if not collision_data:
        return NULL_ID
    assert (len(collision_data) == 1)
    # TODO: can do CollisionArray
    return collision_shape_from_data(collision_data[0], body, link, client)
コード例 #3
0
ファイル: body.py プロジェクト: yijiangh/pybullet_planning
def vertices_from_link(body, link):
    from pybullet_planning.interfaces.env_manager.shape_creation import vertices_from_data
    # In local frame
    vertices = []
    # TODO: requires the viewer to be active
    #for data in get_visual_data(body, link):
    #    vertices.extend(vertices_from_data(data))
    # Pybullet creates multiple collision elements (with unknown_file) when noncovex
    for data in get_collision_data(body, link):
        vertices.extend(vertices_from_data(data))
    return vertices