- #1

Delta Kilo

- 329

- 22

- TL;DR Summary
- I'd like to simulate a complex mechanical automaton with lots of gears, cams, levers and springs.

I tried a couple of rigid body mechanics libraries and they all have limitations.

Just wondering what is the state of the art in the field and what other people are doing.

Greetings,

I'd like to simulate a complex mechanical automaton with lots of gears, cams, levers and springs. Most of the parts are going to be 3D printed except for some metal springs, rods and bearings. I want to make sure everything fits together and works as expected. Here is just a small part of the mechanism I want to simulate:

I looked at some of the libraries for rigid body physics simulation, Project Chrono and Bullet physics in particular. I can get them to work, sort of, but I cannot seem to get reliable results. As soon as the system becomes complex enough, everything just falls apart. The problems are:

* Collisions are only supported between simple convex shapes. Complex shapes, like gears, have to be manually broken up into convex primitives.

* Collisions between small objects (like gear teeth) are unreliable and sometimes can be missed entirely.

* Joints (such as fixed joint, revolution joint) are not rigid enough, they seem to flex and bend in directions they are not meant to. A chain of levers connected with revolution joints constrained to rotate in XY plane, just falls apart under its own weight when I specify realistic sizes, densities and gravity.

I spent some time looking into the matters, reading the literature and the source code and as far as I understand there are 2 fundamental issues:

* Collision detection needs to generate "penetration vector" which is the shortest vector to move objects apart. This vector is well defined only for simple cases, like sphere-sphere, sphere -plane etc. There is an algorithm to compute it for convex hulls but it is not perfect (penetrating vector computed from object A to object B is different to the one from B to A). As a result, when two objects collide, the direction of the resulting force may vary quite a lot depending on the fine details of the mesh. General case of concave objects is treated by splitting them up using convex decomposition. Convex decomposition applied to a simple concave object (like a cylinder with a hole in it) tend to produce a mess of small slivers which make subsequent collision detection very difficult.

* Constraint solver has to deal with with large ill-conditioned matrices, especially when there are multiple constraints in the design which are aligned in the same direction. When the system is constructed some first order approximations have to be made. Also the system depends on the set of contact points which can change a lot from one time step to another, as is case of two flat faces in contact. This causes stability issues and makes simulation behavior very sensitive to time step selection.

So my questions are:

What is the state of the art in rigid body simulation? Are there any libraries (preferably open source) that can do what I need out of the box?

Are there any offerings from big players with this kind of functionality that I can try for free just to see how it works?

Is there a slow but reliable brute-force method to solve it? Are there any tricks to make the simulation work reliably? Or is it just too hard?

Or are the issues inherent in the limitations or rigid body model and I need to go all the way and model all bodies with FEA?

Or am I missing something obvious here?

Regards,

DK

PS: I'm not sure whether this post belong to Physics, Math, Software or Engineering. Moderators are welcome to move it to the most appropriate forum.

I'd like to simulate a complex mechanical automaton with lots of gears, cams, levers and springs. Most of the parts are going to be 3D printed except for some metal springs, rods and bearings. I want to make sure everything fits together and works as expected. Here is just a small part of the mechanism I want to simulate:

I looked at some of the libraries for rigid body physics simulation, Project Chrono and Bullet physics in particular. I can get them to work, sort of, but I cannot seem to get reliable results. As soon as the system becomes complex enough, everything just falls apart. The problems are:

* Collisions are only supported between simple convex shapes. Complex shapes, like gears, have to be manually broken up into convex primitives.

* Collisions between small objects (like gear teeth) are unreliable and sometimes can be missed entirely.

* Joints (such as fixed joint, revolution joint) are not rigid enough, they seem to flex and bend in directions they are not meant to. A chain of levers connected with revolution joints constrained to rotate in XY plane, just falls apart under its own weight when I specify realistic sizes, densities and gravity.

I spent some time looking into the matters, reading the literature and the source code and as far as I understand there are 2 fundamental issues:

* Collision detection needs to generate "penetration vector" which is the shortest vector to move objects apart. This vector is well defined only for simple cases, like sphere-sphere, sphere -plane etc. There is an algorithm to compute it for convex hulls but it is not perfect (penetrating vector computed from object A to object B is different to the one from B to A). As a result, when two objects collide, the direction of the resulting force may vary quite a lot depending on the fine details of the mesh. General case of concave objects is treated by splitting them up using convex decomposition. Convex decomposition applied to a simple concave object (like a cylinder with a hole in it) tend to produce a mess of small slivers which make subsequent collision detection very difficult.

* Constraint solver has to deal with with large ill-conditioned matrices, especially when there are multiple constraints in the design which are aligned in the same direction. When the system is constructed some first order approximations have to be made. Also the system depends on the set of contact points which can change a lot from one time step to another, as is case of two flat faces in contact. This causes stability issues and makes simulation behavior very sensitive to time step selection.

So my questions are:

What is the state of the art in rigid body simulation? Are there any libraries (preferably open source) that can do what I need out of the box?

Are there any offerings from big players with this kind of functionality that I can try for free just to see how it works?

Is there a slow but reliable brute-force method to solve it? Are there any tricks to make the simulation work reliably? Or is it just too hard?

Or are the issues inherent in the limitations or rigid body model and I need to go all the way and model all bodies with FEA?

Or am I missing something obvious here?

Regards,

DK

PS: I'm not sure whether this post belong to Physics, Math, Software or Engineering. Moderators are welcome to move it to the most appropriate forum.