Module ode :: Class Mass
[show private | hide private]
[frames | no frames]

Type Mass

object --+
         |
        Mass


Mass parameters of a rigid body.

This class stores mass parameters of a rigid body which can be accessed through the following attributes: This class wraps the dMass structure from the C API.
Method Summary
  __add__(x, y)
x.__add__(y) <==> x+y
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __radd__(x, y)
x.__radd__(y) <==> y+x
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)
  add(b)
Add the mass b to the mass object.
  adjust(newmass)
Adjust the total mass.
  setBox(density, lx, ly, lz)
Set the mass parameters to represent a box of the given dimensions and density, with the center of mass at (0,0,0) relative to the body.
  setBoxTotal(total_mass, lx, ly, lz)
Set the mass parameters to represent a box of the given dimensions and mass, with the center of mass at (0,0,0) relative to the body.
  setCappedCylinder(density, direction, r, h)
Set the mass parameters to represent a capped cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body.
  setCappedCylinderTotal(total_mass, direction, r, h)
Set the mass parameters to represent a capped cylinder of the given parameters and mass, with the center of mass at (0,0,0) relative to the body.
  setCylinder(density, direction, r, h)
Set the mass parameters to represent a flat-ended cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body.
  setCylinderTotal(total_mass, direction, r, h)
Set the mass parameters to represent a flat-ended cylinder of the given parameters and mass, with the center of mass at (0,0,0) relative to the body.
  setParameters(mass, cgx, cgy, cgz, I11, I22, I33, I12, I13, I23)
Set the mass parameters to the given values.
  setSphere(density, radius)
Set the mass parameters to represent a sphere of the given radius and density, with the center of mass at (0,0,0) relative to the body.
  setSphereTotal(total_mass, radius)
Set the mass parameters to represent a sphere of the given radius and mass, with the center of mass at (0,0,0) relative to the body.
  setZero()
Set all the mass parameters to zero.
  translate(t)
Adjust mass parameters.
    Inherited from object
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)

Instance Variable Summary
3-tuple of floats c: The center of gravity position in body frame (cx, cy, cz)
3-tuple of 3-tuples of floats I: The 3x3 inertia tensor in body frame ((I11, I12, I13), (I12, I22, I23), (I13, I23, I33))
float mass: The total mass of the body

Method Details

__add__(x, y)
(Addition operator)

x.__add__(y) <==> x+y
Returns:
x+y

__delattr__(...)

x.__delattr__('name') <==> del x.name
Overrides:
__builtin__.object.__delattr__

__getattribute__(...)

x.__getattribute__('name') <==> x.name
Overrides:
__builtin__.object.__getattribute__

__new__(T, S, ...)

T.__new__(S, ...) -> a new object with type S, a subtype of T
Returns:
a new object with type S, a subtype of T
Overrides:
__builtin__.object.__new__

__radd__(x, y)
(Right-side addition operator)

x.__radd__(y) <==> y+x
Returns:
y+x

__setattr__(...)

x.__setattr__('name', value) <==> x.name = value
Overrides:
__builtin__.object.__setattr__

__str__(x)
(Informal representation operator)

x.__str__() <==> str(x)
Returns:
str(x)
Overrides:
__builtin__.object.__str__

add(b)

Add the mass b to the mass object. Masses can also be added using the + operator.
Parameters:
b - The mass to add to this mass
           (type=Mass)

adjust(newmass)

Adjust the total mass. Given mass parameters for some object, adjust them so the total mass is now newmass. This is useful when using the setXyz() methods to set the mass parameters for certain objects - they take the object density, not the total mass.
Parameters:
newmass - The new total mass
           (type=float)

setBox(density, lx, ly, lz)

Set the mass parameters to represent a box of the given dimensions and density, with the center of mass at (0,0,0) relative to the body. The side lengths of the box along the x, y and z axes are lx, ly and lz.
Parameters:
density - The density of the box
           (type=float)
lx - The length along the x axis
           (type=float)
ly - The length along the y axis
           (type=float)
lz - The length along the z axis
           (type=float)

setBoxTotal(total_mass, lx, ly, lz)

Set the mass parameters to represent a box of the given dimensions and mass, with the center of mass at (0,0,0) relative to the body. The side lengths of the box along the x, y and z axes are lx, ly and lz.
Parameters:
total_mass - The total mass of the box
           (type=float)
lx - The length along the x axis
           (type=float)
ly - The length along the y axis
           (type=float)
