# Rigid body simulation of complex mechanical systems

• Delta Kilo
In summary: Best regards,In summary, DK says that most of the parts for his automaton will be 3D printed, except for some metal springs, rods and bearings. He's looking into some software to simulate rigid body physics, but he's having problems with collisions and joints. He's also looking for a software that can do what he needs without requiring a long learning curve. He recommends ADAMS or Simpack.
Delta Kilo
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.

Apart from ADAMS there's also Simpack from Dassault Systemes. It features many advanced capabilities including for example flexible bodies. It can even work with Abaqus and other software during co-simulation.

Comsol doesn't conserve the energy watch out to test all kinds all elements and values in it firts.... ITS A MUST TO DO...

## 1. What is a rigid body simulation?

A rigid body simulation is a computational method used to model and predict the behavior of physical objects in motion. It assumes that the object is a solid, non-deformable body with fixed dimensions and mass, and calculates its movement and interactions with other objects based on physical laws such as Newton's laws of motion.

## 2. What are some applications of rigid body simulation?

Rigid body simulation is commonly used in various fields such as engineering, robotics, video game development, and animation. It can be used to simulate the movement of vehicles, machinery, and structures, as well as the behavior of characters and objects in video games and animated films.

## 3. How does rigid body simulation work?

Rigid body simulation involves breaking down a complex mechanical system into smaller rigid bodies connected by joints and constraints. The simulation then calculates the forces and torques acting on each body, and uses numerical integration to update their positions and velocities over time. This process is repeated in small time steps to create a continuous simulation.

## 4. What are some challenges in rigid body simulation?

One of the main challenges in rigid body simulation is accurately modeling the physical properties and interactions of objects, such as friction, collisions, and constraints. Another challenge is balancing computational efficiency with accuracy, as simulating highly complex systems can require a lot of processing power.

## 5. How can rigid body simulation be improved?

Researchers are constantly working on improving rigid body simulation techniques by developing more advanced algorithms and incorporating more realistic physics models. They are also exploring the use of parallel computing and machine learning to speed up simulations and handle more complex systems. Additionally, advancements in hardware technology, such as faster processors and graphics cards, can also improve the performance of rigid body simulations.

• Classical Physics
Replies
4
Views
415
• Classical Physics
Replies
3
Views
863
• Quantum Physics
Replies
6
Views
797
• Classical Physics
Replies
2
Views
1K
• Astronomy and Astrophysics
Replies
12
Views
2K
• Mechanical Engineering
Replies
2
Views
994
• Mechanical Engineering
Replies
22
Views
1K
• Mechanical Engineering
Replies
3
Views
1K
• Mechanical Engineering
Replies
17
Views
7K
• Mechanical Engineering
Replies
10
Views
2K