opal::ODESimulator Class Reference

The ODE implementation of the Simulator class. More...

#include <ODESimulator.h>

Inheritance diagram for opal::ODESimulator:

opal::Simulator List of all members.

Public Types

enum  SolverType { SOLVER_WORLDSTEP, SOLVER_QUICKSTEP }

Public Member Functions

 ODESimulator ()
void initData (SimulatorData data)
virtual ~ODESimulator ()
virtual void OPAL_CALL destroy ()
virtual void OPAL_CALL setMaxCorrectingVel (real vel)
virtual Solid *OPAL_CALL createSolid ()
virtual Joint *OPAL_CALL createJoint ()
virtual Space *OPAL_CALL createSpace ()
virtual void OPAL_CALL setGravity (const Vec3r &gravity)
virtual Vec3r OPAL_CALL getGravity () const
virtual void OPAL_CALL setSolverAccuracy (SolverAccuracyLevel level)
virtual dWorldID OPAL_CALL internal_getWorldID () const
virtual dSpaceID OPAL_CALL internal_getSpaceID () const
virtual dJointGroupID OPAL_CALL internal_getJointGroupID () const
virtual std::vector< RaycastResult
> &OPAL_CALL 
internal_fireRay (const Rayr &r, real length, const Solid *attachedSolid, unsigned int rayContactGroup)
virtual const VolumeQueryResult
&OPAL_CALL 
internal_queryVolume (const Solid *volume, const Solid *attachedSolid)
void internal_addRaycastResult (Solid *solid, const Point3r &intersection, const Vec3r &normal, real depth)
void internal_addCollidedSolid (Solid *solid)
virtual unsigned int OPAL_CALL internal_getRayContactGroup ()

Protected Member Functions

virtual void stepPhysics ()

Protected Attributes

dWorldID mWorldID
dSpaceID mRootSpaceID
dJointGroupID mContactJointGroupID
SolverType mSolverType
long int mCollisionCount
VolumeQueryResult mVolumeQueryResult
const SolidmSensorSolid
unsigned int mRayContactGroup
std::vector< RaycastResultmRaycastResults

Detailed Description

The ODE implementation of the Simulator class.

Definition at line 49 of file ODESimulator.h.


Member Enumeration Documentation

enum opal::ODESimulator::SolverType
 

The types of ODE constraint solvers.

Enumerator:
SOLVER_WORLDSTEP  Time complexity: O(m^3), space complexity O(m^2), where m = # of constraints.
SOLVER_QUICKSTEP  Time complexity: O(m*N), space complexity O(m), where m = # of constraints and N = # of iterations.

Definition at line 53 of file ODESimulator.h.


Constructor & Destructor Documentation

opal::ODESimulator::ODESimulator  ) 
 

use initData to complete

Definition at line 128 of file ODESimulator.cpp.

opal::ODESimulator::~ODESimulator  )  [virtual]
 

Definition at line 133 of file ODESimulator.cpp.


Member Function Documentation

Joint * opal::ODESimulator::createJoint  )  [virtual]
 

Creates and returns a pointer to a Joint.

Implements opal::Simulator.

Definition at line 162 of file ODESimulator.cpp.

References opal::Simulator::addJoint(), and mWorldID.

Solid * opal::ODESimulator::createSolid  )  [virtual]
 

Creates and returns a pointer to a Solid.

Implements opal::Simulator.

Definition at line 144 of file ODESimulator.cpp.

References opal::Simulator::addSolid(), mRootSpaceID, and mWorldID.

Space * opal::ODESimulator::createSpace  )  [virtual]
 

Creates and returns a pointer to a Space which is a child of the Simulator's root Space.

Implements opal::Simulator.

Definition at line 151 of file ODESimulator.cpp.

References opal::Simulator::addSpace(), opal::ODESpace::internal_getSpaceID(), and mRootSpaceID.

void opal::ODESimulator::destroy  )  [virtual]
 

Deallocates everything within the Simulator. This should be called when finished with everything. Simulator implementations should call "delete this" within this function.

Implements opal::Simulator.

Definition at line 169 of file ODESimulator.cpp.

References mContactJointGroupID, mRootSpaceID, and mWorldID.

Vec3r opal::ODESimulator::getGravity  )  const [virtual]
 

Returns the gravity used in the simulation.

Implements opal::Simulator.

