velocity=[0, 0, -1.0], mass=1., inertia=2.0) # the ground object made with the ground shape. As the mass is # not given, it is a static object only involved in contact # detection. io.add_object('ground', [Contactor('Ground')], translation=[0, -.5]) # Run the simulation from the inputs previously defined and add # results to the hdf5 file. The visualisation of the output may be done # with the vview command. bullet_options = SiconosBulletOptions() bullet_options.worldScale = 1.0 bullet_options.contactBreakingThreshold = 0.04 bullet_options.dimension = SICONOS_BULLET_2D bullet_options.perturbationIterations = 0 bullet_options.minimumPointsPerturbationThreshold = 0 options = sk.solver_options_create(sn.SICONOS_FRICTION_2D_NSGS) options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = 100000 options.dparam[sn.SICONOS_DPARAM_TOL] = 1e-8 T = 2.0 if restart: T = 2.0 #T=1*0.001 hstep = 0.01 run_options = MechanicsHdf5Runner_run_options() run_options['t0'] = 0
#!/usr/bin/env python # # Example of one object under gravity with one contactor and a ground # using the Siconos proposed mechanics API # from siconos.mechanics.collision.tools import Contactor from siconos.io.mechanics_run import MechanicsHdf5Runner import siconos.numerics as Numerics from siconos.mechanics.collision.bullet import SiconosBulletOptions import numpy as np options = SiconosBulletOptions() options.worldScale = 1.0 options.contactBreakingThreshold = 0.01 sphere_count = 0 cluster_count = 0 def add_sphere_cluster(io, radius, n_spheres=8, dispersion=None, translation=None, orientation=None, mass=1, tob=-1): global sphere_count global cluster_count