gait in biped robotics

I’m new with Choreonoid, however, I have a long experience of simulation of gait of biped robots (Inventions | Free Full-Text | Modelling, Simulation and Control of the Walking of Biped Robotic Devices—Part I : Modelling and Simulation Using Autolev).
I usually model the robot free on space by adding additional degrees of freedom, and, according to the phase of the gait (single or double support) I introduce two different non-olonomic constraints.
So, I have to cope with two different dynamical models (double support, single support right-left), and I have to switch from one to the other during the gait.
The switching is the most critical part of the simulation under two aspects: moving from double to single support I have to guarantee that the would be flying foot has reaction force/torque with the ground precisely equal zero; vice versa, moving from single to double support, approaching the contact of the flying foot with the ground, a compliance has to be introduced moving some joints from position/velocity to torque loop.
If these cautions are not satisfied, spikes in all forces/torques arise.
How are these problems approached in Choreonoid?
I see in the manual that there is a Penetration Block Function, introduced in the Collision Detection, but the description completely hyde what they are really doing.
Can you give me more information, or where can I find them?

In the constraint-base contact force calculation, it is important to keep a small amount of penertation between two rigid bodies contacting with each other. Otherwise, the contact will occur and disappear in the border of the contact because the simulation itself is discreate.

And keeping the peneration works as a kind of compliance between two bodies, though it is not the original purpose of it. As a result, the contact between the sole and the floor becomes stable.

This is what the implementation of AISTSImulator does, but I think other physics engines do a similar thing.

The corresponding implementation is written in src/Body/ConstraintForceSolver.cpp.

The varialbe contactCorrectionDepth and contactCorrectionVelocityRatio determins the above behavior. Please check the implementation if you are insterested in it.

I thank you for the answer, and the details. However, my approach to the contact is a little different.
I do not try to simulate the penetration of the two bodies, Vice versa, in the equations of the dynamical model, when the contact occurs, I introduce non-holonomic constraints. These offer me mathematically, as output, the reaction forces. Then I check if the contact is proper by verifying the sign of the vertical component of the reaction forces, and the values of the horizontal components for slipping. These equations are given me by a symbolic maniputation environment, called Autolev, that generate, also, fragments of C code for programming. Then, it comes another question. How can I integrate the code generated by Autolev with Choreonoid? I’m sure it is described in the different manuals, can you provide me a pointer to start from, and some examples to perform the work?