Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
collision_detection::World Class Reference

Maintain a representation of the environment. More...

#include <world.h>

List of all members.

Classes

class  Action
 Represents an action that occurred on an object in the world. Several bits may be set indicating several things happened to the object. If the DESTROY bit is set, other bits will not be set. More...
struct  Object
 A representation of an object. More...
class  Observer
class  ObserverHandle

Public Types

enum  ActionBits {
  UNINITIALIZED = 0, CREATE = 1, DESTROY = 2, MOVE_SHAPE = 4,
  ADD_SHAPE = 8, REMOVE_SHAPE = 16
}
typedef std::map< std::string,
ObjectConstPtr >
::const_iterator 
const_iterator
typedef boost::shared_ptr< ObjectObjectConstPtr
typedef boost::shared_ptr< ObjectObjectPtr
typedef boost::function< void(const
ObjectConstPtr &, Action)> 
ObserverCallbackFn

Public Member Functions

ObserverHandle addObserver (const ObserverCallbackFn &callback)
 register a callback function for notification of changes. callback will be called right after any change occurs to any Object. observer is the object which is requesting the changes. It is only used for identifying the callback in removeObserver().
void addToObject (const std::string &id, const std::vector< shapes::ShapeConstPtr > &shapes, const EigenSTL::vector_Affine3d &poses)
 Add shapes to an object in the map. This function makes repeated calls to addToObjectInternal() to add the shapes one by one.
void addToObject (const std::string &id, const shapes::ShapeConstPtr &shape, const Eigen::Affine3d &pose)
 Add a shape to an object. If the object already exists, this call will add the shape to the object at the specified pose. Otherwise, the object is created and the specified shape is added. This calls addToObjectInternal().
const_iterator begin () const
void clearObjects ()
 Clear all objects. If there are no other pointers to corresponding instances of Objects, the memory is freed.
const_iterator end () const
const_iterator find (const std::string &id) const
ObjectConstPtr getObject (const std::string &id) const
 Get a particular object.
std::vector< std::string > getObjectIds () const
 Get the list of Object ids.
bool hasObject (const std::string &id) const
 Check if a particular object exists in the collision world.
bool moveShapeInObject (const std::string &id, const shapes::ShapeConstPtr &shape, const Eigen::Affine3d &pose)
 Update the pose of a shape in an object. Shape equality is verified by comparing pointers. Returns true on success.
void notifyObserverAllObjects (const ObserverHandle observer_handle, Action action) const
bool removeObject (const std::string &id)
 Remove a particular object. If there are no external pointers to the corresponding instance of Object, the memory is freed. Returns true on success and false if no such object was found.
void removeObserver (const ObserverHandle observer_handle)
 remove a notifier callback
bool removeShapeFromObject (const std::string &id, const shapes::ShapeConstPtr &shape)
 Remove shape from object. Shape equality is verified by comparing pointers. Ownership of the object is renounced (i.e. object is deleted if no external references exist) if this was the last shape in the object. Returns true on success and false if the object did not exist or did not contain the shape.
std::size_t size () const
 World ()
 Constructor.
 World (const World &other)
 A copy constructor. other should not be changed while the copy constructor is running This does copy on write and should be quick.
 ~World ()

Private Member Functions

virtual void addToObjectInternal (const ObjectPtr &obj, const shapes::ShapeConstPtr &shape, const Eigen::Affine3d &pose)
void ensureUnique (ObjectPtr &obj)
 Make sure that the object named id is known only to this instance of the World. If the object is known outside of it, a clone is made so that it can be safely modified later on.
void notify (const ObjectConstPtr &, Action)
void notifyAll (Action action)

Private Attributes

std::map< std::string, ObjectPtrobjects_
std::vector< Observer * > observers_

Detailed Description

Maintain a representation of the environment.

Definition at line 53 of file world.h.


Member Typedef Documentation

iterator over the objects in the world.

Definition at line 98 of file world.h.

Definition at line 89 of file world.h.

typedef boost::shared_ptr<Object> collision_detection::World::ObjectPtr

Definition at line 88 of file world.h.

typedef boost::function<void (const ObjectConstPtr&, Action)> collision_detection::World::ObserverCallbackFn

Definition at line 203 of file world.h.


Member Enumeration Documentation

Enumerator:
UNINITIALIZED 
CREATE 
DESTROY 

object was created

MOVE_SHAPE 

object was destroyed

ADD_SHAPE 

