The base class for all physical elements within the world. More...
#include <worldElement.h>
Public Member Functions | |
bool | contactsChanged () const |
virtual bool | contactsPreventMotion (const transf &motion) const =0 |
QString | getFilename () const |
SoSeparator * | getIVRoot () const |
QString | getName () const |
virtual const transf & | getTran () const =0 |
World * | getWorld () const |
virtual bool | moveTo (transf &tr, double translStepSize, double rotStepSize) |
Moves this element to a new location in small steps and resolves collisions along the way. | |
virtual void | resetContactsChanged () |
virtual void | setContactsChanged () |
virtual void | setFilename (QString newName) |
Sets the filename of this element. | |
virtual void | setName (QString newName) |
Sets the name of this element. | |
virtual int | setTran (transf const &newTr)=0 |
virtual | ~WorldElement () |
Currently, just a stub. | |
Static Public Attributes | |
static const double | ONE_STEP = 1.0e6 |
Used to indicate moves should be made on one step, not broken down in small steps. | |
Protected Member Functions | |
virtual void | getBodyList (std::vector< Body * > *bodies)=0 |
Adds all the bodies that make up this WorldElement to the given list of bodies. | |
virtual bool | interpolateTo (transf lastTran, transf newTran, const CollisionReport &colReport) |
Finds the moment of contacts between a collision and a collision-free position. | |
virtual bool | jumpTo (transf newTran, CollisionReport *contactReport) |
Moves element to a new location in one step; resolves collisions along the way. | |
WorldElement (const WorldElement &e) | |
Copy constructor. | |
WorldElement (World *w, const char *name) | |
Initializes and empty element belonging to a world. | |
Protected Attributes | |
SoSeparator * | IVRoot |
A pointer to the root of this element's Inventor scene graph. | |
QString | myFilename |
Holds the file name associated with this element. | |
QString | myName |
Holds the name of this element. | |
World * | myWorld |
A pointer to the world that this element is a part of. | |
Private Attributes | |
bool | contactsChangedFlag |
Indicates whether any contacts have formed or been broken since the last time this was reset. | |
Friends | |
class | SensorInputDlg |
Needed so that when processing the glove and flock we can access interpolateTo. |
The base class for all physical elements within the world.
A world element is either an individual body or a robot which is comprised of a collection of articulated bodies. It serves as the common base class for these two types of elements.
A WorldElement can not be initialized directly, but only by sub-classes.
Definition at line 52 of file worldElement.h.
WorldElement::WorldElement | ( | World * | w, | |
const char * | name | |||
) | [protected] |
Initializes and empty element belonging to a world.
Protected constructor should only be called by subclasses. It initializes an empty worldElement.
Definition at line 53 of file worldElement.cpp.
WorldElement::WorldElement | ( | const WorldElement & | e | ) | [protected] |
Copy constructor.
Protected copy constructor (should not be called by user)
Definition at line 66 of file worldElement.cpp.
WorldElement::~WorldElement | ( | ) | [virtual] |
Currently, just a stub.
Protected destructor should only be called by subclasses Currently this is simply a stub.
Definition at line 80 of file worldElement.cpp.
bool WorldElement::contactsChanged | ( | ) | const [inline] |
Returns the state of the contactsChanged flag.
Definition at line 136 of file worldElement.h.
virtual bool WorldElement::contactsPreventMotion | ( | const transf & | motion | ) | const [pure virtual] |
virtual void WorldElement::getBodyList | ( | std::vector< Body * > * | bodies | ) | [protected, pure virtual] |
Adds all the bodies that make up this WorldElement to the given list of bodies.
This is implemented in both Body (which just adds itself) and Robot (which adds all of its links plus the base).
This is not ideal, as it automatically implies that any WorldElement is made up of instances of the Body class, which actually inherits from WorldElement. However, this is true for both classes that, at this time, inherit from WorldElement: the Body is obviously a Body itself, while the Robot is made up from a collection of Body instances (the links and the base).
QString WorldElement::getFilename | ( | ) | const [inline] |
Returns the filename associated with this element
Definition at line 114 of file worldElement.h.
SoSeparator* WorldElement::getIVRoot | ( | ) | const [inline] |
Returns a pointer to the root of this element's Inventor scene graph
Definition at line 111 of file worldElement.h.
QString WorldElement::getName | ( | ) | const [inline] |
Returns the name of this element
Definition at line 117 of file worldElement.h.
virtual const transf& WorldElement::getTran | ( | ) | const [pure virtual] |
World* WorldElement::getWorld | ( | ) | const [inline] |
Returns the world the element is a part of
Definition at line 108 of file worldElement.h.
bool WorldElement::interpolateTo | ( | transf | lastTran, | |
transf | newTran, | |||
const CollisionReport & | colReport | |||
) | [protected, virtual] |
Finds the moment of contacts between a collision and a collision-free position.
Given a start position which is expected to be collision-free, and a new position which which causes inter-penetration, it interpolates between the two to find the exact moment of contact. Returns false if the interpolation fails (usually because the starting point is also in collision).
Only looks at possible collisions in colReport, which the caller must determine before calling this.
Definition at line 95 of file worldElement.cpp.
bool WorldElement::jumpTo | ( | transf | newTran, | |
CollisionReport * | contactReport | |||
) | [protected, virtual] |
Moves element to a new location in one step; resolves collisions along the way.
Attempts to move the element from its current pose to the new pose in newTran in a single step. If the final pose if collision-free it is done. If not, it interpolates to find the exact moment of contact. Returns false if the interpolation fails.
Definition at line 162 of file worldElement.cpp.
bool WorldElement::moveTo | ( | transf & | newTran, | |
double | translStepSize, | |||
double | rotStepSize | |||
) | [virtual] |
Moves this element to a new location in small steps and resolves collisions along the way.
Moves the element from its current pose to the new pose specified by tr. This motion is performed in several steps such that the translation between each step does not exceed translStepSize and the angle of rotation does not exceed rotStepSize (expressed in radians). The intermediate poses are determined using linear interpolation for the translation and spherical linear interpolation for the rotation. If a collision is encountered during the motion, the point of first contact is determined and the element is left in that position. This function returns false if a collision was encountered (or contacts prevented the motion) or true if no collisions were encountered and the move was completed.
Definition at line 213 of file worldElement.cpp.
virtual void WorldElement::resetContactsChanged | ( | ) | [inline, virtual] |
This function is called after a grasp has been analyzed.
Definition at line 144 of file worldElement.h.
virtual void WorldElement::setContactsChanged | ( | ) | [inline, virtual] |
This function is called whenever a contact is formed or broken on a body or any body that is part of a robot.
Reimplemented in Link.
Definition at line 141 of file worldElement.h.
virtual void WorldElement::setFilename | ( | QString | newName | ) | [inline, virtual] |
Sets the filename of this element.
Definition at line 123 of file worldElement.h.
virtual void WorldElement::setName | ( | QString | newName | ) | [inline, virtual] |
Sets the name of this element.
Reimplemented in Robot.
Definition at line 120 of file worldElement.h.
virtual int WorldElement::setTran | ( | transf const & | newTr | ) | [pure virtual] |
Sets the current pose of the element with respect to the world frame. This is a purely abstract function that is reimplemented in the robot and body classes.
Implemented in Body, DynamicBody, and Robot.
friend class SensorInputDlg [friend] |
Needed so that when processing the glove and flock we can access interpolateTo.
Definition at line 156 of file worldElement.h.
bool WorldElement::contactsChangedFlag [private] |
Indicates whether any contacts have formed or been broken since the last time this was reset.
Definition at line 60 of file worldElement.h.
SoSeparator* WorldElement::IVRoot [protected] |
A pointer to the root of this element's Inventor scene graph.
Definition at line 67 of file worldElement.h.
QString WorldElement::myFilename [protected] |
Holds the file name associated with this element.
For bodies this is the geometry file, for robots its the configuration file. It is always stored relative to the GraspIt root, which is obtained from the GRASPIT environment variable.
Definition at line 74 of file worldElement.h.
QString WorldElement::myName [protected] |
Holds the name of this element.
Definition at line 77 of file worldElement.h.
World* WorldElement::myWorld [protected] |
A pointer to the world that this element is a part of.
Definition at line 64 of file worldElement.h.
const double WorldElement::ONE_STEP = 1.0e6 [static] |
Used to indicate moves should be made on one step, not broken down in small steps.
Definition at line 53 of file worldElement.h.