Class: dworld

Luxinia uses only one world (ode can simulate multiple worlds) for the sake of simplicity. The dworld class controls the parameters of the ode object. But it also has some special functions like a surfacemanagement system. You can specify 256 different types of surface parametersets that directly set how contacts will react at each other. Each dgeom has a surfaceid and the combination of the two surfaceids will tell the automatic contactgenerator what set of surfaceparameters should be used.

Hierarchy

o-+ ode
  o-+ dworld

Methods:

Method overview:


new ()
returns: (dworld)
creates a new world. Can be activated using dworld.active(world). Worlds share surfaceid data.
active ([dworld])
returns: ([dworld])
Sets or gets active dworld. Will be used for all following operations for that world.
activebodies ()
returns: (int)
Returns the number of currently active bodies.
autodisable ([boolean on])
returns: ([boolean])
if switched off, bodies won't be disabled. Disabled bodies are no longer consuming CPU power.
autodisableang ([float])
returns: ([float])
angular velocity at which the body is disabled.
autodisablesteps ([int])
returns: ([int])
trace depth of activation if an enabled body hits a group of disabled bodies.
autodisabletime ([float])
returns: ([float])
minimum time until a body can be disabled after exceeding one of the thresholds.
autodisablevel ([float])
returns: ([float])
velocity at which the body is disabled.
cfm ([double cfm])
returns: (double erp)
set/get Constraint force mixing parameter (should be around 10e-9 to 1, default=10e-5)
collidetest (dspace space)
returns: ()
runs collisiondetection on space (and spaces in that space), resets collisionbuffer
collisioncount ()
returns: ([int])
gets number of calculated collisions
collisionget (int index)
returns: ([dgeom a,dgeom b])
gets two geoms that may are colliding
contactcount ()
returns: (n)
returns the current number of contacts in the world
contactmaxcorrectingvel ([float])
returns: ([float])
Set and get the maximum correcting velocity that contacts are allowed to generate. The default value is infinity (i.e. no limit). Reducing this value can help prevent "popping" of deeply embedded objects.
contactsurfacelayer ([float depth])
returns: ([float])
Set and get the depth of the surface layer around all geometry objects. Contacts are allowed to sink into the surface layer up to the given depth before coming to rest. The default value is zero. Increasing this to some small value (e.g. 0.001) can help prevent jittering problems due to contacts being repeatedly made and broken.
count ()
returns: (int)
returns sum of spaces,geoms,bodies,joints,jointgroups currently in memory
dinfinity ()
returns: (float)
ODE Infinity value, used by some joints.
erp ([double erp])
returns: (double erp)
set/get Error Reduction Parameter (should be 0< erp < 1, default=0.2)
get (int index)
returns: ([dgeom/djoint/djointgroup])
each geom,joint and jointgroup (and all child classes) are stored in a global list that can be traversed.
getactivebody (int index)
returns: ([dbody])
Returns active (enabled) body of given index. If the index is larger than the active body count, nil is returned.
gravity ([double x,y,z])
returns: (double x,y,z)
set/get gravity
iterations ([int])
returns: ([int])
sets/gets number of iterations for quickstep
jointempty ()
returns: ()
Deletes all contact joints, automaticly done by makecontacts
makecontacts ()
returns: ()

run this after collidetest if you want to autogenerate the contact joints. This will automaticly reset the default contactgroup.

