Moment simulation, how to find out the shortest distance A and B before tipping point

Hello,
I'am trying to establish the shortest distance A and B before reaching the tipping point (wheel axis from pole center).
If the center of mass is almost aligned with the table pole, and because the table is mount on wheel, theorically the table will never fall. But that's the theory and i'm looking for a better approach to the practice than my guess.
There is too many factor, like friction of rotational point (table to pole, wheel to foot, wheel to floor), the speed, the uneven floor....
On this draft, I'm on the safe side, but then the table can't reach a close state as the foot will colide before the table is close.
If you do have experience, please let me know your approach to solve this. Thanks