问题
TL;DR
At present, I'm tinkering with a simple clutter-generation Python script.
Where can I find information on how to best "minimize" energy in a plant that I wish to forward simulate, possibly by "damping" the parameters for MultibodyPlant
's contact model?
My desire is to be able to forward simulate clutter falling into a sink (or bin), and effectively have the kinetic energy be dampened out (i.e. no bouncing), in such a way that hopefully doesn't make the integration too stiff. For now, I'm fine if this is a "non-physical" hack.
I have seen the following Doxygen sections:
- Doxygen C++: Contact Modeling in Drake
- Doxygen C++: MultibodyPlant - that's where I got the reference to contact modeling and all.
I see options for changing stiction tolerance (in my mind, I would want less slipping, but decreasing this would cause more assertion failures?), as well as time step (accuracy / stiffness, at the trade-off of computation time). I have not yet come across damping terms that I can tune.
One option I have in mind too is to just use AdvanceTo(t + dt)
, and in between steps, do some simple heuristics to "remove" energy (e.g. see if there was a direction change, and strip out velocity if there was). My guess is this won't really help computation time if the system is still stiff.
Background
Effectively, this script is just porting a form of Naveen's prior library (which was in the attic, used RigidBodyTree
) to use MultibodyPlant
:
drake@f2808c7a:attic/manipulation/scene_generation
My goal is to have quick computation (via wall clock time) to generate novel clutter scenes that are "settled" to a certain extent.
I have a simple toy example working (I can spawn and drop objects into a kitchen sink), but have found that in order to spawn objects where their initial conditions do not cause non-physical behavior / numeric instability (e.g. interpenetrating objects), I am injecting too much "energy" into the system (I spawn them within a box in the xy-plane, but I space them out along z s.t. the initial configuration has no penetration).
I am toying with different ways to "minimize" that energy and make the objects settle with as little compute time as possible.
Some things I've tried briefly:
- Just forward-simulate within non-penetrating initial conditions. This is fine, but (possibly due to settings in the compliant contact model) it can take a while to settle, and/or there's so much energy that objects will bounce out of the sink. On the "take a while" part,
- Use the Anzu version of the-soon-to-be-published Collision Remover, with "zero-height" of all objects as the starting point, and the original spawning height as the "collision free" state. This works, but can be computationally expensive for a large number of objects (>5), and overall much slower than just using forward simulation to settle the objects.
- Try to write a naive height-minimizing
MathematicalProgram
in conjunction usingMinimumDistanceConstraint
. This is slow and rather brittle, though possible it could use more tuning. Example code here.
Disclaimer: I am a TRI Anzu / Drake Developer, but just ignorant of the more intricate parts of Drake's physical simulation setup :P
回答1:
I have always thought that the "right" solution to this is to write a small mathematical program that solves for the fixed point (static equilibrium: v=v̇=0) of the problem. For the manipulator equations, when v=0 a bunch of the terms disappear. Solving this globally is ugly and non-convex, but once you know which forces should be non-zero (perhaps by simulating a little), then it should be quite fast, I would think.
回答2:
Thank y'all for the answers!
For the time being, I went the (sadder) hack route, which is even simpler heuristics:
generate_poses_sink_clutter.py, height_heuristic(...)
https://github.com/RobotLocomotion/drake/issues/13332#issuecomment-632335186
In this case, the height heuristic runs in about 5ms (even in Python), while the MathematicalProgram
variants (at least the poor-man versions I wrote) tend to take >500ms.
Would love to come back and revisit this!
来源:https://stackoverflow.com/questions/61841013/how-to-dampen-multibodyplants-compliant-contact-model-in-a-simulation