A Framework for Joint Grasp and Motion Planning in Confined Spaces