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

Type Body

object --+
         |
        Body


The rigid body class encapsulating the ODE body.

This class represents a rigid body that has a location and orientation in space and that stores the mass properties of an object.

When creating a Body object you have to pass the world it belongs to as argument to the constructor:
 >>> import ode
 >>> w = ode.World()
 >>> b = ode.Body(w)

Method Summary
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __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
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  addForce(f)
Add an external force f given in absolute coordinates.
  addForceAtPos(f, p)
Add an external force f at position p.
  addForceAtRelPos(f, p)
Add an external force f at position p.
  addRelForce(f)
Add an external force f given in relative coordinates (relative to the body's own frame of reference).
  addRelForceAtPos(f, p)
Add an external force f at position p.
  addRelForceAtRelPos(f, p)
Add an external force f at position p.
  addRelTorque(t)
Add an external torque t given in relative coordinates (relative to the body's own frame of reference).
  addTorque(t)
Add an external torque t given in absolute coordinates.
  disable()
Manually disable a body.
  enable()
Manually enable a body.
3-tuple getAngularVel()
Get the current angular velocity of the body.
3-tuple getFiniteRotationAxis()
Return the current finite rotation axis of the body.
mode (0/1) getFiniteRotationMode()
Return the current finite rotation mode of a body (0 or 1).
3-tuple getForce()
Return the current accumulated force.
bool getGravityMode()
Return True if the body is influenced by the world's gravity.
3-tuple getLinearVel()
Get the current linear velocity of the body.
mass getMass()
Return the mass properties as a Mass object.
int getNumJoints()
Return the number of joints that are attached to this body.
3-tuple getPointVel(p)
Utility function that takes a point p on a body and returns that point's velocity in global coordinates.
3-tuple getPosition()
Return the current position of the body.
3-tuple getPosRelPoint(p)
This is the inverse of getRelPointPos().
4-tuple getQuaternion()
Return the current rotation as a quaternion.
3-tuple getRelPointPos(p)
Utility function that takes a point p on a body and returns that point's position in global coordinates.
3-tuple getRelPointVel(p)
Utility function that takes a point p on a body and returns that point's velocity in global coordinates.
9-tuple getRotation()
Return the current rotation matrix as a tuple of 9 floats (row-major order).
3-tuple getTorque()
Return the current accumulated torque.
bool isEnabled()
Check if a body is currently enabled.
  setAngularVel(vel)
Set the angular velocity of the body.
  setFiniteRotationAxis(a)
Set the finite rotation axis of the body.
  setFiniteRotationMode(mode)
This function controls the way a body's orientation is updated at each time step.
  setForce(f)
Set the body force accumulation vector.
  setGravityMode(mode)
Set whether the body is influenced by the world's gravity or not.
  setLinearVel(vel)
Set the linear velocity of the body.
  setMass(mass)
Set the mass properties of the body.
  setPosition(pos)
Set the position of the body.
  setQuaternion(q)
Set the orientation of the body.
  setRotation(R)
Set the orientation of the body.
  setTorque(t)
Set the body torque accumulation vector.
3-tuple vectorFromWorld(v)
Given a vector v expressed in the world coordinate system, rotate it to the body coordinate system.
3-tuple vectorToWorld(v)
Given a vector v expressed in the body coordinate system, rotate it to the world coordinate system.
    Inherited from object
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(...)
(Constructor)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides:
__builtin__.object.__init__

__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__

__setattr__(...)

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

addForce(f)

Add an external force f given in absolute coordinates. The force is applied at the center of mass.
Parameters:
f - Force
           (type=3-sequence of floats)

addForceAtPos(f, p)

Add an external force f at position p. Both arguments must be given in absolute coordinates.
Parameters:
f - Force
           (type=3-sequence of floats)
p - Position
           (type=3-sequence of floats)

addForceAtRelPos(f, p)

Add an external force f at position p. f is given in absolute coordinates and p in absolute coordinates.
Parameters:
f - Force
           (type=3-sequence of floats)
p - Position
           (type=3-sequence of floats)

addRelForce(f)

Add an external force f given in relative coordinates (relative to the body's own frame of reference). The force is applied at the center of mass.
Parameters:
f - Force
           (type=3-sequence of floats)

addRelForceAtPos(f, p)

Add an external force f at position p. f is given in relative coordinates and p in relative coordinates.
Parameters:
f - Force
           (type=3-sequence of floats)
p - Position
           (type=3-sequence of floats)

addRelForceAtRelPos(f, p)

Add an external force f at position p. Both arguments must be given in relative coordinates.
Parameters:
f - Force
           (type=3-sequence of floats)
p - Position
           (type=3-sequence of floats)

addRelTorque(t)

Add an external torque t given in relative coordinates (relative to the body's own frame of reference).
Parameters:
t - Torque
           (type=3-sequence of floats)

addTorque(t)

Add an external torque t given in absolute coordinates.
Parameters:
t - Torque
           (type=3-sequence of floats)

disable()

Manually disable a body. Note that a disabled body that is connected through a joint to an enabled body will be automatically re-enabled at the next simulation step.

enable()

Manually enable a body.

getAngularVel()

Get the current angular velocity of the body.
Returns:
3-tuple

getFiniteRotationAxis()

Return the current finite rotation axis of the body.
Returns:
3-tuple

getFiniteRotationMode()

Return the current finite rotation mode of a body (0 or 1). See setFiniteRotationMode().
Returns:
mode (0/1)

getForce()

Return the current accumulated force.
Returns:
3-tuple

getGravityMode()

Return True if the body is influenced by the world's gravity.
Returns:
bool

getLinearVel()

Get the current linear velocity of the body.
Returns:
3-tuple

getMass()

Return the mass properties as a Mass object.
Returns:
mass

getNumJoints()

Return the number of joints that are attached to this body.
Returns:
int

getPointVel(p)

Utility function that takes a point p on a body and returns that point's velocity in global coordinates. The point p must be given in global coordinates.
Parameters:
p - Body point (global coordinates)
           (type=3-sequence of floats)
Returns:
3-tuple

getPosition()

Return the current position of the body.
Returns:
3-tuple

getPosRelPoint(p)

This is the inverse of getRelPointPos(). It takes a point p in global coordinates and returns the point's position in body-relative coordinates.
Parameters:
p - Body point (global coordinates)
           (type=3-sequence of floats)
Returns:
3-tuple

getQuaternion()

Return the current rotation as a quaternion. The return value is a list of 4 floats.
Returns:
4-tuple

getRelPointPos(p)

Utility function that takes a point p on a body and returns that point's position in global coordinates. The point p must be given in body relative coordinates.
Parameters:
p - Body point (local coordinates)
           (type=3-sequence of floats)
Returns:
3-tuple

getRelPointVel(p)

Utility function that takes a point p on a body and returns that point's velocity in global coordinates. The point p must be given in body relative coordinates.
Parameters:
p - Body point (local coordinates)
           (type=3-sequence of floats)
Returns:
3-tuple

getRotation()

Return the current rotation matrix as a tuple of 9 floats (row-major order).
Returns:
9-tuple

getTorque()

Return the current accumulated torque.
Returns:
3-tuple

isEnabled()

Check if a body is currently enabled.
Returns:
bool

setAngularVel(vel)

Set the angular velocity of the body.
Parameters:
vel - New angular velocity
           (type=3-sequence of floats)

setFiniteRotationAxis(a)

Set the finite rotation axis of the body. This axis only has a meaning when the finite rotation mode is set (see setFiniteRotationMode()).
Parameters:
a - Axis
           (type=3-sequence of floats)

setFiniteRotationMode(mode)

This function controls the way a body's orientation is updated at each time step. The mode argument can be:
  • 0: An "infinitesimal" orientation update is used. This is fast to compute, but it can occasionally cause inaccuracies for bodies that are rotating at high speed, especially when those bodies are joined to other bodies. This is the default for every new body that is created.
  • 1: A "finite" orientation update is used. This is more costly to compute, but will be more accurate for high speed rotations. Note however that high speed rotations can result in many types of error in a simulation, and this mode will only fix one of those sources of error.
Parameters:
mode - Rotation mode (0/1)
           (type=int)

setForce(f)

Set the body force accumulation vector.
Parameters:
f - Force
           (type=3-tuple of floats)

setGravityMode(mode)

Set whether the body is influenced by the world's gravity or not. If mode is True it is, otherwise it isn't. Newly created bodies are always influenced by the world's gravity.
Parameters:
mode - Gravity mode
           (type=bool)

setLinearVel(vel)

Set the linear velocity of the body.
Parameters:
vel - New velocity
           (type=3-sequence of floats)

setMass(mass)

Set the mass properties of the body. The argument mass must be an instance of a Mass object.
Parameters:
mass - Mass properties
           (type=Mass)

setPosition(pos)

Set the position of the body.
Parameters:
pos - The new position
           (type=3-sequence of floats)

setQuaternion(q)

Set the orientation of the body. The quaternion must be given as a sequence of 4 floats.
Parameters:
q - Quaternion
           (type=4-sequence of floats)

setRotation(R)

Set the orientation of the body. The rotation matrix must be given as a sequence of 9 floats which are the elements of the matrix in row-major order.
Parameters:
R - Rotation matrix
           (type=9-sequence of floats)

setTorque(t)

Set the body torque accumulation vector.
Parameters:
t - Torque
           (type=3-tuple of floats)

vectorFromWorld(v)

Given a vector v expressed in the world coordinate system, rotate it to the body coordinate system.
Parameters:
v - Vector in world coordinate system
           (type=3-sequence of floats)
Returns:
3-tuple

vectorToWorld(v)

Given a vector v expressed in the body coordinate system, rotate it to the world coordinate system.
Parameters:
v - Vector in body coordinate system
           (type=3-sequence of floats)
Returns:
3-tuple

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