This method may crash if geoms has been deleted between the collidetest and the call on makecontacts. This can happen for example if the garbage collector collects a geom in between. Make sure that if an object is to be deleted, it is gone before you do the collidetest (by calling the :delete() function or enforcing the garbage collection (which is costly))
maxcollisions (int size)
returns: ([int])
sets/gets maximum number of traceable collisions. Per default this is 4000.
quickstep (float stepsize)
returns: ()
make a quickstep in simulation
randomseed ([int seed])
returns: ([int seed])
set/get random seed (for all worlds)
step (float stepsize)
returns: ()
make a step in simulation. We disadvise to use this function unless you are sure about its consequences. Simulations tend to produce strange error messages plus it is slower than quickstep.
surfacebitapprox1 (int surfaceid,[boolean])
returns: ([boolean])
Use the friction pyramid approximation for friction direction 1. If this is not specified then the constant-force-limit approximation is used (and mu is a force limit).
surfacebitapprox2 (int surfaceid,[boolean])
returns: ([boolean])
Use the friction pyramid approximation for friction direction 2. If this is not specified then the constant-force-limit approximation is used (and mu is a force limit).
surfacebitbounce (int surfaceid,[boolean])
returns: ([boolean])
If set, the contact surface is bouncy, in other words the bodies will bounce off each other. The exact amount of bouncyness is controlled by the bounce parameter.
surfacebitfdir (int surfaceid,[boolean])
returns: ([boolean])
Compute the fdir vector using the given normals of the geoms.
surfacebitmotion1 (int surfaceid,[boolean])
returns: ([boolean])
If set, the contact surface is assumed to be moving independently of the motion of the bodies. This is kind of like a conveyor belt running over the surface. When this flag is set, motion1 defines the surface velocity in friction direction 1.
surfacebitmotion2 (int surfaceid,[boolean])
returns: ([boolean])
The same thing as above, but for friction direction 2.
surfacebitmu2 (int surfaceid,[boolean])
returns: ([boolean])
If not set, use mu for both friction directions. If set, use mu for friction direction 1, use mu2 for friction direction 2.
surfacebitslip1 (int surfaceid,[boolean])
returns: ([boolean])
Force-dependent-slip (FDS) in friction direction 1.
surfacebitslip2 (int surfaceid,[boolean])
returns: ([boolean])
Force-dependent-slip (FDS) in friction direction 2.
surfacebitsoftcfm (int surfaceid,[boolean])
returns: ([boolean])
If set, the constraint force mixing parameter of the contact normal can be set with the soft_cfm parameter. This is useful to make surfaces soft.
surfacebitsofterp (int surfaceid,[boolean])
returns: ([boolean])
If set, the error reduction parameter of the contact normal can be set with the soft_erp parameter. This is useful to make surfaces soft.
surfacebounce (int surfaceid,[float])
returns: ([float])
surfacebouncevel (int surfaceid,[float])
returns: ([float])
surfacecombination (int s1,int s2,[int matid])
returns: ([int])
sets/gets the result for the surfacecombination s1 and s2 (then the surface with surfaceid is selected for the contact parameters. The parameters s1 and s2 are symmetric, so the result for s2 and s1 is the same as for s1 and s2.
surfacefdirid (int surfaceid,[int])
returns: ([int])
specify the surfaceid of the geom that's fdir normal should be used. If both have the same surface id, the first geom found is used and the outcoming is undefined. The fdirid is only used if the fdirmixmode is set to 4 or 11.
surfacefdirmixmode (int surfaceid,[int mode])
returns: ([int])

The fdirmixmode specifies how the fdir vectors of different geoms should be handled. The mode values are:

  1. use higher surfaceid = 0
  2. use lower surfaceid = 1
  3. use higher fdirpriority of geom = 2
  4. use lower fdirpriority of geom = 3
  5. use specified ID of surface = 4
  6. mix the fdirs by average = 5
  7. mix the fdirs using the priorities (prio1+prio2)/prio1*normal1 + (prio1+prio2)/prio2*normal2 = normal = 6

  8. use higher surfaceid as world coordinates = 7
  9. use lower surfaceid as world coordinates = 8
  10. use higher priority as world coordinates = 9
  11. use lower priority as world coordinates = 10
  12. use specified ID of surface = 11
  13. use average fdirs as world coordinates = 12
  14. mix the fdirs as world coordinates based on priorities = 13

surfacemotion1 (int surfaceid,[float])
returns: ([float])
surfacemotion2 (int surfaceid,[float])
returns: ([float])
surfacemu (int surfaceid,[float])
returns: ([float])
surfacemu2 (int surfaceid,[float])
returns: ([float])
surfaceslip1 (int surfaceid,[float])
returns: ([float])
surfaceslip2 (int surfaceid,[float])
returns: ([float])
surfacesoftcfm (int surfaceid,[float])
returns: ([float])
surfacesofterp (int surfaceid,[float])
returns: ([float])

Inherited Methods: