Giter Site home page Giter Site logo

Soft bodies collisions about ambf HOT 1 OPEN

wpi-aim avatar wpi-aim commented on July 18, 2024
Soft bodies collisions

from ambf.

Comments (1)

adnanmunawar avatar adnanmunawar commented on July 18, 2024

Thanks for creating this issue. Based on our discussion in the email I hope things are moving in a better direction. I shall paste the major points here for reference and then hopefully, very soon, I can create a new section in the WIKI detailing the scope and limitations of softbody simulations.

  1. As you rightly noticed, there are some flags that we can play with to improve the simulation. I would recommend using the following flags (-l , -p and -t) for soft-body simulation. As an example,

./ambf_simulation -l 22 -t 1 -p 60

These flags are defined as -l (L not I) as the index of the body to load. The 22 index is a primitive ''box'' shape acting as the ground rather than the default ''plane'' primitive shape. I find that the box primitive shape has better SB collision as it reduces ''tunneling'' for bodies that are freely moving in the simulation. The -t flag is to disable dynamic stepping and the -p flag is the frequency of the physics loop. The -t and -p flags are not necessary, but unless you want to do a real-time interaction with the soft-body, I would suggest that you use them, as they give much better solution convergence by not forcing the soft-body solver to terminate to match real-time stepping.

Now you can simply run your softbody example as:
./ambf_simulation -l 22 -t 1 -p 60 -a <path + filename to your .yaml file>
You can even add more bodies to the simulation by adding more indexes to the -l flag.

You can also use the -h flag to list all the command-line options.

I am attaching some examples of softbody examples as well.
softbody_examples.zip

  1. With the example of the cloth that you shared, it is indeed true that the collision is weird. This is because Bullet only handles the collisions at the vertices (softbody nodes) by default. As the cloth is made up of sparse and finite vertices, the PSM's tip just passes through the cloth. Now all hope is not lost. One option is to increase the collision "margin" parameter in the softbody which increases the collision radius of softbody nodes. As you can see, this is not ideal if your vertices are sparsely populated as it ends up giving thickness to the cloth, which might not be desirable.
    So what else can we do? Well, the best solution so far is to use clustering. In a nutshell, clustering essentially forms deformable primitives from a sparse softbody mesh for collision purposes and enables whole body collision and even self collision. To do so, you can play around with some flags in a softbody. I need to document them better, but here is an example.
 soft bodies: [BODY Cheese]
joints: []
high resolution path: ./high_res/
low resolution path: ./low_res/
ignore inter-collision: false
namespace: /ambf/env/cheese/
BODY Cheese:
  name: Cheese
  mesh: Cheese.STL
  mass: 10.0
  collision margin: 0.001
  scale: 1.0
  location:
    orientation: {p: -0.0, r: 0.0, y: 0.0}
    position: {x: -1.3, y: 0.0, z: -1.0}
  color components:
    ambient: {level: 1.0}
    diffuse: {b: 0.0, g: 0.4941, r: 0.8}
    specular: {b: 1.0, g: 1.0, r: 1.0}
    transparency: 1.0
  config: {
    kDP: 0.001, # damping
    kDF: 10.0,  #
    kMT: 0.001,
    clusters: 0,
    flags: 18,
    }

The fields clusters (integer) and flags (integer converted to hex) are the relevant fields and they are internal parameters of Bullet. Based on the clustering, one requires appropriate collision flags. Again, we need to better document the meaning of these numbers in the wiki but this should be a good starting point.

  1. I would also suggest modifying the collision shapes of the PSM's links. You may use the newer version of the Blender Addon at https://github.com/WPI-AIM/ambf_addon to visually generate and place the collision shapes (Tutorial Comming Out Soon). For the moment, all the PSM collision shapes are meshes rather than primitives which isn't ideal. I do plan on addressing this myself and I shall update you once I have done so.

Finally, thanks for your patience. I am finally going to be working on improving the soft-body support and feature set as part of my new job so stay tuned :).

from ambf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.