Differentiable simulation enables gradients to be back-propagated through physics simulations. In this way, one can learn the dynamics and properties of a physics system by gradient-based optimization or embed the whole differentiable simulation as a layer in a deep learning model for downstream tasks, such as planning and control. However, differentiable simulation at its current stage is not perfect and might provide wrong gradients that deteriorate its performance in learning tasks. In this paper, we study differentiable rigid-body simulation with contacts. We find that existing differentiable simulation methods provide inaccurate gradients when the contact normal direction is not fixed - a general situation when the contacts are between two moving objects. We propose to improve gradient computation by continuous collision detection and leverage the time-of-impact (TOI) to calculate the post-collision velocities. We demonstrate our proposed method, referred to as TOI-Velocity, on two optimal control problems. We show that with TOI-Velocity, we are able to learn an optimal control sequence that matches the analytical solution, while without TOI-Velocity, existing differentiable simulation methods fail to do so.
翻译:可微模拟能够使梯度通过物理模拟反向传播。通过这种方式,人们可以基于梯度优化学习物理系统的动力学和属性,或将整个可微模拟作为深度学习模型的一个层嵌入到规划与控制等下游任务中。然而,当前阶段的可微模拟尚不完善,可能提供错误的梯度,从而损害其在学习任务中的表现。本文研究了含接触的可微刚体模拟。我们发现,当接触法线方向不固定时——即两个运动物体之间发生接触的常见情形——现有可微模拟方法提供的梯度不准确。我们提出通过连续碰撞检测改进梯度计算,并利用碰撞时间(TOI)计算碰撞后的速度。我们将在两个最优控制问题上验证所提出的TOI-Velocity方法。实验表明,借助TOI-Velocity,我们能够学习到与解析解匹配的最优控制序列,而现有可微模拟方法在缺乏TOI-Velocity时无法实现这一目标。