Klamp't
0.8.1
|
A physical simulator for a RobotWorld. More...
#include <WorldSimulation.h>
Public Types | |
typedef map< pair< ODEObjectID, ODEObjectID >, ContactFeedbackInfo > | ContactFeedbackMap |
Public Member Functions | |
void | Init (RobotWorld *world) |
void | OnAddModel () |
Updates the simulation with new items added to the world model. | |
void | SetController (int robot, shared_ptr< RobotController > c) |
Sets the robot's controller. | |
void | Advance (Real dt) |
Advance simulation time by dt (may take multiple sub-steps) | |
void | AdvanceFake (Real dt) |
Advance simulation time without actually performing ODE simulation. | |
void | UpdateModel () |
Takes the simulation state and puts it in the world model. | |
void | UpdateRobot (int index) |
Takes the simulation state for the robot and puts it in the world model. | |
bool | ReadState (File &f) |
bool | WriteState (File &f) const |
bool | ReadState (const string &data) |
bool | WriteState (string &data) const |
void | EnableContactFeedback (int aid, int bid, bool accum=true, bool accumFull=false) |
bool | InContact (int aid, int bid=-1) |
bool | HadContact (int aid, int bid=-1) |
Returns true if the objects had contact during past Advance call. | |
bool | HadSeparation (int aid, int bid=-1) |
Returns true if the objects had no contact during past Advance call. | |
bool | HadPenetration (int aid, int bid=-1) |
ContactFeedbackInfo * | GetContactFeedback (int aid, int bid) |
Returns the ContactFeedback structure for the two objects. | |
ODEContactList * | GetContactList (int aid, int bid) |
Returns the contact list for the prior time step. | |
Vector3 | ContactForce (int aid, int bid=-1) |
Returns the resultant contact force (on object a) from the prior time step. | |
Vector3 | ContactTorque (int aid, int bid=-1) |
Returns the resultant contact torque (on object a, about its origin) from the prior time step. | |
Vector3 | MeanContactForce (int aid, int bid=-1) |
Returns the average contact force (on object a) from the past Advance call. | |
Vector3 | MeanContactTorque (int aid, int bid=-1) |
Returns the resultant contact torque (on object a, about its origin) from the past Advance call. | |
int | ODEToWorldID (const ODEObjectID &odeid) const |
ODEObjectID | WorldToODEID (int id) const |
Public Attributes | |
RobotWorld * | world |
ODESimulator | odesim |
Real | time |
Real | simStep |
bool | fakeSimulation |
vector< ControlledRobotSimulator > | controlSimulators |
vector< shared_ptr< RobotController > > | robotControllers |
vector< shared_ptr< WorldSimulationHook > > | hooks |
ContactFeedbackMap | contactFeedback |
ODESimulator::Status | worstStatus |
Worst simulation status over the last Advance() call. | |
A physical simulator for a RobotWorld.
void WorldSimulation::EnableContactFeedback | ( | int | aid, |
int | bid, | ||
bool | accum = true , |
||
bool | accumFull = false |
||
) |
Enables contact feedback between the two objects. This must be called before most of the contact querying functions work. The exception is InContact, which works no matter what.
bool WorldSimulation::HadPenetration | ( | int | aid, |
int | bid = -1 |
||
) |
Returns true if the objects had penetration during past Advance call. Penetration indicates that there may be simulation artifacts due to poor contact handling. Can also set both aid=bid=-1 to determine whether the simulation is generally functioning properly.
bool WorldSimulation::InContact | ( | int | aid, |
int | bid = -1 |
||
) |
Returns true if the objects were in contact on the prior time sub-step. Warning: if contact feedback is not set up, this does not distinguish between terrains. That is, if either a is a terrain and b hits a different terrain, this will return true.
bool WorldSimulation::ReadState | ( | File & | f | ) |
Load/save state Note: when reading state, the user must make sure that the controllers and hooks are exactly the same objects as when they were written!