JointInteraction Class Reference
#include <JointInteraction.h>
Inherits ModuleInterface.

Public Member Functions | |
| JointInteraction () | |
| virtual | ~JointInteraction () |
| virtual bool | loadConfig (std::string configFile) |
| virtual void | cleanup () |
| virtual std::string | getName () |
| virtual void | step () |
| void | init () |
| bool | grabbing () |
| bool | grab (unsigned entityID, TransformationData offset) |
| bool | ungrab () |
| TransformationData | update (TransformationData trans) |
| Joint * | getJointWithID (int jointID) |
Protected Member Functions | |
| void | loadConfig (IrrXMLReader *xml) |
| void | loadJoints (IrrXMLReader *xml) |
| Joint * | xmlParseJoint (IrrXMLReader *xml, std::string &jointType) |
| void | xmlParseEntities (IrrXMLReader *xml, Joint *joint) |
| void | xmlParseConstraintAttributes (IrrXMLReader *xml, Constraint *constraint) |
| void | registerTransformationPipe (unsigned envBasedId, TransformationPipe *pipe) |
| void | attachJoints (int entityID) |
| void | grabEntity (Entity *entity, TransformationData offset) |
| void | readConfig (std::string fileName) |
| dBodyID | getBodyWithID (int entityID) |
| Entity * | getEntityWithID (int entID) |
Protected Attributes | |
| bool | isInitialized |
| std::string | configFile |
| std::map< unsigned, Entity * > | entityMap |
| std::vector< Joint * > | jointList |
| std::vector< Joint * > | attachedJoints |
| std::map< int, jointVector * > | jointMap |
| std::map< int, ODEObject * > | linkedObjMap |
| EventPipe * | incomingEvents |
| std::map< unsigned, TransformationPipe * > | linkedObjPipes |
| TransformationData | userTrans |
| TransformationData | deltaTrans |
| ODEObject * | grabbedObject |
| bool | isGrabbing |
| float | maxDist |
| float | maxRotDist |
| dWorldID | world |
| dSpaceID | space |
| int | stepsPerFrame |
Friends | |
| class | Joint |
| class | Constraint |
| class | JointInteractionBeginEvent |
| class | JointInteractionEndEvent |
Detailed Description
- Todo:
- Add documentation This module always has to be initialized before the Interaction-module!!!
Constructor & Destructor Documentation
| JointInteraction::JointInteraction | ( | ) |
| JointInteraction::~JointInteraction | ( | ) | [virtual] |
Member Function Documentation
| void JointInteraction::attachJoints | ( | int | entityID | ) | [protected] |
This method attaches all joints to the object with the matching entityID.
- Parameters:
-
entityID ID of the EntityTransform to which the joints should be attached.
| void JointInteraction::cleanup | ( | ) | [virtual] |
Instruct the module to free all memory allocated internally.
Reimplemented from ModuleInterface.
| dBodyID JointInteraction::getBodyWithID | ( | int | entityID | ) | [protected] |
This method returns the ODE-representation of the Entity with the passed ID. It searches in the map of connected objects for a matching ODEObject. If no object is found the method creates one and stores it in the map.
- Parameters:
-
entityID ID of the EntityTransform
- Returns:
- ODE representation of the EntityTransform
| Entity * JointInteraction::getEntityWithID | ( | int | entID | ) | [protected] |
This method returns an Entity with the matching ID.
- Parameters:
-
entID ID of the requested EntityTransform
- Returns:
- the EntityTransform if found, NULL if not
| Joint * JointInteraction::getJointWithID | ( | int | jointID | ) |
| std::string JointInteraction::getName | ( | ) | [virtual] |
Return the unique name of the module.
Implements ModuleInterface.
| bool JointInteraction::grab | ( | unsigned | entityID, | |
| TransformationData | offset | |||
| ) |
This method is called if the user wants to grab an object. It checks if the user is already grabbing and if not it searches for an object where the actual user-position is inside the bounding box of this object. If an object is found it is pushed into a list of possible results. Finally the object with the smallest bounding box in the list will be grabbed by calling the grabEntity-method.
- Returns:
- true if an object is grabbed
| bool JointInteraction::grabbing | ( | ) |
This method returns, if the user is grabbing an object or not
- Returns:
- true, if an object is grabbed false if not
| void JointInteraction::grabEntity | ( | Entity * | entity, | |
| TransformationData | offset | |||
| ) | [protected] |
This method initializes the grabbing of an object. It creates an ODE-object with the current position and orientation and stores the offset to the grabbed object for correct update of the Entity-transformation in the update method. It also creates all joints and linked objects by calling the attachJoints-method.
- Parameters:
-
entity Entity that should be grabbed
| void JointInteraction::init | ( | ) |
This method initializes the JointInteraction class. It therefore retrieves a copy of the Entity-list from the WorldDatabase and initializes the variables needed for ODE-simulation.
- Parameters:
-
configFile location of the config-file
| bool JointInteraction::loadConfig | ( | std::string | configFile | ) | [virtual] |
Instruct the module to read its configuration from a file.
- Returns:
- true on success.
- Parameters:
-
configFile path of the XML-file.
Implements ModuleInterface.
| void JointInteraction::loadConfig | ( | IrrXMLReader * | xml | ) | [protected] |
| void JointInteraction::loadJoints | ( | IrrXMLReader * | xml | ) | [protected] |
This method loads and parses the config-file. It searches for joint entries in the configuration, creates corresponding objects and pushes them into a Joint-list.
- Parameters:
-
fileName,: URL of the config-file
| void JointInteraction::readConfig | ( | std::string | fileName | ) | [protected] |
This method reads the config-file for the JointJointInteraction-module
- Parameters:
-
fileName location of the config-file
| void JointInteraction::registerTransformationPipe | ( | unsigned | envBasedId, | |
| TransformationPipe * | pipe | |||
| ) | [protected] |
| void JointInteraction::step | ( | ) | [virtual] |
| bool JointInteraction::ungrab | ( | ) |
This method is called if the user wants to release a grabbed object. All attached joints in the world are detached and all used ODE-objects are destroyed.
- Returns:
- true, if an object is released
| TransformationData JointInteraction::update | ( | TransformationData | trans | ) |
This method updates the position and orientation of the grabbed object and all connected objects. If the grabbed object has no connections to other objects (via joints) the method simply applies the passed position and orientation to the grabbed object. Otherwise the calculation of the new transformation takes place in two steps: First the orientational difference between the grabbed object and and the passed orientation is calculated and applied to the object as torque. Then a simulation-step takes place, where the timestep is set to 0.5, what should leed to the half orientation correction. After the simulation step the objects velocities are set to zero. In the second step the difference of the objects position and the passed one are calculated and applied to the object as force. Like in step one a simulation-step with dt=0.5 takes place and the velocities are set to zero again. After the computation of the new transformations, the method iterates over all objects, which are grabbed or are linked with the grabbed object and copies their transformation from the ODE-representation to the Entity-members. At last the method calls the checkConstraints-method of all currently used joints, so that the joints can be activated or deactivated.
- Parameters:
-
position,: position of the manipulating object orientation,: orientation of the manipulating object
| void JointInteraction::xmlParseConstraintAttributes | ( | IrrXMLReader * | xml, | |
| Constraint * | constraint | |||
| ) | [protected] |
This method does the parsing of Constraint-types in the configuration. It should only be called by the loadJoints-method!!!
- Parameters:
-
xml,: the used XML-Reader constraint,: the current constraint
| void JointInteraction::xmlParseEntities | ( | IrrXMLReader * | xml, | |
| Joint * | joint | |||
| ) | [protected] |
| Joint * JointInteraction::xmlParseJoint | ( | IrrXMLReader * | xml, | |
| std::string & | jointType | |||
| ) | [protected] |
Friends And Related Function Documentation
friend class Constraint [friend] |
friend class Joint [friend] |
friend class JointInteractionBeginEvent [friend] |
friend class JointInteractionEndEvent [friend] |
Member Data Documentation
std::vector<Joint*> JointInteraction::attachedJoints [protected] |
std::string JointInteraction::configFile [protected] |
TransformationData JointInteraction::deltaTrans [protected] |
std::map< unsigned, Entity* > JointInteraction::entityMap [protected] |
ODEObject* JointInteraction::grabbedObject [protected] |
EventPipe* JointInteraction::incomingEvents [protected] |
bool JointInteraction::isGrabbing [protected] |
bool JointInteraction::isInitialized [protected] |
std::vector<Joint*> JointInteraction::jointList [protected] |
std::map< int, jointVector* > JointInteraction::jointMap [protected] |
std::map< int, ODEObject* > JointInteraction::linkedObjMap [protected] |
std::map< unsigned, TransformationPipe* > JointInteraction::linkedObjPipes [protected] |
float JointInteraction::maxDist [protected] |
float JointInteraction::maxRotDist [protected] |
dSpaceID JointInteraction::space [protected] |
int JointInteraction::stepsPerFrame [protected] |
TransformationData JointInteraction::userTrans [protected] |
dWorldID JointInteraction::world [protected] |
The documentation for this class was generated from the following files:
- src/inVRs/Modules/JointInteraction/JointInteraction.h
- src/inVRs/Modules/JointInteraction/JointInteraction.cpp
Generated on Wed Oct 20 16:11:57 2010 for inVRs by
1.5.8