Learning to Control Safety-Critical Systems