andreadelprete / consim

GNU General Public License v3.0
14 stars 1 forks source link

Romeo walking Results #30

Closed andreadelprete closed 3 years ago

andreadelprete commented 4 years ago

I've added to the benchmarks a two-step walk with Romeo, just to have a biped. In short, results are good. Here the local integration errors, time step 2 ms: romeo_walk_err For dt=2 ms Euler is unstable so it gives a huge error. For smaller time steps it remains stable, but the integration error is always a couple of orders of magnitude larger than for Exponential.

This plots shows the integration error over time: romeo_walk_err_traj For most of the time the integration error of Exponential is well below Euler. In a few time steps we can see spikes in the Exponential error. These spikes are due to errors in contact detection, which are independent of the integration scheme, so during these time steps the error of Exponential is comparable to the one of Euler.

Since now we have good results for Solo squatting, Solo jumping, Solo trotting and Romeo walking, we can start working on the computation time.

andreadelprete commented 4 years ago

I've managed to repeat the same test as above with a time step of 10 ms, and Exponential is still stable with this large time step! romeo_walk_err_dt_10ms With dt=10 ms Exponential gives roughly the same integration error of Euler with dt=1/4 ms. This means that we need 40 times more time steps with Euler than with Exponential.

andreadelprete commented 4 years ago

I've found the maximum time step for the controller to remain stable (it is 40 ms), and I've used it as basic time step for the simulator. Here the new results: romeo_walk_err_dt_40ms Results are good even with large time steps. However, it should be noticed that this doesn't mean the simulator would work with a time step of 40 ms. In these tests we are indeed measuring the local error, which means that every time step (40 ms) the state of the system is reset to the ground truth, so the simulator cannot diverge. If instead I measure the global error (i.e. I don't reset the state to the ground truth) I can see that even Exponential diverges for time steps >= 5ms: romeo_walk_global_err_dt_40ms However, for dt=2.5 ms Exponential is stable, while Euler is not. For dt<=1.25 ms both Exponential and Euler are stable, but Exponential performs better.

Anyway I think it's better to focus on the local error, because the global error is dominated by the collision checking errors, which are rather independent of the integration scheme, and so it tends to "hide" the benefits of Exponential over Euler.

andreadelprete commented 4 years ago

New results for the same test. Here I'm showing the local integration error as a function of the computation time (per time step, which is 40 ms in this test):

local_err_vs_comp_time

These results are excellent. Euler never beats Exponential. Using 0, 1 or 2 matrix multiplications in expm we get peak performance of Exponential.

andreadelprete commented 4 years ago

The previous test was using a contact stiffness of 1e5 and a contact damping of 1e2, which is underdamped. If we use instead a critically damped contact (i.e. damping 5e2) the results are a bit better for Euler: local_err_vs_comp_time_k_1e5_b_5e2 Euler is never the best, but sometimes it's better than the standard Exponential integrator. It seems that Exponential is most beneficial for underdamped contacts, probably because it's able to predict the contact force oscillations much better than Euler, which simply assumes constant forces during the time step.