OMK::Iii::JointExtension Class Reference
[Joints]

Kinematic joint between two objects. More...

#include <OMKJointExtension.h>

Inheritance diagram for OMK::Iii::JointExtension:

Inheritance graph
[legend]
Collaboration diagram for OMK::Iii::JointExtension:

Collaboration graph
[legend]
List of all members.

Protected Member Functions

virtual bool loadObjectParameters (const ConfigurationParameterDescriptor *node)
 Configuration parameters loader of Extension.
virtual bool loadExtensionParameters (const ConfigurationParameterDescriptor *node)
 Configuration parameters loader of Extension.
virtual void postComputeParameters ()
 Calculates the new position of the object.

Protected Attributes

IAttributeBaseT< OMK::Type::Transform > * _objectPosition
 The position of the object.
AttributeT< OMK::Type::Transform_referencePosition
 The reference position.
AttributeT< OMK::Type::Transform_jointPosition
 The joint position.
bool _connected
 The state of the joint.
JointInteractorExtension_interactor
 The retro-propagation interactor.
Joint_joint
 The joint.

Private Member Functions

 DECLARE_EXTENSION_FACTORY (JointExtension)
 Factory and constructor/destructor.

Friends

class JointInteractorExtension
class Joint

Detailed Description

Kinematic joint between two objects.

Date:
2007-06-20
Author:
Benoît Chanclou
Module description :
To calculate the position of the object the joint extension use the following parameters: The two following formulas are the base for the others: There is two states for the joint:
The transitions between states are occured:

If the joint gives some degrees of freedom to the object, like allowing sliding or rotating, it have to calculte the ideal reference position according to its degrees of freedom.

This calculation takes place in the (5) formula. The $ O_{obj} $ must be update according to the freedom of the joint. These calculation is made by the Joint class. By choosing the associated joint class the behavior can be choose.

See the introduction to the interaction protocols

Definition at line 107 of file OMKJointExtension.h.


Member Function Documentation

OMK::Iii::JointExtension::DECLARE_EXTENSION_FACTORY ( JointExtension   )  [private]

Factory and constructor/destructor.

See Extension feature

bool OMK::Iii::JointExtension::loadObjectParameters ( const ConfigurationParameterDescriptor node  )  [protected, virtual]

Configuration parameters loader of Extension.

Parameters:
[in] node the root node of the configuration parameter.
Returns:
should return true if all the parameters are well retrieved.
Overwrite this method to initialise the extension. This method allows the extension to get parameters of the object.
Be careful, this method is called before loadExtensionParameters.
See How to configure an extension ? for details.

Reimplemented from OMK::Extension.

Definition at line 231 of file OMKJointExtension.cpp.

References _interactor, and OMK::Iii::JointInteractorExtension::loadObjectParameters().

00232 {
00233   // Calls the interactor loader if neccessary
00234   return !_interactor || _interactor->loadObjectParameters( node ) ;
00235 }

bool OMK::Iii::JointExtension::loadExtensionParameters ( const ConfigurationParameterDescriptor node  )  [protected, virtual]

Configuration parameters loader of Extension.

It retrieves, in the extension configuration, the joint parameters and the name of the attribute to control.

Reimplemented from OMK::Extension.

Definition at line 238 of file OMKJointExtension.cpp.

References _interactor, _joint, _objectPosition, OMK::ExtensionT< SimulatedObjectType >::_owner, OMK::ParametersAccessor::get(), OMK::Iii::JointInteractorExtension::loadExtensionParameters(), and OMASSERTM.

00239 {
00240   // Gets the name of the position attribute of the object
00241   Name attributeName( "Position" ) ; // by default "Position"
00242   ParametersAccessor::get( node, "PositionName", attributeName ) ;
00243   // Gets the attribute accessor
00244   _objectPosition = _owner->getBaseAttribute< OMK::Type::Transform >( attributeName ) ;
00245   bool ok = _objectPosition != 0 ;
00246   
00247   // Calls the interactor loader if neccessary
00248   ok = ok && ( !_interactor || _interactor->loadExtensionParameters( node ) ) ;
00249   
00250   // The joint
00251   std::string jointClass( "Lock" ) ;
00252   
00253   ok = ok && ParametersAccessor::get( node, "Joint", jointClass ) ;
00254   _joint = OMK::Iii::JointFactory::getInstance().create( jointClass )( this, node ) ;
00255   OMASSERTM( _joint, "Joint  [" << jointClass << "] cannot be created, may be not registered in the main !" ) ;
00256   
00257   return ok ;
00258 }

void OMK::Iii::JointExtension::postComputeParameters (  )  [protected, virtual]

