Collision of a MechanicalObject with a shape #4145
-
Hello guys, I'm a beginner to programming on SOFA. I created a code in XML to make a shape of a specific object using the MechanicalObject and also added MeshTopology of lines. From what I have seen in other codes, using a collision model depending on the topology used seemed to work fine. I have attached the code here. When I run the simulation, the objects don't interact with each other and the particle used keeps falling without colliding. Any help that I can get will be really useful. Replacing this particle with a ball or a cube would also be useful if that is possible. <?xml version="1.0"?>
<Node name="root" gravity="0 -9.81 0" dt="0.01" bbox="-3 -6 -3 3 3 3">
<RequiredPlugin name="BeamAdapter"/> <!-- Needed to use components [WireBeamInterpolation WireRestShape] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase DefaultPipeline] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [LocalMinDistance] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel PointCollisionModel TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [DefaultContactManager] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [LinearSolverConstraintCorrection] -->
<RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [LCPConstraintSolver] -->
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedConstraint] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [BTDLinearSolver] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [EdgeSetTopologyContainer, EdgeSetTopologyModifier, PointSetTopologyContainer, PointSetTopologyModifier] -->
<VisualStyle displayFlags="showBehaviorModels showCollisionModels hideBoundingCollisionModels showForceFields" />
<DefaultAnimationLoop />
<DefaultVisualManagerLoop />
<LCPConstraintSolver mu='0.1' tolerance='1e-10' maxIt='1000' build_lcp='false' />
<DefaultPipeline draw='0' depth='6' verbose='1' />
<BruteForceBroadPhase name='N2' />
<BVHNarrowPhase />
<LocalMinDistance contactDistance='1' alarmDistance='5' name='localmindistance' angleCone='0.02' />
<DefaultContactManager name='Response' response='FrictionContactConstraint' />
<Node name="BeamModel">
<EulerImplicitSolver rayleighStiffness="1000" rayleighMass="0" printLog="false" />
<BTDLinearSolver verbose="0"/>
<MechanicalObject template="Rigid3d" name="DOFs" position="0 0 0 0 0 0 1 2 0 0 0 0 0 1 4 0 0 0 0 0 1 6 0 0 0 0 0 1 8 0 0 0 0 0 1 9 -0.5 0 0 0 -0.385 0.924"/>
<MeshTopology name="lines" lines="0 1 1 2 2 3 3 4 4 5" />
<FixedConstraint name="FixedConstraint" indices="0" />
<BeamInterpolation name="BeamInterpolation" radius="0.1" />
<AdaptiveBeamForceFieldAndMass name="BeamForceField" computeMass="1" massDensity="10"/>
<Node name="CollisionModel">
<EdgeSetTopologyContainer name='collisEdgeSet' />
<EdgeSetTopologyModifier name='colliseEdgeModifier' />
<MechanicalObject name='CollisionDOFs' />
<LineCollisionModel proximity="0.0" />
</Node>
</Node>
<Node name="particle1">
<EulerImplicitSolver />
<CGLinearSolver iterations="200" tolerance="1e-09" threshold="1e-09" />
<MeshTopology name="points"/>
<PointSetTopologyContainer name='collispointset'/>
<PointSetTopologyModifier name='pointmodifier'/>
<MechanicalObject template="Vec3d" name="particlefall" position="9 5 0 0 0 0 1" />
<UniformMass totalMass="20" />
<PointCollisionModel moving="0" simulated="0" />
</Node>
</Node> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
You want to use Langrangian-based constraints. For this to be computed correctly you need to use a Secondly, to solve correctly the constraints you'll also nee a |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
You want to use Langrangian-based constraints. For this to be computed correctly you need to use a
FreeMotionAnimationLoop
, because the DefaultAnimationLoop doesn't compute all the steps needed for the constraints to be computed.Secondly, to solve correctly the constraints you'll also nee a
LinearConstraintCorrection
inside of every mechanical node (BeamModel1 and particle1).