DART
6.7.3
|
#include <World.hpp>
Public Types | |
using | NameChangedSignal = common::Signal< void(const std::string &_oldName, const std::string &_newName)> |
Public Member Functions | |
World (const std::string &_name="world") | |
Constructor. More... | |
virtual | ~World () |
Destructor. More... | |
std::shared_ptr< World > | clone () const |
Create a clone of this World. More... | |
const std::string & | setName (const std::string &_newName) |
Set the name of this World. More... | |
const std::string & | getName () const |
Get the name of this World. More... | |
void | setGravity (const Eigen::Vector3d &_gravity) |
Set gravity. More... | |
const Eigen::Vector3d & | getGravity () const |
Get gravity. More... | |
void | setTimeStep (double _timeStep) |
Set time step. More... | |
double | getTimeStep () const |
Get time step. More... | |
dynamics::SkeletonPtr | getSkeleton (std::size_t _index) const |
Get the indexed skeleton. More... | |
dynamics::SkeletonPtr | getSkeleton (const std::string &_name) const |
Find a Skeleton by name. More... | |
std::size_t | getNumSkeletons () const |
Get the number of skeletons. More... | |
std::string | addSkeleton (const dynamics::SkeletonPtr &_skeleton) |
Add a skeleton to this world. More... | |
void | removeSkeleton (const dynamics::SkeletonPtr &_skeleton) |
Remove a skeleton from this world. More... | |
std::set< dynamics::SkeletonPtr > | removeAllSkeletons () |
Remove all the skeletons in this world, and return a set of shared pointers to them, in case you want to recycle them. More... | |
bool | hasSkeleton (const dynamics::ConstSkeletonPtr &skeleton) const |
Returns wether this World contains a Skeleton. More... | |
int | getIndex (int _index) const |
Get the dof index for the indexed skeleton. More... | |
dynamics::SimpleFramePtr | getSimpleFrame (std::size_t _index) const |
Get the indexed Entity. More... | |
dynamics::SimpleFramePtr | getSimpleFrame (const std::string &_name) const |
Find an Entity by name. More... | |
std::size_t | getNumSimpleFrames () const |
Get the number of Entities. More... | |
std::string | addSimpleFrame (const dynamics::SimpleFramePtr &_frame) |
Add an Entity to this world. More... | |
void | removeSimpleFrame (const dynamics::SimpleFramePtr &_frame) |
Remove a SimpleFrame from this world. More... | |
std::set< dynamics::SimpleFramePtr > | removeAllSimpleFrames () |
Remove all SimpleFrames in this world, and return a set of shared pointers to them, in case you want to recycle them. More... | |
bool | checkCollision (bool checkAllCollisions) |
Deprecated. Please use checkCollision(~) instead. More... | |
bool | checkCollision (const collision::CollisionOption &option=collision::CollisionOption(false, 1u, nullptr), collision::CollisionResult *result=nullptr) |
Perform collision checking with 'option' over all the feasible collision pairs in this World, and the result will be stored 'result'. More... | |
const collision::CollisionResult & | getLastCollisionResult () const |
Return the collision checking result of the last simulation step. More... | |
void | reset () |
Reset the time, frame counter and recorded histories. More... | |
void | step (bool _resetCommand=true) |
Calculate the dynamics and integrate the world for one step. More... | |
void | setTime (double _time) |
Set current time. More... | |
double | getTime () const |
Get current time. More... | |
int | getSimFrames () const |
Get the number of simulated frames. More... | |
void | setConstraintSolver (constraint::UniqueConstraintSolverPtr solver) |
Sets the constraint solver. More... | |
constraint::ConstraintSolver * | getConstraintSolver () const |
Get the constraint solver. More... | |
void | bake () |
Bake simulated current state and store it into mRecording. More... | |
Recording * | getRecording () |
Get recording. More... | |
Static Public Member Functions | |
template<typename... Args> | |
static WorldPtr | create (Args &&... args) |
Creates World as shared_ptr. More... | |
static std::shared_ptr< World > | create (const std::string &name="world") |
Creates a World. More... | |
Public Attributes | |
common::SlotRegister< NameChangedSignal > | onNameChanged |
Protected Member Functions | |
void | handleSkeletonNameChange (const dynamics::ConstMetaSkeletonPtr &_skeleton) |
Register when a Skeleton's name is changed. More... | |
void | handleSimpleFrameNameChange (const dynamics::Entity *_entity) |
Register when a SimpleFrame's name is changed. More... | |
void | sendDestructionNotification () const |
Send a destruction notification to all Observers. More... | |
void | addObserver (Observer *_observer) const |
Add an Observer to the list of Observers. More... | |
void | removeObserver (Observer *_observer) const |
Remove an Observer from the list of Observers. More... | |
Protected Attributes | |
std::string | mName |
Name of this World. More... | |
std::vector< dynamics::SkeletonPtr > | mSkeletons |
Skeletons in this world. More... | |
std::map< dynamics::ConstMetaSkeletonPtr, dynamics::SkeletonPtr > | mMapForSkeletons |
std::vector< common::Connection > | mNameConnectionsForSkeletons |
Connections for noticing changes in Skeleton names TODO(MXG): Consider putting this functionality into NameManager. More... | |
dart::common::NameManager< dynamics::SkeletonPtr > | mNameMgrForSkeletons |
NameManager for keeping track of Skeletons. More... | |
std::vector< dynamics::SimpleFramePtr > | mSimpleFrames |
Entities in this world. More... | |
std::vector< common::Connection > | mNameConnectionsForSimpleFrames |
Connections for noticing changes in Frame names TODO(MXG): Consider putting this functionality into NameManager. More... | |
std::map< const dynamics::SimpleFrame *, dynamics::SimpleFramePtr > | mSimpleFrameToShared |
Map from raw SimpleFrame pointers to their shared_ptrs. More... | |
dart::common::NameManager< dynamics::SimpleFramePtr > | mNameMgrForSimpleFrames |
NameManager for keeping track of Entities. More... | |
std::vector< int > | mIndices |
The first indeices of each skeleton's dof in mDofs. More... | |
Eigen::Vector3d | mGravity |
Gravity. More... | |
double | mTimeStep |
Simulation time step. More... | |
double | mTime |
Current simulation time. More... | |
int | mFrame |
Current simulation frame number. More... | |
std::unique_ptr< constraint::ConstraintSolver > | mConstraintSolver |
Constraint solver. More... | |
Recording * | mRecording |
NameChangedSignal | mNameChangedSignal |
std::set< Observer * > | mObservers |
List of current Observers. More... | |
class World
using dart::simulation::World::NameChangedSignal = common::Signal<void(const std::string& _oldName, const std::string& _newName)> |
dart::simulation::World::World | ( | const std::string & | _name = "world" | ) |
Constructor.
|
virtual |
Destructor.
|
protectedinherited |
Add an Observer to the list of Observers.
std::string dart::simulation::World::addSimpleFrame | ( | const dynamics::SimpleFramePtr & | _frame | ) |
Add an Entity to this world.
std::string dart::simulation::World::addSkeleton | ( | const dynamics::SkeletonPtr & | _skeleton | ) |
Add a skeleton to this world.
void dart::simulation::World::bake | ( | ) |
Bake simulated current state and store it into mRecording.
bool dart::simulation::World::checkCollision | ( | bool | checkAllCollisions | ) |
Deprecated. Please use checkCollision(~) instead.
bool dart::simulation::World::checkCollision | ( | const collision::CollisionOption & | option = collision::CollisionOption(false, 1u, nullptr) , |
collision::CollisionResult * | result = nullptr |
||
) |
Perform collision checking with 'option' over all the feasible collision pairs in this World, and the result will be stored 'result'.
If no argument is passed in then it will return just whether there is collision or not without the contact information such as contact point, normal, and penetration depth.
WorldPtr dart::simulation::World::clone | ( | ) | const |
|
static |
Creates World as shared_ptr.
|
static |
Creates a World.
constraint::ConstraintSolver * dart::simulation::World::getConstraintSolver | ( | ) | const |
Get the constraint solver.
const Eigen::Vector3d & dart::simulation::World::getGravity | ( | ) | const |
Get gravity.
int dart::simulation::World::getIndex | ( | int | _index | ) | const |
Get the dof index for the indexed skeleton.
const collision::CollisionResult & dart::simulation::World::getLastCollisionResult | ( | ) | const |
Return the collision checking result of the last simulation step.
If this world hasn't stepped forward yet, then the result would be empty. Note that this function does not return the collision checking result of World::checkCollision().
const std::string & dart::simulation::World::getName | ( | ) | const |
Get the name of this World.
std::size_t dart::simulation::World::getNumSimpleFrames | ( | ) | const |
Get the number of Entities.
std::size_t dart::simulation::World::getNumSkeletons | ( | ) | const |
Get the number of skeletons.
Recording * dart::simulation::World::getRecording | ( | ) |
Get recording.
int dart::simulation::World::getSimFrames | ( | ) | const |
Get the number of simulated frames.
TODO(MXG): I think the name of this function is much too similar to getSimpleFrame()
dynamics::SimpleFramePtr dart::simulation::World::getSimpleFrame | ( | const std::string & | _name | ) | const |
Find an Entity by name.
dynamics::SimpleFramePtr dart::simulation::World::getSimpleFrame | ( | std::size_t | _index | ) | const |
Get the indexed Entity.
dynamics::SkeletonPtr dart::simulation::World::getSkeleton | ( | const std::string & | _name | ) | const |
Find a Skeleton by name.
[in] | The | name of the Skeleton you are looking for. |
dynamics::SkeletonPtr dart::simulation::World::getSkeleton | ( | std::size_t | _index | ) | const |
Get the indexed skeleton.
double dart::simulation::World::getTime | ( | ) | const |
Get current time.
double dart::simulation::World::getTimeStep | ( | ) | const |
Get time step.
|
protected |
Register when a SimpleFrame's name is changed.
|
protected |
Register when a Skeleton's name is changed.
bool dart::simulation::World::hasSkeleton | ( | const dynamics::ConstSkeletonPtr & | skeleton | ) | const |
Returns wether this World contains a Skeleton.
std::set< dynamics::SimpleFramePtr > dart::simulation::World::removeAllSimpleFrames | ( | ) |
Remove all SimpleFrames in this world, and return a set of shared pointers to them, in case you want to recycle them.
std::set< dynamics::SkeletonPtr > dart::simulation::World::removeAllSkeletons | ( | ) |
Remove all the skeletons in this world, and return a set of shared pointers to them, in case you want to recycle them.
|
protectedinherited |
Remove an Observer from the list of Observers.
void dart::simulation::World::removeSimpleFrame | ( | const dynamics::SimpleFramePtr & | _frame | ) |
Remove a SimpleFrame from this world.
void dart::simulation::World::removeSkeleton | ( | const dynamics::SkeletonPtr & | _skeleton | ) |
Remove a skeleton from this world.
void dart::simulation::World::reset | ( | ) |
Reset the time, frame counter and recorded histories.
|
protectedinherited |
Send a destruction notification to all Observers.
This will cause all Observers to behave as if this Subject has been permanently deleted, so it should only be called when that behavior is desired.
void dart::simulation::World::setConstraintSolver | ( | constraint::UniqueConstraintSolverPtr | solver | ) |
Sets the constraint solver.
void dart::simulation::World::setGravity | ( | const Eigen::Vector3d & | _gravity | ) |
Set gravity.
const std::string & dart::simulation::World::setName | ( | const std::string & | _newName | ) |
Set the name of this World.
void dart::simulation::World::setTime | ( | double | _time | ) |
Set current time.
void dart::simulation::World::setTimeStep | ( | double | _timeStep | ) |
Set time step.
void dart::simulation::World::step | ( | bool | _resetCommand = true | ) |
Calculate the dynamics and integrate the world for one step.
[in] | _resetCommand | True if you want to reset to zero the joint command after simulation step. |
|
protected |
Constraint solver.
|
protected |
Current simulation frame number.
|
protected |
Gravity.
|
protected |
The first indeices of each skeleton's dof in mDofs.
For example, if this world has three skeletons and their dof are 6, 1 and 2 then the mIndices goes like this: [0 6 7].
|
protected |
|
protected |
Name of this World.
|
protected |
|
protected |
Connections for noticing changes in Frame names TODO(MXG): Consider putting this functionality into NameManager.
|
protected |
Connections for noticing changes in Skeleton names TODO(MXG): Consider putting this functionality into NameManager.
|
protected |
NameManager for keeping track of Entities.
|
protected |
NameManager for keeping track of Skeletons.
|
mutableprotectedinherited |
List of current Observers.
|
protected |
|
protected |
Entities in this world.
|
protected |
Map from raw SimpleFrame pointers to their shared_ptrs.
|
protected |
Skeletons in this world.
|
protected |
Current simulation time.
|
protected |
Simulation time step.
common::SlotRegister<NameChangedSignal> dart::simulation::World::onNameChanged |