Calculates the new position of the object.

Calculates the axe position by offsetting the reference position. Then calculates the joint constraintes and the new position of the object. If necessary the

Reimplemented from OMK::Extension.

Definition at line 261 of file OMKJointExtension.cpp.

References _connected, _interactor, _joint, _objectPosition, _referencePosition, OMK::Iii::Joint::currentJointPosition(), OMK::Iii::Joint::currentObjectPosition(), OMK::Iii::Joint::establishLink(), OMK::InputNT::getConnectedOutput(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::getInput(), OMK::IAttribute::isUpdated(), OMASSERTM, OMMESSAGE, OMK::Iii::Joint::retroPropagation(), and OMK::Iii::JointInteractorExtension::stopRetroPropagation().

00262 {
00263   OMASSERTM( _joint, "The joint must be created" ) ;
00264   // To be linked the joint must found the position, see if the reference position declares an input and if this one is connected
00265   bool updatedLinkstate = _objectPosition 
00266                        && _referencePosition.getInput() 
00267                        && _referencePosition.getInput()->getConnectedOutput() ;
00268   if( _connected )
00269   { 
00270     if( !updatedLinkstate )
00271     { // Change the state => no more connected
00272       _connected = false ;
00273       // Nothing else to do
00274       OMMESSAGE( "release" ) ;
00275     }
00276     else
00277     { // Connected and still connected
00278       // Calculates the new joint position based on the reference position
00279       _joint->currentJointPosition() ;
00280       // Does the object move ?
00281       
00282       // Retro propagation is activated
00283       // the object moves itself (by an interactor, its own behavior,...)
00284       // => calculates the the ideal position for the reference position
00285       if( _objectPosition->isUpdated() && _joint->retroPropagation() )
00286       { 
00287         // Starts retro-propagation
00288         if( _interactor ) _interactor->startRetroPropagation() ;
00289       }
00290       else
00291       {
00292         // The object doesn't move itself => it follows the reference, no more retro-propagation
00293         if( _interactor ) _interactor->stopRetroPropagation() ;
00294       }
00295       // Calculates the new joint position based on the joint position
00296       _joint->currentObjectPosition() ;
00297     }
00298   }
00299   else
00300   {
00301     if( updatedLinkstate )
00302     { // Change the state => The connection has just been connected
00303       OMMESSAGE( "linked" ) ;
00304       _connected = true ;
00305       _joint->establishLink() ;
00306     }
00307     // else unconnected and still unconnected => nothing to do
00308   }
00309 }


Friends And Related Function Documentation

friend class JointInteractorExtension [friend]

Definition at line 110 of file OMKJointExtension.h.

friend class Joint [friend]

Definition at line 111 of file OMKJointExtension.h.


Member Data Documentation

IAttributeBaseT< OMK::Type::Transform >* OMK::Iii::JointExtension::_objectPosition [protected]

The position of the object.

The reference to the attribute which define the position of the object.

The name can be defined by the configuration parameter named Attribute, Attribute, if not defined the default is Position.

Definition at line 131 of file OMKJointExtension.h.

Referenced by loadExtensionParameters(), and postComputeParameters().

AttributeT< OMK::Type::Transform > OMK::Iii::JointExtension::_referencePosition [protected]

The reference position.

This attribute is used to retrieve the position of the reference object.

Definition at line 134 of file OMKJointExtension.h.

Referenced by OMK::Iii::JointInteractorExtension::loadExtensionParameters(), postComputeParameters(), OMK::Iii::JointInteractorExtension::startRetroPropagation(), and OMK::Iii::JointInteractorExtension::stopRetroPropagation().

AttributeT< OMK::Type::Transform > OMK::Iii::JointExtension::_jointPosition [protected]

The joint position.

This attribute defines the position of the joint. This position follows the reference position and it is calculated by offsetting this one.

Definition at line 139 of file OMKJointExtension.h.

bool OMK::Iii::JointExtension::_connected [protected]

The state of the joint.

true the connection is done. false the joint is free.

Definition at line 142 of file OMKJointExtension.h.

Referenced by postComputeParameters().

JointInteractorExtension* OMK::Iii::JointExtension::_interactor [protected]

The retro-propagation interactor.

Definition at line 144 of file OMKJointExtension.h.

Referenced by loadExtensionParameters(), loadObjectParameters(), and postComputeParameters().

Joint* OMK::Iii::JointExtension::_joint [protected]

The joint.

This joint calculates the ideal reference position according to the current position of the object and its characteristics.

Definition at line 147 of file OMKJointExtension.h.

Referenced by loadExtensionParameters(), and postComputeParameters().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:04 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007