Extending Lagrangian and Hamiltonian Neural Networks with Differentiable Contact Models
Authors: Yaofeng Desmond Zhong
Biswadip Dey
Amit Chakraborty
Venue: NeurIPS 2021 Poster (2021)
Keywords: Deep Model Learning
Physics-based Priors
Contact Models

Abstract: The incorporation of appropriate inductive bias plays a critical role in learning dynamics from data. A growing body of work has been exploring ways to enforce energy conservation in the learned dynamics by encoding Lagrangian or Hamiltonian dynamics into the neural network architecture. These existing approaches are based on differential equations, which do not allow discontinuity in the states and thereby limit the class of systems one can learn. However, in reality, most physical systems, such as legged robots and robotic manipulators, involve contacts and collisions, which introduce discontinuities in the states. In this paper, we introduce a differentiable contact model, which can capture contact mechanics: frictionless/frictional, as well as elastic/inelastic. This model can also accommodate inequality constraints, such as limits on the joint angles. The proposed contact model extends the scope of Lagrangian and Hamiltonian neural networks by allowing simultaneous learning of contact and system properties. We demonstrate this framework on a series of challenging 2D and 3D physical systems with different coefficients of restitution and friction. The learned dynamics can be used as a differentiable physics simulator for downstream gradient-based optimization tasks, such as planning and control.

Extending Lagrangian and Hamiltonian Neural Networks with Differentiable Contact Models
Yaofeng Desmond Zhongi, Biswadip Dey Amit Chakrabortyl
SSiemens Technology. Princeton, NJ 08536, USA.
Kyaofeng.zhone riswadip.dey amit. haat.cccarbbboryy@iieeeeeee com
Abstract
The incorporation of appropriate inductive bias plays critical role in learning dynamics from data. growing body of work has been exploring ways to enforce energy conservation in the learned dynamics by encoding Lagrangian or Hamil- tonian dynamics into the neural network architecture. These existing approaches are based on differential equations, which do not allow discontinuity in the states and thereby limit the class of systems one can learn. However, in reality, most physical systems, such as legged robots and robotic manipulators, involve contacts and collisions, which introduce discontinuities introduce a differentiable contact model, which can capture contact mechanies: frictionles/frrctiional, as well as clastic/inelastic. This model can also accommo- date inequality constraints, such limits the joint angles. The proposed contact model extends the scope of Lagrangian and Hamiltonian neural networks by allow- ing simultancous learning of contact and system properties. We demonstrate this framework on a series of challenging 2D and 3D physical systems with different coefficients of restitution and friction. The learned dynamics can be used differentiable physics simulator for downstream gradient-bare baaden optimization tasks, such as planning and control.
the states. this paper, we
Introduction
large class of real-world physical systems evolves a piecewise-continuuus manner. For example, while playing tennis, tennis balls collide with the ground and the rackets with high elasticity but follow smooth trajectories governed in between those collisions. The ability to walk/run depends heavily on the contacts between the legs and the ground. Unfavorable contact properties can significantly hinder this ability; for example, lack of friction makes it very difficult to walk on icy roads. Robotic manipulators and grippers also rely on contacts and collisions to perform their assigned tasks. These examples highlight the importance of contacts and collisions, which can be found everywhere.
Encoding energy conservation into the computation graph of neural network constitutes effective way to improve its data-efficiency and generalization performance in inferring the dynamics of a physical system from its trajectory data []] However, these energy mergy-conserrvng models assume the system trajectories to be smooth and governed by ordinary differential equations (ODE), they cannot model dynamics with contacts and collisions. On the other hand, another line of work, for example, interaction network (2). neural physics engine [3, and iterative neural projection 44] can model collisions and contacts and learn the associated properties. However, they are not ODE-based and hence cannot infer the continuous dynamics governing the smooth portion of the trajectories. A more recent work [5] has encoded discrete form of the Luler-Lagrange equation while learning
'Code available htt.aat...tttt.g......oo...o.sss
Video available at
35th Conference on Neural Information Processing Systems (NcurIPS 2021).

---

