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时,现有的可微分模拟方法无法达成这一目标。