
Now the fun part starts, and i can start work on walking and other behaviors. I'm still sure that's the easier part, but i'll see...
Regarding contacts, the improvements did not help me. I have to stick at the custom contact joint. At least for now.
The problem with default contacts is: Becasue they are distributed over the whole contact area, some contact force is generated for all of them, and we have no precise control about how much.
Imagine you stand straight, and then you want to push your com backwards, so you would fall on your back.
To do so, you will move your center of contact pressure to the toes.
There will be also contacts under your heels, but ther will be no force there. All force is focused on the front side at the toes.
But in the simulation you can not do this. There will be force also on the heels, slowing your backwards movement down. And beside this constant error, it's unpredictable. Cached contacts change their position at random time, generating unexpected discontinuities. I've tried to compensate the error using a PD controller and such things. This works, but it's not rliable enough.
Even ML will have a hard time to compensate those unptredictable events.
Likely it can deal with it, but then the only way to do so is being very cautious, and thus moving slowly. Bruce Lee might be out of reach.
Only now that i have the custom contact joint workaround fully working, i can see the impact of this contact problem. And i tell you: It's huge. It's much bigger than you think it is, i guess. I knew about this problem for years, but i'm really surprised now myself.
Now i'll see how far i can get using the custom joint. It might be the perfect solution for games, since it also allows to cheat by making the feet virtually larger very easily, but i have not yet tried to walk over dynamic objects or such things. I expect some problems in the future.
So how would a general solution look like, still using Newtons default contacts and collision detection?
I think it might work using an additional constraint, affecting multiple contacts.
Basically i'd need to do something like: 'For all contacts of the feet, ensure that all genreated contact forces are clipped by some given user plane.'
Or in other words: 'The toe contact force needs to be x times stronger than the heel force'.
Something like that.
Ideally, the simulation would figure out this without any extra constraints or information. It should, since the joint accelerations i give should generate the center of pressure at exactly the desired point. And because it does not, i could call it an error that should be fixed.
But i see it's not that easy, due to the discrete nature of contacts in such physics engines. They turn on and off with nothing in between, the caching with it's discontinuous updates, etc. And it works well for anything beside robotics.
So maybe an extension where needed is better than trying to improve general accuracy even further.
Not sure. But i guess contacts was the first problem you worked on for this, and it looks like the journey isn't over yet...
