Collections of rigid bodies with Bullet based contact detection (Siconos/Mechanics)

Author: Maurice Bremond, Vincent Acary 2013–2016

You may refer to the source code of this set of examples, found here.

Description of the physical problems : rigid bodies collection with contact and Coulomb friction

In this set of examples (,, …), we model collections of rigid bodies associated with shapes (primitive (sphere, cube capsule, etc), convex hull, mesh) that interact with contact and friction (see fig-n_cubes).

The example use extensively the mechanics_run python code that enable to create and manage the geometrical data and the results of the simulation in hdf5 file.

The results cab be viewed with the siconos_vview and the siconos_vexport python scripts

A brief description of examples is as follows :

  • is the simplest example with few cubes that fall down on a rigid fixed plane. The scene is built using calls to mechanics_run methods such as

    • addPrimitiveShape for creating a primitive shape
    with Hdf5(mode='r+') as io:
      io.addPrimitiveShape('Ground', 'Box', (100, 100, .5))
    • addConvexShape for creating a convex shape addPrimitiveShape, addNewtonImpactFrictionNSL)
    with Hdf5(mode='r+') as io:
       io.addConvexShape('Cube_1', [
       (-1.0, 1.0, -1.0),
       (-1.0, -1.0, -1.0),
       (-1.0, -1.0, 1.0),
       (-1.0, 1.0, 1.0),
       (1.0, 1.0, 1.0),
       (1.0, 1.0, -1.0),
       (1.0, -1.0, -1.0),
       (1.0, -1.0, 1.0)])
    • addObject for associating Newton Euler Dynamical System to a shape
    with Hdf5(mode='r+') as io:
      io.addObject('cube', [Contactor('Cube')], translation=[0, 0, 2],
      velocity=[10, 0, 0, 1, 1, 1],

    The computation is launched using the method run() with default arguments

    with Hdf5(mode='r+') as io:,
  • . This is an extension of where it is possible to build a reactangular pile of cubes

  •, . These examples are a different treatment of the same example but the construction of the scene and the simulation are separated into differents. In that way, it is possible to produce a scene file and then to perfoms several simulations. Furthermore, if the result of the simulation is stored in the hdf5 file, we restart from the last state of the system to continue the simulation. it is alo possible to concatenate in time several simulations in that way.

  • . This is an example where two shapes are fixed to the same mechanical system. It allows to build clusters and to get some complex contact shapes.

  •, This simple example provides one with a simple simulation where the performance of Lie integrator are important for long term simulation of rotating bodie in a stable way. It allows also to test large inertia ratio in the solver.

  • . This test shos how to build a collection of convexhull shapes

  • . This test file performs the test of contacting pairs of various nature (primitive, convex hull). Meshes have to be added.

  • This example is a little more complex one where the a collection of polyhedra falls down into an hopper.