def plan_picking_motion(robot, picking_frame, savelevel_picking_frame, start_configuration, attached_brick_mesh):
    """Returns a cartesian trajectory to pick an element.

    Parameters
    ----------
    robot : :class:`compas.robots.Robot`
    picking_frame : :class:`Frame`
    save_level_picking_frame : :class:`Frame`
    start_configuration : :class:`Configuration`
    attached_brick_mesh : :class:`AttachedCollisionMesh`

    Returns
    -------
    :class:`JointTrajectory`
    """

    # Calculate frames at tool0 and picking_configuration
    frames = [picking_frame, savelevel_picking_frame]
    frames_tool0 = robot.from_attached_tool_to_tool0(frames)

    picking_frame_tool0 = robot.from_attached_tool_to_tool0([picking_frame])[0]
    picking_configuration = robot.inverse_kinematics(picking_frame_tool0, start_configuration)

    picking_trajectory = robot.plan_cartesian_motion(frames_tool0,
                                                     picking_configuration,
                                                     max_step=0.01,
                                                     attached_collision_meshes=[attached_brick_mesh])
    return picking_trajectory