Suspension advice #112
-
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
Depends on your definition of better! My main concern with heavily loaded multibody constraint chains would be stability and rigidity. They'll tend to need high stiffness, but that makes it harder to solve and can require a shorter timestep or substepping. Any issues with high mass ratios will be magnified by using a chain of bodies. Judging by the simulation time breakdown, it looks like you're already using substepping, but if you aren't I'd recommend trying it out (https://github.com/bepu/bepuphysics2/blob/master/Demos/Demos/SubsteppingDemo.cs). Then you can try increasing constraint frequencies to up to half of the effective solver update rate. 60hz timestep with 8x substepping would let you do 240hz constraint frequencies safely. Sufficiently high stiffness and substepping rates should let you do just about anything in a stable way, it's just a question of cost. Note that for small simulations, using only a single thread could help, since otherwise most of the simulation time could be wrangling threads. (I also have plans to reduce the cost of substepping by a lot: #104) Could also play with different constraint configurations that get rid of the intermediate bodies, though it might require some approximations (or custom constraints) in more complex configurations. |
Beta Was this translation helpful? Give feedback.
-
I did some more tests, looks like such chain of bodies isn't stable without substepping. And I'm not sure about its usage in real apps. On the other side, such suspension moves more interestingly than LinearAxisServo. Maybe in the future, I will find the courage to create custom constraints. Thank you, for a hint! |
Beta Was this translation helpful? Give feedback.
-
By the way, something I should have mentioned is that a great deal of the solving difficulty in such situations arises from large mass ratios. If you were to artificially reduce the mass ratio between bodies such that the wheels and intermediate bodies were closer to the mass of the main body, it would very likely help with stability and not require as many solver iterations or substeps. |
Beta Was this translation helpful? Give feedback.
-
Silly me! With torsion key mass equals 2x wheel mass, everything is stable without substepping. But I encountered another thing: it looks like internal forces pull a structure apart - a tank slowly moves sideways on its own. Another iteration on balancing masses is needed haha. Also simulation sometimes spikes from 0.7ms to 6ms |
Beta Was this translation helpful? Give feedback.
-
This is usually a sign that some constraint configurations are fighting somewhere, or that a constraint stiffness are a little too high for the current effective solver timestep, or there is some other difficulty (like mass ratios, as you mention) that is harming convergence. If the solver can't converge to a global solution, it can introduce energy.
If it's happening during steady state simulation (no sleep/wake transitions, no JIT compilations, etc), that usually happens when the OS decides to switch out a worker thread, and then the entire engine sits waiting for the OS to reschedule it so the work can finish. It's made more likely by thread oversubscription. If the OS doesn't have a free thread to schedule some background work, it could displace a physics engine thread. This kind of issue tends to be far more common on older operating systems like Windows 7. They tend to require a bit more breathing room- giving the physics a smaller subset of the available logical threads can help. And if you only have a few tanks of that size, there's a good chance they'd run faster single threaded too. Multithreading only really starts to shine when there's thousands of constraints and bodies.
In the future, all tanks will have a theme park ride mode. |
Beta Was this translation helpful? Give feedback.
-
Yep, I eventually found sweet mass-ratio balance But then I realized that this janky movement is awful. Okay, maybe I will give it a try later Thank for the help |
Beta Was this translation helpful? Give feedback.
-
Might be able to improve things by creating direct connections between the wheels and the main body. An AngularAxisMotor for the drive torque, AngularHinge to keep the wheels aligned, and maybe a LinearAxisServo to constrain the center of the wheels to stay on on the proper plane. The suspension would then only be responsible for movement along the 2 remaining degrees of freedom on that plane. Might be possible to then simplify the connections to the suspension body. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Depends on your definition of better!
My main concern with heavily loaded multibody constraint chains would be stability and rigidity. They'll tend to need high stiffness, but that makes it harder to solve and can require a shorter timestep or substepping. Any issues with high mass ratios will be magnified by using a chain of bodies.
Judging by the simulation time breakdown, it looks like you're already using substepping, but if you aren't I'd recommend trying it out (https://github.com/bepu/bepuphysics2/blob/master/Demos/Demos/SubsteppingDemo.cs). Then you can try increasing constraint frequencies to up to half of the effective solver update rate. 60hz timestep with 8x substepping would …