Definition at line 1144 of file ODESimulator.cpp.

References opal::defaults::gravity, and mWorldID.

void opal::ODESimulator::initData SimulatorData  data  )  [virtual]
 

complete creation

Reimplemented from opal::Simulator.

Definition at line 68 of file ODESimulator.cpp.

References opal::defaults::shape::contactGroup, opal::defaults::ode::globalCFM, opal::defaults::gravity, opal::SimulatorData::hashMaxLevel, opal::SimulatorData::hashMinLevel, opal::Simulator::initData(), opal::defaults::ode::maxERP, mCollisionCount, mContactJointGroupID, opal::defaults::ode::minERP, mRayContactGroup, opal::Simulator::mRootSpace, mRootSpaceID, mSensorSolid, mWorldID, opal::SimulatorData::octreeDepth, setGravity(), setSolverAccuracy(), opal::defaults::solverAccuracy, opal::defaults::ode::surfaceLayer, opal::SimulatorData::useOctreeInsteadHash, opal::SimulatorData::worldCenter, and opal::SimulatorData::worldSize.

Referenced by opal::createCustomSimulator(), and opal::createSimulator().

void opal::ODESimulator::internal_addCollidedSolid Solid solid  ) 
 

Helper function for volume collision checking.

Definition at line 1015 of file ODESimulator.cpp.

References opal::VolumeQueryResult::internal_addSolid(), opal::ODESolid::internal_getCollisionCount(), opal::ODESolid::internal_setCollisionCount(), mCollisionCount, mSensorSolid, and mVolumeQueryResult.

Referenced by opal::ode_hidden::internal_volumeCollisionCallback().

void opal::ODESimulator::internal_addRaycastResult Solid solid,
const Point3r intersection,
const Vec3r normal,
real  depth
 

Helper function used for ray casting which stores RaycastResults.

Parameters:
depth How far the ray went into the object.

Definition at line 1033 of file ODESimulator.cpp.

References opal::RaycastResult::distance, opal::RaycastResult::intersection, mRaycastResults, mSensorSolid, opal::RaycastResult::normal, and opal::RaycastResult::solid.

vector< RaycastResult > & opal::ODESimulator::internal_fireRay const Rayr r,
real  length,
const Solid attachedSolid,
unsigned int  rayContactGroup
[virtual]
 

Helper function used for ray casting. Immediately fires a ray into the scene and returns intersections results. Uses the ray's contact group parameter to limit collision checks.

Implements opal::Simulator.

Definition at line 1077 of file ODESimulator.cpp.

References opal::Rayr::getDir(), opal::Rayr::getOrigin(), opal::ode_hidden::internal_raycastCollisionCallback(), mRaycastResults, mRayContactGroup, mRootSpaceID, mSensorSolid, and opal::Vec3r::unit().

dJointGroupID opal::ODESimulator::internal_getJointGroupID  )  const [virtual]
 

Definition at line 1194 of file ODESimulator.cpp.

References mContactJointGroupID.

Referenced by opal::ode_hidden::internal_collisionCallback().

unsigned int opal::ODESimulator::internal_getRayContactGroup  )  [virtual]
 

Helper function used for ray casting.

Definition at line 1052 of file ODESimulator.cpp.

References mRayContactGroup.

Referenced by opal::ode_hidden::internal_raycastCollisionCallback().

dSpaceID opal::ODESimulator::internal_getSpaceID  )  const [virtual]
 

Definition at line 1189 of file ODESimulator.cpp.

References mRootSpaceID.

dWorldID opal::ODESimulator::internal_getWorldID  )  const [virtual]
 

Definition at line 1184 of file ODESimulator.cpp.

References mWorldID.

Referenced by opal::ode_hidden::internal_collisionCallback().

const VolumeQueryResult & opal::ODESimulator::internal_queryVolume const Solid volume,
const Solid attachedSolid
[virtual]
 

Helper function used for volume queries.

Implements opal::Simulator.

Definition at line 1107 of file ODESimulator.cpp.

References opal::VolumeQueryResult::internal_clearSolids(), opal::ode_hidden::internal_volumeCollisionCallback(), mCollisionCount, mRootSpaceID, mSensorSolid, and mVolumeQueryResult.

void opal::ODESimulator::setGravity const Vec3r gravity  )  [virtual]
 