one or more shapes in object were moved

REMOVE_SHAPE 

shape(s) were added to object

Definition at line 167 of file world.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 40 of file world.cpp.

A copy constructor. other should not be changed while the copy constructor is running This does copy on write and should be quick.

Definition at line 43 of file world.cpp.

Definition at line 48 of file world.cpp.


Member Function Documentation

register a callback function for notification of changes. callback will be called right after any change occurs to any Object. observer is the object which is requesting the changes. It is only used for identifying the callback in removeObserver().

Definition at line 205 of file world.cpp.

void collision_detection::World::addToObject ( const std::string &  id,
const std::vector< shapes::ShapeConstPtr > &  shapes,
const EigenSTL::vector_Affine3d poses 
)

Add shapes to an object in the map. This function makes repeated calls to addToObjectInternal() to add the shapes one by one.

Note:
This function does NOT call the addToObject() variant that takes a single shape and a single pose as input.

Definition at line 62 of file world.cpp.

void collision_detection::World::addToObject ( const std::string &  id,
const shapes::ShapeConstPtr shape,
const Eigen::Affine3d &  pose 
)

Add a shape to an object. If the object already exists, this call will add the shape to the object at the specified pose. Otherwise, the object is created and the specified shape is added. This calls addToObjectInternal().

Definition at line 91 of file world.cpp.

void collision_detection::World::addToObjectInternal ( const ObjectPtr obj,
const shapes::ShapeConstPtr shape,
const Eigen::Affine3d &  pose 
) [inline, private, virtual]

Definition at line 54 of file world.cpp.

iterator pointing to first change

Definition at line 100 of file world.h.

Clear all objects. If there are no other pointers to corresponding instances of Objects, the memory is freed.

Definition at line 199 of file world.cpp.

iterator pointing to end of changes

Definition at line 105 of file world.h.

Make sure that the object named id is known only to this instance of the World. If the object is known outside of it, a clone is made so that it can be safely modified later on.

Definition at line 126 of file world.cpp.

const_iterator collision_detection::World::find ( const std::string &  id) const [inline]

find changes for a named object

Definition at line 115 of file world.h.

Get a particular object.

Definition at line 117 of file world.cpp.

std::vector< std::string > collision_detection::World::getObjectIds ( ) const

Get the list of Object ids.

Definition at line 109 of file world.cpp.

bool collision_detection::World::hasObject ( const std::string &  id) const

Check if a particular object exists in the collision world.

Definition at line 132 of file world.cpp.

bool collision_detection::World::moveShapeInObject ( const std::string &  id,
const shapes::ShapeConstPtr shape,
const Eigen::Affine3d &  pose 
)

Update the pose of a shape in an object. Shape equality is verified by comparing pointers. Returns true on success.

Definition at line 137 of file world.cpp.

void collision_detection::World::notify ( const ObjectConstPtr obj,
Action  action 
) [private]

notify all observers of a change

Definition at line 231 of file world.cpp.

void collision_detection::World::notifyAll ( Action  action) [private]

send notification of change to all objects.

Definition at line 225 of file world.cpp.

void collision_detection::World::notifyObserverAllObjects ( const ObserverHandle  observer_handle,
Action  action 
) const

send notification of change to all objects to a particular observer. Used which switching from one world to another.

Definition at line 237 of file world.cpp.

bool collision_detection::World::removeObject ( const std::string &  id)

Remove a particular object. If there are no external pointers to the corresponding instance of Object, the memory is freed. Returns true on success and false if no such object was found.

Definition at line 187 of file world.cpp.

remove a notifier callback

Definition at line 212 of file world.cpp.

bool collision_detection::World::removeShapeFromObject ( const std::string &  id,
const shapes::ShapeConstPtr shape 
)

Remove shape from object. Shape equality is verified by comparing pointers. Ownership of the object is renounced (i.e. object is deleted if no external references exist) if this was the last shape in the object. Returns true on success and false if the object did not exist or did not contain the shape.

Definition at line 158 of file world.cpp.

std::size_t collision_detection::World::size ( ) const [inline]

number of changes stored

Definition at line 110 of file world.h.


Member Data Documentation

std::map<std::string, ObjectPtr> collision_detection::World::objects_ [private]

The objects maintained in the world

Definition at line 239 of file world.h.

Definition at line 250 of file world.h.


The documentation for this class was generated from the following files:


moveit_core
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley
autogenerated on Mon Oct 6 2014 02:24:48