lz - The length along the z axis
           (type=float)

setCappedCylinder(density, direction, r, h)

Set the mass parameters to represent a capped cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body. The radius of the cylinder (and the spherical cap) is r. The length of the cylinder (not counting the spherical cap) is h. The cylinder's long axis is oriented along the body's x, y or z axis according to the value of direction (1=x, 2=y, 3=z).
Parameters:
density - The density of the cylinder
           (type=float)
direction - The direction of the cylinder (1=x axis, 2=y axis, 3=z axis)
           (type=int)
r - The radius of the cylinder
           (type=float)
h - The length of the cylinder (without the caps)
           (type=float)

setCappedCylinderTotal(total_mass, direction, r, h)

Set the mass parameters to represent a capped cylinder of the given parameters and mass, with the center of mass at (0,0,0) relative to the body. The radius of the cylinder (and the spherical cap) is r. The length of the cylinder (not counting the spherical cap) is h. The cylinder's long axis is oriented along the body's x, y or z axis according to the value of direction (1=x, 2=y, 3=z).
Parameters:
total_mass - The total mass of the cylinder
           (type=float)
direction - The direction of the cylinder (1=x axis, 2=y axis, 3=z axis)
           (type=int)
r - The radius of the cylinder
           (type=float)
h - The length of the cylinder (without the caps)
           (type=float)

setCylinder(density, direction, r, h)

Set the mass parameters to represent a flat-ended cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body. The radius of the cylinder is r. The length of the cylinder is h. The cylinder's long axis is oriented along the body's x, y or z axis according to the value of direction (1=x, 2=y, 3=z).
Parameters:
density - The density of the cylinder
           (type=float)
direction - The direction of the cylinder (1=x axis, 2=y axis, 3=z axis)
           (type=int)
r - The radius of the cylinder
           (type=float)
h - The length of the cylinder
           (type=float)

setCylinderTotal(total_mass, direction, r, h)

Set the mass parameters to represent a flat-ended cylinder of the given parameters and mass, with the center of mass at (0,0,0) relative to the body. The radius of the cylinder is r. The length of the cylinder is h. The cylinder's long axis is oriented along the body's x, y or z axis according to the value of direction (1=x, 2=y, 3=z).
Parameters:
total_mass - The total mass of the cylinder
           (type=float)
direction - The direction of the cylinder (1=x axis, 2=y axis, 3=z axis)
           (type=int)
r - The radius of the cylinder
           (type=float)
h - The length of the cylinder
           (type=float)

setParameters(mass, cgx, cgy, cgz, I11, I22, I33, I12, I13, I23)

Set the mass parameters to the given values.
Parameters:
mass - Total mass of the body.
           (type=float)
cgx - Center of gravity position in the body frame (x component).
           (type=float)
cgy - Center of gravity position in the body frame (y component).
           (type=float)
cgz - Center of gravity position in the body frame (z component).
           (type=float)
I11 - Inertia tensor
           (type=float)
I22 - Inertia tensor
           (type=float)
I33 - Inertia tensor
           (type=float)
I12 - Inertia tensor
           (type=float)
I13 - Inertia tensor
           (type=float)
I23 - Inertia tensor
           (type=float)

setSphere(density, radius)

Set the mass parameters to represent a sphere of the given radius and density, with the center of mass at (0,0,0) relative to the body.
Parameters:
density - The density of the sphere
           (type=float)
radius - The radius of the sphere
           (type=float)

setSphereTotal(total_mass, radius)

Set the mass parameters to represent a sphere of the given radius and mass, with the center of mass at (0,0,0) relative to the body.
Parameters:
total_mass - The total mass of the sphere
           (type=float)
radius - The radius of the sphere
           (type=float)

setZero()

Set all the mass parameters to zero.

translate(t)

Adjust mass parameters. Given mass parameters for some object, adjust them to represent the object displaced by (x,y,z) relative to the body frame.
Parameters:
t - Translation vector (x, y, z)
           (type=3-tuple of floats)

Instance Variable Details

c

The center of gravity position in body frame (cx, cy, cz)
Type:
3-tuple of floats

I

The 3x3 inertia tensor in body frame ((I11, I12, I13), (I12, I22, I23), (I13, I23, I33))
Type:
3-tuple of 3-tuples of floats

mass

The total mass of the body
Type:
float

Generated by Epydoc 2.1 on Sun Feb 4 17:54:12 2007 http://epydoc.sf.net