properties of frictionless 2D contacts. Learning of properties associated with frictional contacts and 3D contacts still remains a relatively underexplored topic in the literature.
In this work, we introduce a contact model that can handle frictional contacts both with or without elasticity as well as enforces meegy-coonservation during the smooth portions of the trajectories. The scope of mnergy-conserving neural networks are extended by the contact model. The contact model solves convex optimization problems calculate the jump in velocity during contact. In order to use this contact model in deep learning tasks, we build upon the recent progress on differentiating through convex optimization problems [ We demonstrate the performance of the differentiable contact model in learning coefficients of restitution and friction associated with variety of 2D and 3D contacts. In addition, we also demonstrate the framework as differentiable physics simulator and test it in downstream planning tasks.
1.1 Related Work
Neural Networks: In the last few years, an increasing volume of work has proposed neural network models to learn the underlying dynamics from data while enforcing energy conservation. This line of works leverage Lagrangian dynamics (-12) or Hamilto- nian dynamics [3416] to incorporate the physics prior of energy conservation into deep learning. Recently, Finzi et al. [17] show that using Cartesian coordinates and enforcing explicit constraints improve learning in both Lagrangian and Hamiltonian settings. To learn the underlying dynamics governed by an ODE, many of these prior works have used Neural ODE [8] which can learn an ODE from observed trajectories. However, real systems often exhibit non- non-smooth trajectories caused by sudden/abrupt changes in the velocity due to contacts and collisions. Although Neural ODE based approaches have recently been extended for learning dynamics with jump discontinuities [1 they cannot accommodate the physical constraints (e.g., maximum dissipation principle, neural networks,
non-negative normal force) associated with contacts. Among the
only [16] attempted to address contacts and collisions; to capture the elastic collision of a billiard ball, it manually reverses the momentum of the ball orthogonal to the contact surface. However, this specialized technique cannot be applied to frictional or inelastic contacts, or objects that can rotate.
Our contact model shares similarity with the contact model of MuJoCo [22 24). However, there are three differences: (1) our contact model handles clastic contacts while MuJoCo only focuses on inelastic contacts; (2) MuJoCo solves the convex optimization problem with generalization of the Projected Fauss-Seidel method while we leverage the open-source scs solver 25 to solve the optimization problem; (3) the dynamics in MuJoCo is described using generalized coordinates, while we use Cartesian coordinates, since it has been shown in previous work [17], the use of Cartesian coordinates improves the learning of system properties. Another category of contact models solve contact impulses by solving a linear complementarity problem (LCP) 26) Recently, a number of works (27/32) has proposed differentiable LCPs for downstream planning and control tasks. However, their performance on learning the contact properties has yet to be tested.
Contact Model:
Differentiable Simulation: The recent past has also witnessed a growing interest in differentiable physics simulation that can be used in many downstream tasks (e.g.. parameter estimation, planning, LCP formulation to learn contact impulses for perfectly inelastic contacts. DiffTaichi [35 focuses on material point method and only provides intuitively simple contact mechanisms. The support for partially elastic frictional contacts is yet to be provided. Geilinger et al. (36) differentiates through the dynamics solver analytically. Macklin et al. (37 develop compliant contact model and formulate an implicit time-stepping scheme for integrating the dynamics. Incremental Potential Contact (IPC) 40 uses a custom implicitly time-stepped solver to solve nonlinear intersection- -fee and inversion- free elastodynamies. However, it is not clear if unknown dynamics and contact properties can be learned using the implicit time-stepping scheme proposed in [37 40 NeuralSim [38] formulates a nonlinear complementarity problem learn contact impulses and then solves it using Projected Gauss-
and control) B3 38). Jiang et al. [39]
GradSim [41] uses a relaxed Coulomb model to learn contacts from video sequences. Le Lidec al. [42) propose a differentiable physics simulator that can handle conic friction and elasticity. They demonstrate its ability for system identification on a simple 2D system. Chen et al. 43 propose neural event functions to handle instantaneous changes in a continuous system and test it on frictionless bouncing balls. However, these prior differentiable simulation models do not focus on the energy aspect of the system and their performance on the prediction of system energy (of learned dynamics) has not been evaluated.

---

1.2 Contribution
The main contribution of this work is three-fold. First, by introducing a differentiable contact model, we extend the scope of Lagrangian/ Lagrangian/Hamilonian Hamiltonian iampteniin-inspiree deep learning methods from collision- free systems to more realistic systems with contact and collisions. Second, we demonstrate the simultaneous learning of system and contact properties in variety of physical systems by integrating the contact model with Constrained Lagrangian/Hanitoniaa neural networks (CLNN/CHNN), We show that the learned contact properties, i.e., coefficients of restitution and friction, are interpretable and match the ground truth with high accuracy. Finally, the learned contact model with CLNN/CHNN can be used to solve downstream gradient-based optimization tasks.
2 Preliminaries
2.1 Rigid body dynamics without contacts
Consider a rigid body system whose configuration at time is described by a set of coordinates x(t) := (x1 (t), xz()),.... (p.)),,...()).))) (t)).. Then the time evolution of this system can be expressed as the following second-order ODE,
X = hxx X; P:),,
(1)
where P. denote system properties, which may include inertia of objects M(x) and potential energy V(x). The vector valued function h can be derived from the laws of physics, e.g. Lagrangian/Hamil tonian dynamics. By introducing := xx Eqn. (I) can be written as the following first-order ODE
h(x, v...) gg(x, P.).
There are two popular choices for the coordinates x the generalized coordinates and the Cartesian coordinates. The generalized coordinates are usually chosen as a set of independent coordinates which implicitly enforces holonomic constraints (equality constraints, see Appendix for details) in the system. The Cartesian coordinates are in general not independent of each other, so that the holonomic constraints in the system must be enforced explicitly in the dynamics ( Although g is usually derived with generalized coordinates, this work uses Cartesian coordinates and explicit constraints [17] to demonstrate the results. The proposed contact model is independent of the choice of coordinates and g. We provide the expression of g used in this work in Appendix B.
2.2 Rigid body dynamics with contacts
In robotics tasks, the above assumption of no collision and contact no longer holds. For ex- ample, legged robots move around through re- peated collisions/contacss between the robot legs and the ground, and robot arms grasp ob- jects by making frictional contact with them. The difficulty of modeling these phenomena is that they essentially make the dynamics dis- continuous. For example, when ball hits the ground, its velocity changes from pointing downward to pointing upward in an infinites- imally small period of time, which can be modeled as an instantancous change in veloc- ity Av. In general, contacts, collisions, and joint limits can all be modeled in this way. Algorithm|] I shows the general procedure of modeling rigid body with contacts, where a jump in velocity is calculated by contact model whenever there exist active contacts.
Algorithm 1: Rigid Body Dynamics with Contact
Input:
te, t1,.... .....y (Xo, vo)
Sequence of time points
Initial condition at to
P. = (M(x), Vx)))
System properties
P. (p.ep)
Contact properties
g(x, v.P.)
First-order system dynamics
Initialize output trajectories T = { {Xx,, vo)}. for 0 -
(x++1) ODESolVe(g, vi), t,, fx+1)
Get active contacts c, (collision detection) if exist active contacts then
Av +
ContactModel (x41, CaPP.c.
Vi-i +- Vi+i + Av
T T
From simulation perspective, with known system properties, contact properties (coefficients of friction and restitution), and vector field g. the trajectory of the system can be simulated by Algo- rithm I From a learning perspective, we frame the problem learning unknown system and contact
3

---

properties from a given set of trajectories given a model prior of vector field In this case, we can parametrize the unknown system and contact properties (ps. Pt.) by neural networks and learnable parameters, predict trajectories by Algorithm [ and minimize the difference between the predicted and actual trajectories by backpropagation. This training scheme requires all operations in the forward pass (Algorithm I to be differentiable. There are two key parts in the forward pass the ODE solver module and the contact model. Operations in the ODE solver are in general differentiable, and Neural ODE [18] 44) provides a framework of backpropagating through ODE solvers with constant memory cost. In this work, we provide a differentiable contact model so that we can extend these previous works to learn rigid body dynamics with contacts.
3 A differentiable contact model
In this section, we introduce a differentiable contact model for learning rigid body dynamics with contacts. The proposed contact model solves post-contact velocities by solving contact impulses in two phases [45] a compression phase, starting from the first contact of objects till the maximum compression, and restitution phase, starting right after the compression phase till the separation of objects. We start by presenting the constraints imposed by frictional contacts.
3.1 Contact constraints
This work focuses types of contact frictional contact and limit constraint. For any conceptual frictional contact in a 3D contact space, the contact impulse f, E R3 must lie in the friction cone,
pefi.n Ren Pirg Vi,
where μn 2 0 is the coefficient of friction for conceptual contact i. In addition, the normal impulses must be non-negative, since objects can only push but not pull others:
fin 2 0, Vi.
(4)
For any limit constraint such as limit in joint angle or distance, the contact space essentially one dimensional and the constraints on contact impulses are only fin 2 This mathematically equivalent to setting up a 3D contact space like that in frictional contact and letting = 0 in Eqn.
3.2 Contact model in compression phase
The idea behind solving contact impulses during the compression phase is the maximum dissipation principle [46], which states that the compression impulses should maximize the rate of energy dissipation. Equivalently, the compression impulses end of the compression phase. This can be described by an optimization problem [4] 46 22 23 We
those that minimizes the kinetic energy at the
choose the following form, which is similar to the one used in Mujoco (2]24
Minimize f
(FE)TAfE + (TE)TVC
(5)
subject to
where fü denotes the impulses in compression phase, A is the inverse inertia in the contact space, and ve represents the velocity in the contact space before the compression phase. This formulation is an approximation the Signorini condition, please see [4] 24 for more details. A concise derivation
of (5) from the first principle is provided in Appendix C.
3.3 Contact model in restitution phase
Similarly, we
up optimization problem to solve for the contact impulses in the restitution phase Ez. We assume the restitution follows Poisson's 's hypothesis, where the normal components in fr equals those in fg scaled by the coefficient of restitution ep. We adopt Poisson's 's hypothesis
instead of the popular Newton's 's hypothesis used in prior works 2
27 35 16], because the latter
might result in unrealistic energy increase in certain systems discussion. We set up the following constraint:
48 Please see Appendix D for
f 2 Ep,i fi Vi.
(6)

---

We have inequality instead of equality here since we would like to compensate for existing penetration in the simulation. Since we simulate the rigid body system in discrete time steps, almost every time when a collision is detected, penetration has already occurred among the objects involved in that collision. Consider the case where the collision perfectly inelastic, i.e., COR ep = O, then the true normal impulse during restitution phase would be zero, which fails to fix existing unrealistic penetration. By setting up the constraint as in Eqn. (6) larger normal impulse is allowed to fix existing penetration. The optimization problem in the restitution phase is
Minimize fCz (E (vE) vv)
subject to
with ve* as the velocity in contact space after the compression phase and vO as the target velocity, used for fixing penetration. If there's no penetration, V 0. A detailed discussion of penetration compensation can be found in Appendix G. From the principle maximum dissipation, the equality in Eqn. (6) would hold for the solution when COR large and penetration small, thus respecting Poisson's ss hypothesis when penetration can be fixed naturally.
3.4 Differentiability
Solving optimization problems 5 and (7) for contact impulses allow us to calculate instantaneous velocity change to perform simulation (Algorithm D]. Moreover, we would like to back-propage pookppppa through the contact model to learn unknown propertics. fact, our proposed contact model is differentiable, thanks to recent progress differentiable convex optimization layers. Both problems (5) and 7 are convex optimization problems with convex quadratic objectives (we show that A is positive semi-definite in Appendix E) well as linear constraints and second-order cone constraints. We can then express our problems using disciplined parametrized programming (DPP) and set up these two problems differentiable layers using CvxpyLayers (6]. Thus, model is differentiable and can be used in dynamics and parameter learning as well as downstream tasks.
Experiments: dynamics and parameter learning
4.1 Simulated systems
To evaluate the proposed contact model, we simulate five different systems with contacts (Fig. [ and propose eight dynamics and parameter learning tasks based on these systems with different contact properties (Table []. Previous work has studied the bouncing point masses (Fig. ((a)) which is often referred to as billiards or bouncing balls [16 27 33). To make this task more challenging, we let the size of each object be different. We also propose the bouncing disks (Fig. [Tb)p where each disk can rotate. The 2-pendulum colliding with the ground has been used to study and analyze contact models more than three decades [49]. We make this task more challenging by studying a 3-Pendulum colliding with the ground (Fig. [(c) The gyroscope is 3D system that exhibits complex dynamics. gyroscope colliding with a wall (Fig. [(d) is a system where the normal contact impulse does not point towards the center of mass (c.o.m). and Newton's 's hypothesis might give unrealistic result with increased energy after collisions [48]. The rope (Fig. [(c) has also been studied in previous
works 2 4. Please refer to Appendix H for further details about these systems and the tasks.
(a)
(b)
(c)
(d)
(c)
Figure 1: Simulated systems with contact. From left to right: (a) bouncing point masses, (b) bouncing disks, (c) chained pendulums with ground, (d) gyroscope with wall, and (e) rope. The black lines in bouncing disks show the orientations of disks.
5

---

Table 1: Benchmark tasks. The columns D, E, max(C) denote dimension of the dynamics, number of equality constraints, and the maximum number of contacts that could be simultaneously active, respectively.
Same ep, for contacts
Conserve energy
Name
System
D
E
max(C)
Space
BP5-e
Bouncing point
10
0
8
2D
Y
Y
BP5
Bouncing point masses
2D
N
CP3-c
Chained pendulums w/ ground
3
1
2D
Y
Y
CP3
Chained pendulums w/ ground
3
1
2D
Y
N
BD5
Bouncing disks
30
15
8
2D
N
N
Rope
Rope
400
399
2D
Y
N
Gyro-e
Gyroscope w/ a wall
Y
Y
Gyro
Gyroscope w/ a wall
12
7
1
3D
Y
N
4.2 Dynamics and parameter learning experimental setup
For each simulated system, we jointly learn system and contact properties from trajectory data by extending CLNN/CHNN with the proposed contact model. Fig. shows the architecture.
Data: For each task, the training is generated by randomly sampling 800 collision-fiee initial conditions and then simulating the dynamics for 100 time steps. Since for some systems, there are very few data points in trajectory that involves collision, select small chunk containing consecutive time steps from each simulated trajectory such that the final training set contains 800 trajectories of length 5, where around half of the trajectories contain collisions and the other half collision-free. We also make sure that the initial state of these selected chunks collision-free. The evaluation and test set are generated in similar way with 100 trajectories, respectively.
Architecture and training details: the experiments, we assume the system properties, i.c., object inertia and potential energy, well as contact properties, i.e., coefficients of friction and restitution, are unknown and need to be learned from trajectory data. The system properties are parametrized in CLNN and CHNN [17]. As for contact properties, all coefficient of friction non-negative, so they are parametrized by scalar learnable parameters passed through ReLu function. As each coefficient of restitution lies in the interval of [0, 1). it is parametrized by learnable parameter passed through a hard sigmoid function. The predicted trajectories are generated by running Algorithm with parametrized system and contact properties. We RK4 the ODE solver in Neural ODE. We compute the L1 -orm of the difference between predicted and true trajectories, and use it as the loss function for training. The gradients are computed by differentiating through Algorithm [ and learnable parameters are updated using the Adam W optimizer [50 with a learning rate of 0.001.
Models: We implement two slightly different versions of the contact model. The first version, referred to as CM, set up optimization problems exactly as stated in (5) and (7). The second version, referred to CMr, adds diagonal positive regularization matrix R el to A in (5) and (7), such
(xo, vo).
ODESolve(CLNN)
(*, v) g(x, M. (x), VA, (x))
(x), v1)
(x) V1
ContactModel
(x).
ContactModel CM
ODESalve(CLNN)
ContactModel (x, v;Ma (x), .pl
(xe, v2)
(x)g v2)
(82
v' Av
ODESolv3iCLND
Loss
(Xr, Vr MXr, v
ContactModel
(KT,
L=
+||, v.ll.)
Figure 2: Dynamics and parameter learning schema of the CM-CD-CLNN model. Neural networks red. Predicted trajectories are generated using parametrized CM and CLNN. The difference between the true and predicted trajectories are minimized learn dynamics and parameters.
and learnable parameters are denoted in

---

that (A + R. is always positive definite, which ensures a unique global minimum in each problem These two versions are combined with CLNN and CHNN set up the following four neural network models: (i) CM-CI-CINNN, (ii) DMNCCD-CNNN, (iii) CMr-CI-CLNN, and (iv) CMr-CD-CHNN, The "CD" model names emphasizes that we assume that a collision detection module given.
Baselines: We also set up three baselines. In the first baseline, MLP-CD-CLNN, we calculate the instantaneous velocity change from multi-layer perceptron (MLP) instead of the proposed contact model. Our second baseline, IN-CP-CLNN, calculates velocity change from an interaction network (IN) without requiring a collision detection module, since IN has the ability to learn collisions and contact. IN requires system and contact properties as input. Here the "CP" in the model name emphasizes true contact properties are given and the system properties learned by CLNN are fed into IN. Our last baseline, IN-CP-SP: SP, is the original interaction network which has shown strong ability in predicting 2D rigid body trajectories without equality constraints, but haven't 't been tested on systems with equality constraints or 3D systems. The name emphasizes that true system and contact properties are known and are fed into IN. Also, the name indicates no collision detection module is needed in this baseline. To train these baseline models, we transform each trajectory into multiple one-step pairs, as has been done in IN (2). We also attempted to use the LCP formulation of contact model 27 as baseline. However, the implementation of gradient computation of the LCP function in 27 results in NaN in our examples. Please refer to Appendix for additional details. As the forward computation of LCP works as expected, we use LCP- -eneereedd training data to test the robustness of our model.
4.3 Dynamics and parameter learning results
Our implementation relies publicly available codebases including Pytorch [52], CHNN [7] Symplectic ODE-Net [14] and Neural ODE [18]. We handle training using Pytorch Lightning |33 for the purpose of reproducibility.
Prediction: We report the average relative I, error over the test trajectories of 7 models on tasks models beat baseline models. The performance difference between CLNN and CHNN is minor since their architectures are similar. In most tasks, CM outperforms CMr. In the BP5-c task, CM beats CMr by orders of magnitude. IN does not perform well even in BP5 tasks since our training set (3.2k one-step pairs) is much smaller than the dataset (1M one-step pairs) used in the IN paper. We also report average relative Lı errors along test trajectories of 50 time steps in Fig. 4 in order to show each model's s ability in long term prediction. We observe that our contact models CM and CMr outperform baselines in all tasks.
in Fig. 3 In all tasks,
Interpretable mass ratio: Without direct supervision on mass, deep learning algorithms are unlikely to recover the true mass, as pointed out in [1]. However, one can still inspect the ratio of learned mass values to see how well this physical property is learned. The mass ratio plays an important role in determining the motion of objects when they interact with each other, e.g., during colli- sions. In our BP5 task, CM-CD-CLNN learns the mass ratio [m2/m1, ma/ m. m4 m1, ms/mm = [2.0001, 6. 6.0036, 8.0014, 10.0024], which is very close to the true ratio [2, 6, 8, 10). In fact, our framework is able to accurately learn mass ratios across tasks (please see Appendix for details).
Interpretable contact properties: Table 2 shows the learned contact properties by our 4 models in tasks where the contact properties are the same for contacts. For all tasks, CM can learn contact
'hhe regularization is important for obtaining the inverse dynamics, as stated in 23 However, the unregu- larized one learns more accurate dynamics and contact propertics, shown in Fig. 4 and Table 2
10a
10-1
10-1
10-1
BP5-e
BP5
CP3-e
CP3
BDS
Rope
Gyro-e
Gyro IN-CP-SP(original IN)
CM-CD.CLNN
CM-CD-CHNN
CMI-CD-CLNN
CMr-CD-CHNN
MUP-CD-CLNN
IN-CP-CLNN
Figure 3: Trajectory relative error (log scale) with 95% confidence interval error bars. Each error averaged over 100 test trajectories of length 5.
7

---

Gyro-e
Relative error in states
10"2
10-1
0.2
0.2
0.4
0.2
0.4
BP5
CP3
Rape
Gyro
101
10
10"5
0.0
0.3
0.2
0.3
0.4
0.5
0.0
0.1
0.2
0.3
0.4
055
0.00
0.05
0.10
0.15
0.20
0.25
0.0
0.2
0.4
D.6
0.8
100
Tiime (6)
Time (5)
Time (S)
Timee (6)
CM-CD.CLNY
CM-CD.CHNN
CMM-CD-CLNN
CM-CDD-CHN
MLP-CD CLNN IN-CP.CLNN
IN-CP SPioriini
Figure 4: Relative error (log scale) along long test trajectories (50 times steps). Each curve is averaged over 100 test trajectories. Vertical dashed lines show the trajectory length during training.
Energy along tral.
BP5-0
CP3-c
Gyro-c
0.4
2.2
0.3
-1.7
-18-
0.1
0.1
0.3
0.2
0.4
0.2
0.5
16
(5)
CM
CM-CD-CHNN
CMr-CD CLNNC
CM-CD CHNN
MLP-CD-CLM
IN-CP-CUNN IN-CP-SP
Figure 5: Energy of the predicted trajectories of all 7 models on a sampled test initial condition from BP5-e, CP3-c and Gyro-e tasks. The true energy in each task is represented by the horizontal black line in the middle, which is constant along the trajecotry.
properties accurately which explains its good performance in prediction. CMr is an approximate model and does not infer contact properties as accurately as CM. The interpretability of the learned contact properties along with the mass ratio explains the performance of our framework and shows that the proposed contact model indeed extends Lagrangian and Hamiltonian neural networks.
The prior of Lagrangian/Hamiilonian dynamics conserve energy along each collision free trajectory, which one of the reason that Lagrangian/ Haaiiiiaaaaammiiiin--biiiiii perform better in prediction and generalization 77 14 I0.. Fig. 5 Jillustrates how the total energy changes over time for the predicted trajectories of models on tasks that conserve energy since the contacts are elastic and frictionless (i.e., ep = 1, 0). Models using CM perform the best in conserving energy in all three tasks since CM learns contact properties perfectly (Table (2). This demonstrates that the proposed contact model can uncover the energy conserving aspect even though energy conservation has been enforced explicitly. For CP3-e and Gyro-e systems, models using CMr lose energy each time collision happens since they learn positive coefficients of friction in these tasks (Table 2). The baseline models perform the worst terms of energy conservation.
Energy:
neural network models
Sample efficiency: We use the BP5 task to demonstrate the sample efficiency of this proposed framework. We vary the training sample size from 25 to 800 trajectories and report the validation loss (L, (norm) of CM-CD-CC CLNN, LLP-CD-CLNN, and Interaction Network. Figure shows that our framework works well even with limited training data.
Table 2: Learned contact properties from our 4 models on tasks that has unique contact properties for all contacts. Bold numbers the best learned contact properties in each task across models.
BP5-e
CP3-c
CP3
Rope
Gyro-e
Gyro
μ
ep
ep
ep
eP
μ
ep
ep
Ground Truth
0.000
1.000
0.000
1.000
0.500
0.000
0.000
0.000
0.000
1.000
0.100
0.800
CM-CD-CLNN
0.000
1.000
0.000
1.000
0.500
0.005
0.026
0.000
0.000
1.000
0.100
0.800
CM-CD-CHIP
0.000
1.000
0.000
1.000
0.500
0.004
0.017
0.000
0.000
1.000
0.100
0.800
CMr-CD-CLA CLNN
0.000
1.000
0.002
1.000
0.500
0.023
0.037
0.011
0.002
1.000
0.099
0.892
CMr-CD-CHNS
0.000
1.000
0.002
1.000
0.500
0.023
0.046
0.019
0.002
1.000
0.099
0.893

---

Scalability: In Table we report the average wall clock time in each iteration (forward pass and backward pass) during training of three sizes of ropes. The time scales approximately linearly with the numbers of coordinates (D) and contacts (C). See Appendix L. for additional results for scalability.
101
101
Number of training trajectories
We evaluate the robustness of our framework by training our model using data generated by LCP formulation and noisy data. (See Appendix for details.) When trained on LCP data, our framework can learn accurate contact properties in 2D tasks. For the 3D Gyro tasks, the learned contact prop- erties are not as accurate (e.g., learned COR of 0.822 instead of 0.800). This is expected since the I.P formulation relaxes the 3D friction cone into (linear) polyhedral cone and the direction of friction impulses would deviate from those given by our contact model, which is based on the second-order fric-- tion cone. addition, we observe that the performance of our model does not suffer from noisy data since we incorporate strong physics prior into deep learning. For CMr, we also perform an ablation test to investigate the influence of the amount of regularization. By setting the regularizer R = cI, observe that smaller e (c.g. 0.001) result in more accurate learned contact properties. This is expected since a smaller approximate (5) and 7 better. However, making learnable parameter does not improve accuracy. Please see Appendix K for more details.
Robustness:
Figure 6: Validation losses for the BP5 task.
Table 3: Average wall clock time in each iteration of ropes. The last column shows increases in time
D
max(C)
time (8)
100
99
0,869
200
~ 199
1,563
1.7x
400
~ 399
3.225
3.7x
Experiments: downstream tasks
Since our framework is differentiable, we can use it as a differentiable physics simulator to solve downstream tasks after have learned the system and contact properties. Here we demonstrate this capability by considering three gradient- bbased trajectory planning tasks and using CM-CD-CLNN.
Billiards: We study the same billiard task as in DiffTaichi 35 The goal is to find the initial position and velocity of the white ball such that blue ball hit the black target at the 1024th time step. In order to test framework's 's ability to solve downstream task and make comparison with DiffTaichi, we assume the parameters such as mass and contact properties are known, the same assumption in DiffTaichi. Fig ((a) and 7(b) shows the solution found by our proposed model and DifiTaichi, respectively. This task does not have a unique solution since one can place the white ball closer to the billiards with relatively small initial velocity (e.g. DiffTaichi solution) or place the ball farther away from the billiards with a relatively large initial velocity (c.g. our solution). Fig (c) compares the convergence, where the loss is the distance between the black target and the blue ball at the 1024th time step. DiffTaichi has better convergence probably because it implements a simpler contact and dynamics model and it takes time of impact (TOI) into account. The TOI might be able to explain why the optimized positions of the white balls DifhTaichi and our method are on the right and left of the initial guess, respectively the gradient w.r.t. the initial position using naive integrator and TOI have different signs (Figure in 335
We present two throwing tasks as shown in Fig. g These throwing tasks are simpli- fied versions of similar tasks studied in [36 37). but we solve the tasks based on learned dynam- ics while previous works [36] 37] solve them with true dynamics. In the "hit" task (Fig. ((a)
Throwing:
0.4
CM-CD-CLAN
0.02 1g
Difrbichi
100
Iteration
(c) Figure 7: Billiards. (a). (b): The solid white ball and arrow shows the initial position and velocity optimized by AM-CDDCLNN and DiffTaichi, respectively, while dashed white ball and arrow shows those of the white ball before optimization. (c): Loss as function of training iterations.
(b)

---

the initial position of the disk is fixed, the goal is to find desired initial velocity so that the disk reach the target (black circle) after exactly one bounce off the ground. In the "vertical" task (Fig. [ the initial position and the translational velocity are fixed, so that first half of the center of mass (c.o.m) trajectory (dashed blue) is fixed. The goal is to find a desired initial angular velocity such that the second half of the c.o.m trajectory as close to a vertical line (dashed black) as possible. this task need to learn counter-clockwise spin such that when the disk bounces off the ground, there are enough friction to stop the horizontal motion.
(a)
(b)
Figure 8: Blue hollow circles indi- cate the initial position of the disk. (a) the "hit" task. The black hollow circle indicate the target position. (b) the "vertical" task.
For these two tasks, we parametrize the initial condition to be learned, simulate the trajectory based on the learned system and contact properties, and minimize the difference between simulated outcome and the goal by gradient descent. We can successfully find the initial conditions to achieve the tasks, evaluated using the true system and contact properties. (Please see the video for additional details).
6 Conclusion
In this work, we have introduced a differentiable contact model, which can capture contact dynamics with different properties. Our contact model extends the applicability of Lagrangian/Hamiltniaa inspired neural networks to enable the learning of hybrid dynamics in rigid body systems and offer interpretability about system and contact properties. We show that the proposed framework achieves better prediction with fewer samples and is robust against noisy data or LCP-generated data. Future works will incorporate model-based control and explore interpretable safe control policies for robotics applications. A particular direction could be to develop appropriate energy shaping control policies (54) and integrate them with this proposed learning framework.
Limitations: Our framework assumes a known collision detection module. Although it can be obtained from an idealized touch feedback sensor [5], this information might be unavailable in other scenarios. Future work would explore how to relax this assumption. Our framework might fail to correctly simulate systems which have extremely high mass ratios stiffness ratios compared to Macklin et al. (37]. where they show their primal method and dual method perform well in high mass ratios and high stiffness ratios scenarios, respectively. Our model might also have challenges in contact-rich systems and might not be as scalable as IPC [40]. Please see Appendix I. for additional scalability results. Our framework also uses a mix of acceleration-basee simulation (integrating continuous dynamics) and time-stepping methods (calculating instantaneous velocity change) while other simulation methods typically use only one of them. This is because we'd 'e'd like use RK4 to better enforce the conservation of energy as done in [14, 17). However, this choice also makes our simulator not as efficient as other simulators. We would like to compare our method other differentiable physics model such as NeuralSim (38] and gradSim
[41.. However, gradSim has not been open sourced when this work is conducted and is hard to reproduce model. NeuralSim has its own automatic differentiation engine where gradient are computed one at the time, which suitable for downstream tasks as demonstrated in [38]; however, it is not suitable for dynamics and parameter learning tasks where large number of parameters need to be updated based on their gradients. Additional efforts need to made to incorporate NeuralSim with deep lcarning frameworks. Although
not able to compare difficulties demonstrate that dynamics and parameter learning with differentiable physics simulators are currently underexplored in the literature.
work with these differentiable physics simulators, these
We introduce a framework for data-driven dynamics modelling which uses physics- based priors to improve generalization, sample efficiency, and interpretability. Data-driven dynamics modelling, in general, can have a profound effect learning-based control synthesis, especially in robotics and automation. However, our proposed framework is still a conceptual proposal and has a very low (around 2) Technology Readiness Level (TRI.) (55). We are yet to fully understand its limitations and failure scenarios that can significantly influence its rerl-world adoption.
Societal impact:
10

---

Acknowledgments and Disclosure of Funding
The authors would like to thank Siemens Technology for supporting this work. Funding in direct support of this work are from Siemens Technology. There are no competing interests.
References
[1] Yaofeng Desmond Zhong, Biswadip Dey, and Amit Chakraborty. Benchmarking Energy- Correy--onseriinggg Neural Networks for Learning Dynamics from Data. arXiv preprint 1oXiv:2012.023344 2020.
[2] Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, and Koray Kavukcuoglu. Inter- action Networks for Learning about Objects, Relations and Physics. In Advances in Neural Information Processing Systems, volume 29, pages 4502-45 4510, 2016.
[3] Michael B Chang, Tomer Ullman, Antonio Torralba, and Joshua Tenenbaum. A compositional object- based approach to learning physical dynamies. In International Conference on Learning Representations, 2017.
[4] Shuqi Yang. Xingzhe He, and Bo Zhu. Learning physical constraints with neural projections. In Advances in Neural Information Processing Systems, volume 33, 2020.
[5] Andreas Hochlehnert, Alexander Terenin, Steindor Saemundsson, and Mare Deisenroth, Learning Contact Dynamics using Physically Structured Neural Networks. In Proceedings of The 24th International Conference on Artificial Intelligence and Statistics, volume 130, pages 2152 2160, 2021.
[6] Akshay Agrawal, Brandon Amos, Shane Barratt, Stephen Boyd, Steven Diamond, and J. Zico Kolter. Differentiable Convex Optimization Layers. In Advances in Neural Information Processing Systems, volume 32, pages 9562-9574, 2019.
[7] Michael Lutter, Christian Ritter, and Jan Peters. Deep Lagrangian Networks: Using Physics as Model Prior for Deep Learning. In International Conference on Learning Representations, 2019.
[8] Michael Lutter, Kim Listmann, and Jan Peters. Deep Lagrangian Networks for end-to-end learning of energy-based based control for under-actuated systems. In 2019 JEEE/RSJ International Conference on Intelligent
Robots and Systems (IROS), pages 7718-7725, 2019.
[9] Manuel A. Rochrl, Thomas A. Runkler, Veronika Brandtstetter, Michel Tokic, and Stefan Obermayer. Modeling System Dynamics with Physics-Informed Neural Networks Based on Lagrangian Mechanics. In 2 st IFAC World Congress, 2020.
[10] Miles Cranmer, Sam Greydanus. Stephan Hoyer, Peter Battaglia, David Spergel, and Shirley Ho. La- grangian neural networks. In ICLR 2020 Workshop on Integration of Deep Neural Models and Differential Equations, 2020.
[11] Yaofeng Desmond Zhong and Naomi Leonard. Unsupervised Learning of Lagrangian Dynamics from Images for Prediction and Control. volume 33, 2020.
[12] Christine Allen-Blas -lanhllne Sushant Veer, Anirudha Majumdar, and Naomi Ehrich Leonard, LagNetViP: A Lagrangian Neural Network for Vidco Prediction. arXiv preprint arXiv:2010. /2932, 2020.
[13] Samuel Greydanus. Misko Dzamba, and Jason Yosinski. Hamiltonian neural networks. In Advances in Neural Information Processing Systems, volume 32, pages 15379-15338 2019.
[14] Yaofeng Desmond Zhong, Biswadip Dey, and Amit Chakraborty. Symplectic ODE-Net: Learning Hamiltonian Dynamics with Control. In International Conference on Learning Representations, 2020.
[15] Yaofeng Desmond Zhong, Biswadip Dey, and Amit Chakraborty. Dissipative SymODEN: Encoding Hamiltonian Dynamies with Dissipation and Control into Deep Learning. In ICLR 2020 Workshop on Integration of Deep Neural Models and Differential Equations, 2020.
[16] Zhengdao Chen, Jianyu Zhang, Martin Arjovsky, and Léon Bottou. Symplectic Recurrent Neural Networks.
In International Conference on Learning Representations, 2020.
[17] Mare Finzi, Ke Alexander Wang, and Andrew Gordon Wilson. Simplifying Hamiltonian and Lagrangian Neural Networks via Explicit Constraints. volume 33, 2020.
[18] Ricky TQ Chen. Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural ordinary differential equations. In Advances in Neural Information Processing Syxtems, volume 31, pages 6571-6583, 2018. [19] Junteng Jia and Austin R Benson. Neural Jump Stochastic Differential Equations. Advances Neural Information Processing Systems, volume 32, pages 9847-9858, 2019.
[20] Daehoon Gwak, Gyuhyeon Sim, Michael Poli, Stefano Massaroli, Jaegul Choo, and Edward Choi. Neural ordinary differential equations for intervention modeling. arXiv preprint arXiv:2010.08300 2020.
[21] Calypso Herrera, Florian Krach, and Josef Teichmann. Neural Jump Ordinary Differential Equations. In International Conference on Leurning Representations, 2021.
[22] Emanuel Todorov. A convex, smooth and invertible contact model for trajectory optimization. In 2011
IEEE International Conference Robotics and Automation, pages 1071-1076, 2011.
11

---

[23] Emanuel Todorov. Convex and analytically-invetiie dynamics with contacts and constraints: Theory and implementation in MuJoCo. In 2014 IEEE International Conference on Robotics and Automation (ICRA). pages 6054-6061, 2014.
[24] Emanuel Todorov. Tom Erez, and Yuval Tassa. Mujoco: physics engine for model-based control. In 2012 JEEE/RSJ International Conference on Intelligent Robots and Systems, pages 5026-5033. IEEE, 2012.
[25] Brendan O'donoghue. Eric Chu, Neal Parikh, and Stephen Boyd. Conic optimization via operator splitting and homogeneous self-dual embedding. Journal of Optimization Theory and Applications, 169(3):1042 1068, 2016.
[26] Mihai Anitescu and Florian A Potra. Formulating dynamic multi-rigid-boay contact problems with friction as solvable linear complementarity problems, Nonlinear Dynamics, 14(3):231-247, 1997.
[27] Filipe Avila Belbute-Peres, Kevin Smith, Kelsey Allen. Joshua B Tenenbaum, and Zico Kolter. End-to- end differentiable physics for learning and control. In Advances in neural information processing systems, volume 31, pages 7178-7189, 2018.
[28] Jonas Degrave, Michiel Hermans. Joni Dambre, and Francis Wyffels. A differentiable physics engine for deep learning in robotics. Frontiers in Neurorobotics, 13:6, 2019.
[29] Junbang Liang and Ming C. Lin. Differentiable Physics Simulation. In ICLR 2020 Workshop on Integration
of Deep Neural Models and Differential Equations, 2020.
[30] Changkyu Song and Abdeslam Boularias. Identifying mechanical models of unknown objects with differentiable physics simulations. In Proceedings of the 2nd Conference on Learning for Dynamics and
Control, volume 120 of Proceedings of Machine Learning Research, pages 749-760. PMLR, 2020.
[31] Changkyu Song and Abdeslam Boularias. Learning to slide unknown objects with differentiable physics simulations. In Robotics science and systems, 2020.
[32] Keenon Werling, Dalton Omens, Jeongseok Lee, loannis Exarchos, and C Karen Liu. Fast and feature- complete differentiable physics for articulated rigid bodies with contact. arXiv preprint arXiv:2103.16021 2021.
[33] Zhenjia Xu, Jiajun Wu, Andy Zeng, Joshua B Tenenbaum, and Shuran Song. DensePhysNet: Learn ing Dense Physical Object Representations via Multi-step Dynamic Interactions. arXiv preprint orXiv:1906.038:0 2019.
[34] Alvaro Gonzalzz, Jonathan Godwin, Tobias Pfaff, Rex Ying, Jure Leskovee, and Peter Battaglia. Learning to simulate complex physics with graph networks. In International Conference on Machine Learning, pages 8459-8468, 2020.
[35] Yuanming Hu, Luke Anderson. Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan- Kelley, and Fredo Durand. DiffTaichi: Differentiable Programming for Physical Simulation. In International Conference on Learning Reprexentations (ICLR), 2020.
[36] Moritz Geilinger, David Hahn, Jonas Zehnder, Moritz Bücher, Bernhard Thomaszewski, and Stelian Coros. ADD: Analytically Differentiable Dynamics for Multi-Body Systems with Frictional Contact. ACM Transactions on Graphics, 39(6). November 2020. ISSN 0730-0301.
[37] M. Macklin, K. Erleben, M. Müller, N. Chentanez. S. Jeschke, and T. Y. Kim. Primal/dual descent methods for dynamies. In Proceedings of the ACM SIGGRAPH/Eunogrpphic Symposiun on Computer Animation, 2020.
[38] Eric Heiden, David Millard, Erwin Coumans, Yizhou Sheng, and Gaurav S. Sukhatme. NeuralSim: Augmenting Differentiable Simulators with Neural Networks. In IEEE International Conference on Robotics and Automation (ICRA), 2021.
[39] Yifeng Jiang. Jiazheng Sun, and C. Karen Liu. Data-Augmented Contact Model for Rigid Body Simulation. arXiv Preprint. 1803.04015 2018
[40] Minchen Li. Zachary Ferguson, Teseo Schneider, Timothy Langlois, Denis Zorin, Daniele Panozzo, Chenfanfu Jiang, and Danny M Kaufman. Incremental potential contact: Intersection and inversion- free. large- dnge-deformation dynamics. ACM transactions on graphics, 2020.
[41] J. Krishna Murthy, Miles Macklin, Florian Golemo, Vikram Voleti, Linda Petrini, Martin Weiss, Breandan Considine, Jérôme Parent-Lévesquee Kevin Xie, Kenny Erleben, Liam Paull, Florian Shkurti, Derek Nowrouzezahrai, and Sanja Fidler. GradSim: Differentiable simulation for system identification and visuomotor control. In International Conference on Learning Representations (ICLR), 2021.
[42] Quentin Le Lidec, Igor Kalevatykh, Ivan Laptev, Cordelia Schmid, and Justin Carpentier. Differentiable simulation for physical system identification. IEEE Robotics and Automation Letters, 6(2):3413-3420. 2021.
[43] Ricky T. Q. Chen, Brandon Amos, and Maximilian Nickel. Learning neural event functions for ordinary differential equations. In International Conference on Learning Representations, 1021.
[44] Stefano Massaroli, Michael Poli, Jinkyoo Park, Atsushi Yamashita, and Hajime Asama. Dissecting Neural ODEs. In Advances in Neural Information Processing Systems, volume 33, 2020.
12

---

[45]
Siméon D Poisson. Mechanics, vol. i. Trans. HH Harte, Longmun, London, 1817.
[46] David Stewart. Rigid-hody dynamics with friction and impact. SIAM Review, 42(1):3-39, 2000.
[47] Michel Jean. The non-smooth contact dynamics method. Computer methods in applied mechanics and engineering, 177(3-4):235 -577, 1999.
[48] Shlomo Djerassi. Collision with friction; Part A: Newton's hypothesis. Multibody System Dynamics, 21 (1):37, 2009.
[49]
Thomas R Kanc and David A Levinson. Dynamics, Theory and Applications. McGraw Hill, 1985.
[50] Diederik P Kingma and Jimmy Ba. Adam: method for stochastic optimization. arXiv preprint MIXiv1442.66980 2014.
[51] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on
Learning Representations, 2019.
[52] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang. Zachary Vito,, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang. Junjie Bai, and Soumith Chintala. PyTorch: Imperative Style, High-Performance Deep Learning Library. In Advances in Neural Information Processing Systems, volume 32, pages 8024-8035. 2019.
[53] Falcon A. et al. PyTorch Lightning. GitHub. Note:
http://gthtub..oo//// Torchhighmingg/pytoon
lightming. 3, 2019.
[54] Jianping Lin, Nikhil Divekar, Ge Lv, and Robert D. Gregg. Energy shaping control with virtual spring and damper for powered exoskeletons. In 2019 JEEE 58th Conference on Decision and Control (CDC), pages 3039-3045, 2019. doi: 10.1 10.1009/DC4002222009.0 2019..9444,,,
[55] Steven Hirshorn and Sharon Jefferies. Final Report of the NASA Technology Readiness Assessment (TRA) Study Team. 2016.
13


Reviews:
[{"review_id": "nlxu-U-aD9X", "reviewer": "Reviewer_GQFZ", "summary": "The paper proposes a differentiable contact model, whose unknown parameters (restitution and friction coefficients) can be learned together with other system parameters using Hamiltonian and/or Lagrangian neural networks. The proposed contact model consists of two constrained convex optimization problems, which are made differentiable by the recently proposed differentiable convex optimization layers. Variants of the proposed methods outperform baselines on multiple 2D and 3D physical systems. The learned dynamics model can also be used for downstream planning and control tasks.", "questions": "", "limitations": "", "rating": 7, "confidence": 3, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "Originality: The proposed method is a novel combination of the two-phase contact model, the differentiable convex optimization layers and the Hamiltonian & Lagrangian neural networks. Related works are sufficiently discussed.\n\nQuality:\nThe paper is technically sound, and the empirical evaluation is thorough. Some weaknesses are listed below:\n- The choice of the target velocity $v_C^*$ to fix penetration seems to require a lot of engineering and not very principled. It is also unclear how sensitive the performance is to the choice of the target velocities, as it is not discussed in the experiments.\n- One of the improvements made from the previous submission is that the authors fixed an error in the code base. However, the code is still not included in this submission. \n\nClarity: The paper is generally well-written. Some improvements can be made on the presentation of the proposed method. For example, an algorithm box outlining the training procedure would help. Also, the current introduction repeats part of the related work section, and can be made cleaner.\n\nSignificance: The contributions of this paper are incremental and moderately significant. The proposed method outperforms the baselines on prediction error and energy conservation, but also requires a known collision detection module and the nontrivial choice of the target velocity. In general, it doesn’t seem to have a clear advantage over existing methods, but can still be a meaningful contribution.\n\n==== Post rebuttal ====\n\nMy concerns are well addressed by the author response. I have increased the score to 7.\n", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "I think the authors have adequately addressed the limitations and potential negative societal impact of the work.", "review_text": "", "extra_scores": {"needs_ethics_review": "No", "ethics_review_area": "", "time_spent_reviewing": "5"}, "extra_text": {}}, {"review_id": "kNCU9MQL366", "reviewer": "Reviewer_rSNF", "summary": "This paper introduces Lagrangian/Hamiltonian neural networks for simulating systems with frictional contacts. Previous Constrained Hamiltonian Neural Networks (CHNN) are able to learn constrained motion while this paper extends to the case of constrained motions with frictional contacts. A first phase leverages the NeuralODE framework to simulate in a fully differentiable way, the constrained motion associated with the learnt Lagrangian/Hamiltonian. Contacts are handled by incorporating an additional contact-solving phase solved using differentiable optimization layers (cvxpylayers).  The approach is benchmarked against an MLP baseline and an Interaction-Network on the task of learning a differentiable simulator from data. The learnt differentiable simulator is then applied to control tasks and compared to the DIffTaichi simulator. ", "questions": "", "limitations": "", "rating": 8, "confidence": 5, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "A consequence of the use of CHNN is the need for using Cartesian coordinates instead of generalized ones. This results in soft joint constraints when considering multi-body systems in robotics and also requires solving artificially higher dimension problems. Moreover, the proposed approach does not account for external or control forces  and such efforts could make it more challenging to enforce constraints. In order to consider control applications, would it still be possible for CHNN to learn the dynamics of a system under these forces? \n\nThe Signorini condition which enforces the complementarity between normal contact forces and velocities accounts for the non-inter penetrability between objects [The non-smooth contact dynamics method, Michel Jean 1999]. This condition is necessary to simulate rigid bodies and is ignored in this paper. The same approximation is done in the simulator Mujoco [Mujoco: a physics engine for model-based control, Todorov et al. 2012] and leads to simulation artefacts such as objects interacting even when they are not in contact. Did you observe similar effects? Could the Authors report on it?\n\nDoes the SCS solver have convergence guarantees for positive semi-definite problems (case when the A matrix has a null eigenvalue)? This is a common case in robotics that corresponds to over-constrained problems and one should avoid using a regularization matrix R as it leads to less precise solutions.\n\nExperiments on dynamics and parameters learning demonstrate the superiority of the method when compared to a simple MLP or a more sophisticated Interaction-Networks. However, a comparison with a differentiable simulator such as gradSim [gradSim: differentiable simulation for system identification and visuomotor control, Murthy et al. 2021] would be interesting because the approach should be more competitive than other baselines (as shown by experiments from 5.). Durations considered during the evaluation of energy conservation are short when compared to the ones involved in robotic applications. Is this property still valid for longer time horizons? \n\nConcerning the experiment on robustness, why were the 3D examples generated from an LCP simulator and not with one accounting for the cone constraint? From my understanding, the learnt friction parameter does not have the same meaning as the original one because it corresponds to different friction models which makes it difficult to compare them [Differentiable simulation for physical system identification, Le Lidec et al. 2021]. \n\nA billiard task is considered to evaluate the approach and compare it against the DiffTaichi differentiable simulator. This simulator includes gradients from the collision detection routine while it is not clear if this information is available in the collision detection module used in the approach proposed in the paper. I would expect this information to be important to solve a problem where one needs to reason about contact points as is the case in the billiard task. Could it be the reason behind the better performance of Difftaichi on this task? Did you consider different initial guesses or targets to assert the robustness of the approach on this task?\n", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "Overall, the limitations as presented by the Authors seems a bit limited.\nIndeed, the Authors did not discuss for instance the fact they did consider complementarity between motion and forces at the contact level.\nAdditionally, they clearly did not discuss the fact they did a mix between acceleration-based simulation and time-stepping methods which will compute a corrective impulse at velocity level. What is the physical and mathematical meaning of such a choice?", "review_text": "", "extra_scores": {"needs_ethics_review": "No", "ethics_review_area": "", "time_spent_reviewing": "4"}, "extra_text": {}}, {"review_id": "bfNtrzao1tW", "reviewer": "Reviewer_aKSy", "summary": "This paper propose a novel method for learning simultaneously the properties of dynamics and contacts.\nThis method is implemented by a combination between C[HL]NN, Differentiable Convex Optimization Layers\nand neural ODE. The main contribution is the ability to model frictional contacts both with or without elasticity.\n\nThe experiments demonstrate the superiority of the proposed method over the relevant baselines.\n\n\n", "questions": "", "limitations": "", "rating": 7, "confidence": 5, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "originality:\n\nthe proposed combination between the existing frameworks (C[HL]NN, Differentiable Convex Optimization Layers\nand neural ODE) for handling contacts with friction is novel \n\nquality:\nthe main claims of the paper are demonstrated to be true, and the method/model is reasonable.\n\n\nclarity:\nI strongly recommend to add a description of the entire method by a block diagram/picture/pseudo code.\nAlso, frequent jumping between the paper and the appendices affects the readability. \n\nsignificance:\neven though the method is original, it is limited to particular classes of contact dynamics, and/or dimensionality of dynamics.\nSpecifically, there is no improvement in \"Rope\" environment, which indicates that the proposed solution is not general and/or scalable.  Consequently,  it is unclear when this method improves the baselines. Does it work only with a small number of contacts ( <= 8)? What is the main limitation? Does it perform better with more training data and/or larger networks? E.g., Table 3 might shed light on this issue, if the corresponding errors (as in Fig2+Fig3) would be added. Addressing this concern and providing a conclusion will improve the score. \n\n\npost rebuttal: following the clarifications and improvements by the authors I change my score to 7.\n\n", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "the authors adequately addressed the limitations. ", "review_text": "", "extra_scores": {"needs_ethics_review": "No", "ethics_review_area": "", "time_spent_reviewing": "2"}, "extra_text": {}}, {"review_id": "7lcJbCVoUDc", "reviewer": "Reviewer_snrk", "summary": "This paper presents a differentiable contact model and demonstrates its compatibility with deep learning frameworks and its usefulness in downstream applications. The proposed contact model is similar to that in MuJoCo but with several enhancements. The final contact model formulates the task of solving contact forces as a convex optimization problem and is differentiable. The authors demonstrate the usefulness of their proposed contact model in several standard 2D and 3D examples.", "questions": "", "limitations": "", "rating": 7, "confidence": 3, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "Differentiable contact models are not new to the ML/robotics/graphics communities, and previous works have proposed quite a few candidates. One of my biggest concerns for this paper is that it focuses on showing the performance of the proposed contact model but without comparing it to other differentiable contact models from previous papers. The authors are aware of the differentiable contact model presented in [35] but did not seem to comment [35] in their related work section. The original “hit” example in [35], which this paper got inspiration from (line 326), is a 3D deformable ball bounces between walls and grounds more than once, which is much more sophisticated than the two examples this paper presented in Fig. 7. Another more recent, state-of-the-art differentiable contact model “Incremental Potential Contact: Intersection- and Inversion-free Large Deformation Dynamics” (IPC), is missing in this paper’s related work but I believe IPC deserves a careful discussion. I do agree this submission has some unique contributions in its machine learning experiments which are not covered by [35] or IPC, which is also why I choose to give a positive score. However, I think it should also pay more attention to other existing differentiable contact models and position its contributions more properly.", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "From what I understand, developing contact models typically focuses on one of the two goals: it either aims at physical accuracy and targets at real-world applications, or focuses on speed/robustness/simplicity and considers animation/learning problems as its main application. The position of the contact model presented in this work is not very clear to me: it is definitely more physically plausible than some of the simplest contact models in robotics/graphics/ML, but not accurate enough for a real-world application. I look forward to seeing a clarification and, even better, a real-world example in their future work.\n \nAnother limitation in this work is that a comprehensive discussion about the role of collision detection is missing. However, I notice that the authors are aware of this and consider it as future work, which I think is fair, so I won’t hold it against them.\n", "review_text": "", "extra_scores": {"ethical_concerns": "None", "needs_ethics_review": "No", "ethics_review_area": "", "time_spent_reviewing": "4"}, "extra_text": {}}, {"review_id": "1eN5HRrTqU5", "reviewer": "Reviewer_adW2", "summary": "This paper adds explicit contact modelling to lagrangian/hamiltonian neural networks.\nSpecifically, they add a contact resolution step to CHNN using an impulse-based micro collision maximum dissipation contact model inspired by the contact model used in MuJoCo.\nThey also handle elastic collisions with a 2 phase collision based on poisson restitution.\nEach phase of contact resolution are convex programs and CvxpyLayers is leveraged to compute analytic gradients through them.\nExperimental evaluations are performed to test the proposed models ability to infer physical parameters from trajectories and predict future trajectories.\nTwo small experiments are also included to show the capability of the model to be used for control.\n", "questions": "", "limitations": "", "rating": 6, "confidence": 4, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "Strengths:\n1. The choices of the contact model are inspired by MuJoCo and novel for differentiable rigid body physics models and most other methods typically don’t handle elastic collisions.\n2. Method is thoroughly detailed in the appendix.\n3. Video shows qualitative results on the various toy tasks.\n\nIssues:\n1. The only test data for comparing trajectory error is generated using the proposed model itself. In this case there is zero model mismatch. An additional prediction task using real world data (ideally) or trajectories generated from a separate physics simulator should be used to compare the method against baseline.\n2. It would be interesting to extend Figure 5 to see when/if MLP and IN baseline could catch up to the proposed method (if the CM method is too expensive at least the baselines could be extended).\n3. This is cleared up in the appendix but it would be clearer if the notation used in Algorithm1 ($\\Delta v$) were explicitly related in the section 3 description.\n4. In the appendix S.10 shows $f_E$ can be expressed in terms of $f_C$ but doesn’t $f_E$ depend also on impulse from unconstrained dynamics f.e. acceleration due to gravity (the Mujoco paper includes this as “s” term)?\n5. Some details on the IN and MLP baselines are missing. What features are being passed to them?\n6. The regularized version CMr is briefly introduced and not discussed too much. In which scenarios would the regularization be important?\n7. I understand that the LCP baseline was infeasible due to nan issues. Another possible baseline which should be comparatively stable is soft contact model.\n8. I believe [34] do test energy conservation for their contact model somewhat.\n\nOverall:\nI think the paper provides a useful contribution to differentiable rigid body simulation which has seen a lot of interest. A new differentiable contact model is proposed and evaluated experimentally. My main issue is that comparisons and prediction errors are only evaluated on data generated by the proposed model itself.", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "Perhaps the authors could elaborate on what cases the contact model could be inaccurate/unstable for. For example, would you expect any issues around resting contacts, large numbers of simultaneous contacts etc.", "review_text": "", "extra_scores": {"needs_ethics_review": "No", "ethics_review_area": "", "time_spent_reviewing": "3"}, "extra_text": {}}]

Author rebuttal:

Meta-review: This paper proposes a differentiable contact model that can be used together with previously proposed Lagrangian and Hamiltonian neural networks, enabling gradient-based system identification and model-based control for hybrid dynamical systems. All reviewers recommend acceptance and by the end of the rebuttal process became satisfied with the additional experiments and clarifications by the authors. Some limitations on the scalability of the method in contact-rich (and high-dimensional state) scenarios were also illustrated through additional experiments, and reviewers were satisfied. I am recommending this paper for acceptance.    
Decision: Accept (Poster)