Klamp't
0.9.0
|
An interface to the ODE simulator. More...
#include <ODESimulator.h>
Public Types | |
enum | Status { StatusNormal =0, StatusAdaptiveTimeStepping =1, StatusContactUnreliable =2, StatusUnstable =3, StatusError =4 } |
Public Member Functions | |
void | SetGravity (const Vector3 &g) |
void | SetAutoDisable (bool autoDisable=true) |
void | SetERP (double erp) |
void | SetCFM (double erp) |
ODESimulatorSettings & | GetSettings () |
Status | GetStatus () const |
void | GetStatusHistory (vector< Status > &statuses, vector< Real > &statusChangeTimes) const |
void | AddTerrain (TerrainModel &terr) |
void | AddRobot (RobotModel &robot) |
void | AddObject (RigidObjectModel &object) |
bool | CheckObjectOverlap (vector< pair< ODEObjectID, ODEObjectID > > &overlaps) |
void | Step (Real dt) |
void | StepDynamics (Real dt) |
bool | ReadState (File &f) |
bool | WriteState (File &f) const |
size_t | numTerrains () const |
size_t | numRobots () const |
size_t | numObjects () const |
dWorldID | world () const |
const TerrainModel * | terrain (int i) const |
ODEGeometry * | terrainGeom (int i) const |
ODERobot * | robot (int i) const |
ODERigidObject * | object (int i) const |
string | ObjectName (const ODEObjectID &obj) const |
dBodyID | ObjectBody (const ODEObjectID &obj) const |
dGeomID | ObjectGeom (const ODEObjectID &obj) const |
void | EnableContactFeedback (const ODEObjectID &a, const ODEObjectID &b) |
ODEContactList * | GetContactFeedback (const ODEObjectID &a, const ODEObjectID &b) |
void | GetContactFeedback (const ODEObjectID &a, vector< ODEContactList * > &contacts) |
void | ClearContactFeedback () |
bool | InContact (const ODEObjectID &a) const |
bool | InContact (const ODEObjectID &a, const ODEObjectID &b) const |
void | DisableInstabilityCorrection () |
Disables instability correction for the next time step. This should be done if you manually set several objects' velocities, for example. | |
void | DisableInstabilityCorrection (const ODEObjectID &obj) |
Disables instability correction for the given object on the next time step. This should be done if you manually set an object's velocities, for example. | |
ODEJoint * | AddJoint (const ODEObjectID &obj) |
Adds a new joint between obj and the world. The returned ODEJoint must be set up using the MakeHinge, MakeSlider, or MakeFixed functions. | |
ODEJoint * | AddJoint (const ODEObjectID &a, const ODEObjectID &b) |
Adds a new joint between a and b. The returned ODEJoint must be set up using the MakeHinge, MakeSlider, or MakeFixed functions. | |
void | RemoveJoint (ODEJoint *) |
Removes a single joint. | |
void | RemoveJoints (const ODEObjectID &obj) |
Removes all joints touching obj. | |
void | RemoveJoints (const ODEObjectID &a, const ODEObjectID &b) |
Removes all joints between a and b. | |
bool | ReadState_Internal (File &f) |
bool | WriteState_Internal (File &f) const |
void | DetectCollisions () |
void | SetupContactResponse () |
void | SetupContactResponse (const ODEObjectID &a, const ODEObjectID &b, int feedbackIndex, ODEContactResult &c) |
void | ClearCollisions () |
bool | InstabilityCorrection () |
virtual void | GetSurfaceParameters (const ODEObjectID &a, const ODEObjectID &b, dSurfaceParameters &surface) const |
Public Attributes | |
File | lastState |
Real | lastStateTimestep |
map< pair< ODEObjectID, ODEObjectID >, double > | lastMarginsRemaining |
list< ODEJoint > | joints |
An interface to the ODE simulator.
Step() performs collision detection, sets up contact response, calls StepDynamics(), and computes collision feedback.
StepDynamics() integrates the dynamics without setting up collision detection structures. This probably should not be used externally.
Read/WriteState can be used to serialize state to binary.
To get contact force information from the simulator, use the EnableContactFeedback() function to initialize feedback, and then call GetContactFeedback() to get a pointer to the feedback data structure. Contact forces are updated after Step().
Overall simulation status flag. If a status is:
bool Klampt::ODESimulator::CheckObjectOverlap | ( | vector< pair< ODEObjectID, ODEObjectID > > & | overlaps | ) |
Returns true if the current state is in "reliable" status. Otherwise returns false and populates the list of overlapping object pairs.