Aikido
aikido::planner::World Class Reference

A Kinematic world that contains a set of skeletons. More...

#include <aikido/planner/World.hpp>

Classes

struct  State
 

Public Member Functions

 World (const std::string &name="")
 Construct a kinematic World. More...
 
virtual ~World ()
 
std::unique_ptr< Worldclone (const std::string &newName="") const
 Create a clone of this World. More...
 
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...
 
dart::dynamics::SkeletonPtr getSkeleton (std::size_t i) const
 Find a Skeleton by index. More...
 
dart::dynamics::SkeletonPtr getSkeleton (const std::string &name) const
 Find a Skeleton by name. More...
 
bool hasSkeleton (const dart::dynamics::SkeletonPtr &skel) const
 Returns true if the Skeleton is in this World. More...
 
std::size_t getNumSkeletons () const
 Get the number of Skeletons. More...
 
std::string addSkeleton (const dart::dynamics::SkeletonPtr &skeleton)
 Add a Skeleton to this World. More...
 
void removeSkeleton (const dart::dynamics::SkeletonPtr &skeleton)
 Remove a Skeleton from this World. More...
 
std::mutex & getMutex () const
 Get the mutex that protects the state of this World. More...
 
World::State getState () const
 Returns the state of this World. More...
 
World::State getState (const std::vector< std::string > &names) const
 Returns the state of named skeletons in this World. More...
 
void setState (const World::State &state)
 Sets the state of this World to match State. More...
 
void setState (const World::State &state, const std::vector< std::string > &names)
 Sets the state of named skeletons in this World to match State. More...
 

Static Public Member Functions

static std::unique_ptr< Worldcreate (const std::string &name="")
 Create a new World ptr. More...
 

Protected Attributes

std::string mName
 Name of this World. More...
 
std::vector< dart::dynamics::SkeletonPtr > mSkeletons
 Skeletons in this World. More...
 
std::mutex mMutex
 Mutex to protect this World. More...
 
dart::common::NameManager< dart::dynamics::SkeletonPtr > mSkeletonNameManager
 NameManager for keeping track of Skeletons. More...
 

Static Protected Attributes

static dart::common::NameManager< World * > mWorldNameManager
 NameManager for keeping track of Worlds. More...
 

Detailed Description

A Kinematic world that contains a set of skeletons.

It is expected that worlds do not share the same skeletons.

Constructor & Destructor Documentation

◆ World()

aikido::planner::World::World ( const std::string &  name = "")
explicit

Construct a kinematic World.

Parameters
nameName for the new World

◆ ~World()

virtual aikido::planner::World::~World ( )
virtual

Member Function Documentation

◆ addSkeleton()

std::string aikido::planner::World::addSkeleton ( const dart::dynamics::SkeletonPtr &  skeleton)

Add a Skeleton to this World.

Parameters
skeletonSkeleton to add to the World

◆ clone()

std::unique_ptr<World> aikido::planner::World::clone ( const std::string &  newName = "") const

Create a clone of this World.

All Skeletons will be copied over.

Parameters
newNameName for the cloned World

◆ create()

static std::unique_ptr<World> aikido::planner::World::create ( const std::string &  name = "")
static

Create a new World ptr.

Parameters
nameName for the new World

◆ getMutex()

std::mutex& aikido::planner::World::getMutex ( ) const

Get the mutex that protects the state of this World.

◆ getName()

const std::string& aikido::planner::World::getName ( ) const

Get the name of this World.

◆ getNumSkeletons()

std::size_t aikido::planner::World::getNumSkeletons ( ) const

Get the number of Skeletons.

◆ getSkeleton() [1/2]

dart::dynamics::SkeletonPtr aikido::planner::World::getSkeleton ( const std::string &  name) const

Find a Skeleton by name.

Parameters
nameName of desired Skeleton

◆ getSkeleton() [2/2]

dart::dynamics::SkeletonPtr aikido::planner::World::getSkeleton ( std::size_t  i) const

Find a Skeleton by index.

Parameters
iIndex of desired Skeleton

◆ getState() [1/2]

World::State aikido::planner::World::getState ( ) const

Returns the state of this World.

Returns
State

◆ getState() [2/2]

World::State aikido::planner::World::getState ( const std::vector< std::string > &  names) const

Returns the state of named skeletons in this World.

Parameters
namesNames of skeletons that should be in the state
Returns
State

◆ hasSkeleton()

bool aikido::planner::World::hasSkeleton ( const dart::dynamics::SkeletonPtr &  skel) const

Returns true if the Skeleton is in this World.

Parameters
skelDesired Skeleton
Returns
True if succeeded to find the Skeleton

◆ removeSkeleton()

void aikido::planner::World::removeSkeleton ( const dart::dynamics::SkeletonPtr &  skeleton)

Remove a Skeleton from this World.

Parameters
skeletonSkeleton to remove from the World

◆ setName()

std::string aikido::planner::World::setName ( const std::string &  newName)

Set the name of this World.

Parameters
newNameNew name for this World

◆ setState() [1/2]

void aikido::planner::World::setState ( const World::State state)

Sets the state of this World to match State.

The caller of this method MUST LOCK the mutex of this World.

Parameters
stateState to set this world to.

◆ setState() [2/2]

void aikido::planner::World::setState ( const World::State state,
const std::vector< std::string > &  names 
)

Sets the state of named skeletons in this World to match State.

The caller of this method MUST LOCK the mutex of this World.

Parameters
stateState to set this world to.
namesNames of skeletons in the state

Member Data Documentation

◆ mMutex

std::mutex aikido::planner::World::mMutex
mutableprotected

Mutex to protect this World.

◆ mName

std::string aikido::planner::World::mName
protected

Name of this World.

◆ mSkeletonNameManager

dart::common::NameManager<dart::dynamics::SkeletonPtr> aikido::planner::World::mSkeletonNameManager
protected

NameManager for keeping track of Skeletons.

◆ mSkeletons

std::vector<dart::dynamics::SkeletonPtr> aikido::planner::World::mSkeletons
protected

Skeletons in this World.

◆ mWorldNameManager

dart::common::NameManager<World*> aikido::planner::World::mWorldNameManager
staticprotected

NameManager for keeping track of Worlds.