Differentiable Collision Detection for a Set of Convex Primitives