OMK::Tracker Class Reference
[Simulated ojects]

This Simulated object defines a position which moves in the space. More...

#include <OMKTracker.h>

Inheritance diagram for OMK::Tracker:

Inheritance graph
[legend]
Collaboration diagram for OMK::Tracker:

Collaboration graph
[legend]
List of all members.

Protected Member Functions

virtual void computeParameters ()
 This part of the compute methods computes the associated data.
virtual bool loadParameters (const ConfigurationParameterDescriptor *node)
 Configuration parameters loader of Trajectory.

Protected Attributes

OMK::AttributeT< float > _speed
 The speed to increase the position between the current position and the target.
OMK::AttributeT< OMK::Type::Transform_target
 The target position.
Wm4::Vector3f _refOrientation
 Reference orientation.
Type::Transform _refPosition
 Reference position.
bool _followOrientation
 Flag for orientation.

Private Member Functions

 DECLARE_OBJECT_FACTORY (Tracker)

Detailed Description

This Simulated object defines a position which moves in the space.

This object is a position which follow an other position.

Configuration parameters are :

Example:
object1
{
  Class Tracker
  Scheduling
  {
    ...
  }
  Extensions
  {
    ...
  }
  UserParams
  {
    TargetConnect [target Position]
    Position [[0 0 -400]]
    Target [[100 0 0]]
    Orientation enable
    Speed 0.5 
  }
}
Somes extensions you can use with it

Definition at line 66 of file OMKTracker.h.


Member Function Documentation

OMK::Tracker::DECLARE_OBJECT_FACTORY ( Tracker   )  [private]

void Tracker::computeParameters (  )  [protected, virtual]

This part of the compute methods computes the associated data.

The inputs and outputs should work with associated data, you should use these associated data.

Reimplemented from OMK::ExtensibleSimulatedObject.

Definition at line 48 of file OMKTracker.cpp.

References _followOrientation, OMK::SimplePoint::_position, _refOrientation, _refPosition, _speed, _target, OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), OMK::InputNT::getConnectedOutput(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::getInput(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::set().

00049 {
00050   if( _target.getInput() && _target.getInput()->getConnectedOutput() ) 
00051   {
00052     OMK::Type::Transform position( _refPosition ) ;
00053   
00054     Wm4::Vector3f orientation ( _target.get().getTranslate() - _position.get().getTranslate() ) ;
00055     position.setTranslate( _position.get().getTranslate() + orientation * _speed ) ;
00056     
00057     if( _followOrientation ) 
00058     { // Calculate the orientation
00059       orientation.Normalize() ;
00060       Wm4::Vector3f axis( orientation.Cross( _refOrientation ) ) ;
00061       axis.Normalize() ;
00062       float angle = -Wm4::Math<float>::ACos( orientation.Dot( _refOrientation ) ) ;
00063       Wm4::Matrix3f rotationMatrix( axis, angle ) ;
00064       position.setRotate( position.getRotate() * rotationMatrix ) ;
00065     }
00066     // Set the new position
00067     _position.set( position ) ;
00068   }
00069 }

bool Tracker::loadParameters ( const ConfigurationParameterDescriptor node  )  [protected, virtual]

Configuration parameters loader of Trajectory.

Parameters:
[in] node the root node of the configuration parameter.
Returns:
true if all needed parameters can be read.
Reads in the configuration node the values to set the attributs.

Reimplemented from OMK::ExtensibleSimulatedObject.

Definition at line 28 of file OMKTracker.cpp.

References _followOrientation, OMK::SimplePoint::_position, _refOrientation, _refPosition, _target, OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), OMK::ParametersAccessor::get(), OMK::Type::Transform::getTranslate(), and OMK::ExtensibleSimulatedObject::loadParameters().

00029 {
00030   SimplePoint::loadParameters( node ) ;
00031   ParametersAccessor::get( node, "Orientation", _followOrientation ) ;
00032   
00033   _refPosition = _position.get() ;
00034   if( _target.get().getTranslate() != _refPosition.getTranslate() )
00035   {
00036     _refOrientation =  _target.get().getTranslate() - _refPosition.getTranslate() ;
00037     _refOrientation.Normalize() ;
00038   }
00039   else
00040   {
00041     _refOrientation =  Wm4::Vector3f( 1.0f, 0.0f, 0.0f ) ;
00042   }
00043   
00044   return true ; 
00045 }


Member Data Documentation

OMK::AttributeT< float > OMK::Tracker::_speed [protected]

The speed to increase the position between the current position and the target.

Definition at line 79 of file OMKTracker.h.

Referenced by computeParameters().

OMK::AttributeT< OMK::Type::Transform > OMK::Tracker::_target [protected]

The target position.

Definition at line 81 of file OMKTracker.h.

Referenced by computeParameters(), and loadParameters().

Wm4::Vector3f OMK::Tracker::_refOrientation [protected]

Reference orientation.

Definition at line 83 of file OMKTracker.h.

Referenced by computeParameters(), and loadParameters().

Type::Transform OMK::Tracker::_refPosition [protected]

Reference position.

Definition at line 85 of file OMKTracker.h.

Referenced by computeParameters(), and loadParameters().

bool OMK::Tracker::_followOrientation [protected]

Flag for orientation.

Definition at line 87 of file OMKTracker.h.

Referenced by computeParameters(), and loadParameters().


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007