Sets the gravity used in the simulation.

Implements opal::Simulator.

Definition at line 1139 of file ODESimulator.cpp.

References opal::defaults::gravity, and mWorldID.

Referenced by initData().

void opal::ODESimulator::setMaxCorrectingVel real  vel  )  [virtual]
 

Sets the maximum correcting velocity for interpenetrating objects. The given velocity must be positive.

Reimplemented from opal::Simulator.

Definition at line 138 of file ODESimulator.cpp.

References mWorldID, and opal::Simulator::setMaxCorrectingVel().

void opal::ODESimulator::setSolverAccuracy SolverAccuracyLevel  level  )  [virtual]
 

Sets the accuracy level used by the physics engine's constraint solver.

Reimplemented from opal::Simulator.

Definition at line 1152 of file ODESimulator.cpp.

References mSolverType, mWorldID, opal::Simulator::setSolverAccuracy(), opal::SOLVER_ACCURACY_HIGH, opal::SOLVER_ACCURACY_LOW, opal::SOLVER_ACCURACY_MEDIUM, opal::SOLVER_ACCURACY_VERY_HIGH, opal::SOLVER_ACCURACY_VERY_LOW, SOLVER_QUICKSTEP, and SOLVER_WORLDSTEP.

Referenced by initData().

void opal::ODESimulator::stepPhysics  )  [protected, virtual]
 

This function is physics engine-specific. It handles collision detection and steps the simulation ahead by a constant step size.

Implements opal::Simulator.

Definition at line 189 of file ODESimulator.cpp.

References opal::Simulator::mSolidList.


Member Data Documentation

long int opal::ODESimulator::mCollisionCount [protected]
 

Used for volume collision checks.

Definition at line 143 of file ODESimulator.h.

Referenced by initData(), internal_addCollidedSolid(), and internal_queryVolume().

dJointGroupID opal::ODESimulator::mContactJointGroupID [protected]
 

The ODE joint constraint group.

Definition at line 137 of file ODESimulator.h.

Referenced by destroy(), initData(), and internal_getJointGroupID().

std::vector<RaycastResult> opal::ODESimulator::mRaycastResults [protected]
 

A vector of RaycastResults returned from a ray cast.

Definition at line 160 of file ODESimulator.h.

Referenced by internal_addRaycastResult(), and internal_fireRay().

unsigned int opal::ODESimulator::mRayContactGroup [protected]
 

A temporary variable that lets rays to use contact groups. This allows them to limit which Shapes they collide with.

Definition at line 157 of file ODESimulator.h.

Referenced by initData(), internal_fireRay(), and internal_getRayContactGroup().

dSpaceID opal::ODESimulator::mRootSpaceID [protected]
 

The root of the ODE collision detection hierarchy.

Definition at line 134 of file ODESimulator.h.

Referenced by createSolid(), createSpace(), destroy(), initData(), internal_fireRay(), internal_getSpaceID(), and internal_queryVolume().

const Solid* opal::ODESimulator::mSensorSolid [protected]
 

Used for ray casting and volume queries. If a RaycastSensor or VolumeSensor is attached to a Solid, this pointer will point to that Solid. It is used to make sure the raycasts and collision query doesn't collide with the attached Solid.

Definition at line 153 of file ODESimulator.h.

Referenced by initData(), internal_addCollidedSolid(), internal_addRaycastResult(), internal_fireRay(), and internal_queryVolume().

SolverType opal::ODESimulator::mSolverType [protected]
 

The type of constraint solver to use.

Definition at line 140 of file ODESimulator.h.

Referenced by setSolverAccuracy().

VolumeQueryResult opal::ODESimulator::mVolumeQueryResult [protected]
 

Temporary list of Solids that collided in a volume collision check.

Definition at line 147 of file ODESimulator.h.

Referenced by internal_addCollidedSolid(), and internal_queryVolume().

dWorldID opal::ODESimulator::mWorldID [protected]
 

The ODE world ID used by this Simulator.

Definition at line 131 of file ODESimulator.h.

Referenced by createJoint(), createSolid(), destroy(), getGravity(), initData(), internal_getWorldID(), setGravity(), setMaxCorrectingVel(), and setSolverAccuracy().


The documentation for this class was generated from the following files:
Generated on Tue May 16 17:49:56 2006 for OPAL by  doxygen 1.4.6-NO