Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Substance Class Reference

Physical substance definition, used for collision detection/treatment What we need is mu, slip and kp,kd parameter for the collision Definition of substance parameters: More...

#include <substance.h>

Inheritance diagram for Substance:
Collaboration diagram for Substance:

Public Member Functions

 Substance ()
 
 Substance (float roughness, float slip, float hardness, float elasticity)
 
void setCollisionCallback (CollisionCallback func, void *userdata)
 
void toDefaultSubstance ()
 
void toMetal (float roughness)
 very hard and elastic with slip roughness [0.1-1] More...
 
void toRubber (float hardness)
 high roughness, no slip, very elastic, hardness : [5-50] More...
 
void toPlastic (float roughness)
 medium slip, a bit elastic, medium hardness, roughness [0.5-2] More...
 
void toFoam (float _hardness)
 large slip, not elastic, low hardness [1-30], high roughness More...
 
void toSnow (float _slip)
 variable slip and roughness, not elastic, high hardness for solid snow slip = 1 <–> roughness=0.0, slip = 0 <–> roughnes=1.0 More...
 
void toNoContact ()
 set the collsion callback to ignores everything Usually it is better to use the "ignorePairs" from odeHandle but if this particular one substance should not collide with any other, this is easier. More...
 
void toAnisotropFriction (double ratio, const Axis &axis)
 enables anisotrop friction. More...
 

Static Public Member Functions

static void getSurfaceParams (dSurfaceParameters &sp, const Substance &s1, const Substance &s2, double stepsize)
 Combination of two surfaces. More...
 
static void printSurfaceParams (const dSurfaceParameters &surfParams)
 
static Substance getDefaultSubstance ()
 default substance is plastic with roughness=0.8 More...
 
static Substance getMetal (float roughness)
 very hard and elastic with slip roughness [0.1-1] More...
 
static Substance getRubber (float hardness)
 high roughness, no slip, very elastic, hardness : [5-50] More...
 
static Substance getPlastic (float roughness)
 medium slip, a bit elastic, medium hardness, roughness [0.5-2] More...
 
static Substance getFoam (float _hardness)
 large slip, not elastic, low hardness [1-30], high roughness More...
 
static Substance getSnow (float _slip)
 variable slip and roughness [0-1], not elastic, high hardness for solid snow slip = 1 <–> roughness=0.0, slip = 0 <–> roughnes=1.0 More...
 
static Substance getNoContact ()
 

Public Attributes

float roughness
 
float slip
 
float hardness
 
float elasticity
 
CollisionCallback callback
 
void * userdata
 

Detailed Description

Physical substance definition, used for collision detection/treatment What we need is mu, slip and kp,kd parameter for the collision Definition of substance parameters:

  Parameter    interval  collision_parameter
  roughness:  [0-]      mu   = roughness1*roughness2
  slip:       [0-]      slip = slip1+slip2
  hardness:   [0-]      kp   = hardness1 * hardness2 / (hardness1 + hardness2) (two springs serial)
  elasticity: [0-1]     kd   = (1-elasticity1) * s2.hardness + (1-elasticity2) * s1.hardness) /
                               (s1.hardness + s2.hardness);

For the calculation of the spring/damping constant we use the following schema: The collision can be considered as 2 springs serially connected. The spring constant of each collision side is given by hardness (here kp). The spring constant of the entire spring is given by

\[ 1/kp = 1/kp_1 + 1/kp_2\]

. The damping (kd) is derived from the elasticity (e), but it is more difficult to compute. Consider the damping in form of energy lost. We can write the energy or work done by each spring as:

\[ W_i = F*s_i = F^2/p \]

with

\[s_i=F*kp_i\]

. The energy lost though damping is

\[ W_1^D = W_i*(1-e_i) \]

. The final damping is now:

\[ kd = (1-e) = W^D/W = \frac{(1-e_1)/kp_1 + (1-e_2)/kp_2}{1/kp_1 + 1/kp_2} = \frac{(1-e_1)kp_2 + (1-e_2)kp_1}{kp_1+kp_2}\]

.

Note that you cannot add any member variables to derived classes since they do not fit into the substance object in OdeHandle!

Constructor & Destructor Documentation

Substance ( )
Substance ( float  roughness,
float  slip,
float  hardness,
float  elasticity 
)

Member Function Documentation

Substance getDefaultSubstance ( )
static

default substance is plastic with roughness=0.8

Substance getFoam ( float  _hardness)
static

large slip, not elastic, low hardness [1-30], high roughness

Substance getMetal ( float  roughness)
static

very hard and elastic with slip roughness [0.1-1]

Substance getNoContact ( )
static
See Also
toNoContact()
Substance getPlastic ( float  roughness)
static

medium slip, a bit elastic, medium hardness, roughness [0.5-2]

Substance getRubber ( float  hardness)
static

high roughness, no slip, very elastic, hardness : [5-50]

Substance getSnow ( float  _slip)
static

variable slip and roughness [0-1], not elastic, high hardness for solid snow slip = 1 <–> roughness=0.0, slip = 0 <–> roughnes=1.0

void getSurfaceParams ( dSurfaceParameters &  sp,
const Substance s1,
const Substance s2,
double  stepsize 
)
static

Combination of two surfaces.

void printSurfaceParams ( const dSurfaceParameters &  surfParams)
static
void setCollisionCallback ( CollisionCallback  func,
void *  userdata 
)
void toAnisotropFriction ( double  ratio,
const Axis axis 
)

enables anisotrop friction.

The friction along the given axis is ratio fold of the friction in the other directions. If ratio = 0.1 and axis=Axis(0,0,1) then the fiction along the z-axis is 1/10th of the normal friction. Useful to mimic scales of snakes or the like. WARNING: this sets the collisionCallback! To disable the collisionCallback has to set to 0 manually

void toDefaultSubstance ( )
void toFoam ( float  _hardness)

large slip, not elastic, low hardness [1-30], high roughness

void toMetal ( float  roughness)

very hard and elastic with slip roughness [0.1-1]

void toNoContact ( )

set the collsion callback to ignores everything Usually it is better to use the "ignorePairs" from odeHandle but if this particular one substance should not collide with any other, this is easier.

WARNING: this sets the collisionCallback. This will not convert to other substances without manually setting the callback to 0

void toPlastic ( float  roughness)

medium slip, a bit elastic, medium hardness, roughness [0.5-2]

void toRubber ( float  hardness)

high roughness, no slip, very elastic, hardness : [5-50]

void toSnow ( float  _slip)

variable slip and roughness, not elastic, high hardness for solid snow slip = 1 <–> roughness=0.0, slip = 0 <–> roughnes=1.0

Member Data Documentation

float elasticity
float hardness
float roughness
float slip
void* userdata

The documentation for this class was generated from the following files: