chai3d::cAlgorithmFingerProxy Class Reference

This class implements a finger-proxy force rendering algorithm. More...

#include <CAlgorithmFingerProxy.h>

Inheritance diagram for chai3d::cAlgorithmFingerProxy:

Public Member Functions

 cAlgorithmFingerProxy ()
 Constructor of cAlgorithmFingerProxy. More...
 
virtual ~cAlgorithmFingerProxy ()
 Destructor of cAlgorithmFingerProxy. More...
 
void initialize (cWorld *a_world, const cVector3d &a_initialGlobalPosition)
 This method initialize the algorithm. More...
 
void reset ()
 This method reset the algorithm and sets the proxy position to the device position. More...
 
virtual cVector3d computeForces (const cVector3d &a_toolPos, const cVector3d &a_toolVel)
 This method calculates the interaction forces. More...
 
void setProxyRadius (const double &a_radius)
 This method sets the radius of the proxy. More...
 
double getProxyRadius () const
 This method returns the radius of the proxy. More...
 
cVector3d getProxyGlobalPosition () const
 This method returns the last computed position of the proxy in world coordinates. More...
 
void setProxyGlobalPosition (const cVector3d &a_position)
 This method sets the position of the proxy in world coordinates. More...
 
cVector3d getDeviceGlobalPosition () const
 This method returns the last specified position of the device in world coordinates. More...
 
cVector3d getForce ()
 This method returns the last computed force in world coordinates. More...
 
cVector3d getNormalForce ()
 This method returns the most recently calculated normal force. More...
 
cVector3d getTangentialForce ()
 This method returns the most recently calculated tangential force. More...
 
int getNumCollisionEvents ()
 This method return the number of collision events (0, 1, 2 or 3): More...
 
void setEpsilonBaseValue (double a_value)
 This method sets the epsilon tolerance error base value. More...
 
double getEpsilonBaseValue ()
 This method returns the current epsilon tolerance error base value. More...
 
- Public Member Functions inherited from chai3d::cGenericForceAlgorithm
 cGenericForceAlgorithm ()
 Constructor of cGenericForceAlgorithm. More...
 
virtual ~cGenericForceAlgorithm ()
 Destructor of cGenericForceAlgorithm. More...
 
cWorldgetWorld ()
 This method returns a pointer to the world in which the force algorithm is operating. More...
 
void setShowEnabled (bool a_showEnabled)
 
bool getShowEnabled ()
 

Public Attributes

cCollisionEventm_collisionEvents [3]
 Table of collision events (0-3). Call getNumCollisionEvents() to see how many are actually valid. More...
 
bool m_useDynamicProxy
 If true the the dynamic proxy is enabled to handle moving objects. More...
 
double m_frictionDynHysteresisMultiplier
 
double m_forceShadingAngleThreshold
 Maximum force shading angle (radians) threshold between normals of triangle. More...
 
cCollisionSettings m_collisionSettings
 Collision settings. More...
 

Protected Member Functions

virtual void render (cRenderOptions &a_options)
 This method renders the force algorithms graphically in OpenGL. (For debug purposes) More...
 
virtual bool goalAchieved (const cVector3d &a_proxy, const cVector3d &a_goal) const
 This method tests whether the proxy has reached the goal point. More...
 
virtual void computeNextBestProxyPosition (const cVector3d &a_goal)
 This method computes the next goal position of the proxy. More...
 
virtual void testFrictionAndMoveProxy (const cVector3d &a_goal, const cVector3d &a_proxy, cVector3d &a_normal, cGenericObject *a_parent)
 This method attempts to move the proxy, subject to friction constraints. More...
 
virtual void updateForce ()
 This method computes the resulting force which will be sent to the haptic device. More...
 
void adjustDynamicProxy (const cVector3d &a_goal)
 This method ajust the position of proxy by taking into account motion of objects in the world. More...
 
bool computeNextProxyPositionWithContraints0 (const cVector3d &a_goalGlobalPos)
 This method updates the position of the proxy - constraint 0. More...
 
bool computeNextProxyPositionWithContraints1 (const cVector3d &a_goalGlobalPos)
 This method updates the position of the proxy - constraint 1. More...
 
bool computeNextProxyPositionWithContraints2 (const cVector3d &a_goalGlobalPos)
 This method updates the position of the proxy - constraint 2. More...
 
cVector3d computeShadedSurfaceNormal (cCollisionEvent *a_contactPoint)
 This method computes the local surface normal from interpolated vertex normals. More...
 

Protected Attributes

cVector3d m_proxyGlobalPos
 Global position of the proxy. More...
 
cVector3d m_deviceGlobalPos
 Global position of device. More...
 
cVector3d m_lastGlobalForce
 Last computed force (in global coordinate frame). More...
 
cVector3d m_nextBestProxyGlobalPos
 Next best position for the proxy (in global coordinate frame). More...
 
bool m_slipping
 If true then we are currently in a "slip friction". More...
 
cVector3d m_normalForce
 Normal force. More...
 
cVector3d m_tangentialForce
 Tangential force. More...
 
unsigned int m_numCollisionEvents
 Number of collision events between proxy and triangles (0, 1, 2 or 3). More...
 
double m_radius
 Radius of the proxy. More...
 
cCollisionRecorder m_collisionRecorderConstraint0
 Collision detection recorder for searching first constraint. More...
 
cCollisionRecorder m_collisionRecorderConstraint1
 Collision detection recorder for searching second constraint. More...
 
cCollisionRecorder m_collisionRecorderConstraint2
 Collision detection recorder for searching third constraint. More...
 
cVector3d m_contactPointLocalPos0
 Local position of contact point first object. More...
 
cVector3d m_contactPointLocalPos1
 Local position of contact point first object. More...
 
cVector3d m_contactPointLocalPos2
 Local position of contact point first object. More...
 
double m_epsilonInitialValue
 Epsilon value - used for handling numerical limits. More...
 
double m_epsilon
 Epsilon value - used for handling numerical limits. More...
 
double m_epsilonCollisionDetection
 Epsilon value - used for handling numerical limits. More...
 
double m_epsilonBaseValue
 Epsilon value - used for handling numerical limits. More...
 
double m_epsilonMinimalValue
 Epsilon value - used for handling numerical limits. More...
 
unsigned int m_algoCounter
 Value of state machine. More...
 
cVector3d surfaceNormal
 Surface normal. More...
 
- Protected Attributes inherited from chai3d::cGenericForceAlgorithm
cWorldm_world
 Pointer to the world in which the force algorithm operates. More...
 
bool m_showEnabled
 If true then the graphic display mode is enabled. More...
 

Detailed Description

This class implements a finger-proxy force rendering algorithm for polygonal objects.

Constructor & Destructor Documentation

chai3d::cAlgorithmFingerProxy::cAlgorithmFingerProxy ( )

Constructor of cAlgorithmFingerProxy.

virtual chai3d::cAlgorithmFingerProxy::~cAlgorithmFingerProxy ( )
inlinevirtual

Member Function Documentation

void chai3d::cAlgorithmFingerProxy::initialize ( cWorld a_world,
const cVector3d a_initialGlobalPosition 
)
virtual

This method Initializes the algorithm, including setting the pointer to the world in which the algorithm is to operate, and setting the initial position of the device.

Parameters
a_worldPointer to world in which force algorithm is operating.
a_initialGlobalPositionInitial position of the haptic device.

Reimplemented from chai3d::cGenericForceAlgorithm.

void chai3d::cAlgorithmFingerProxy::reset ( )

This method reset the algorithm and sets the proxy position to the device position.

cVector3d chai3d::cAlgorithmFingerProxy::computeForces ( const cVector3d a_toolPos,
const cVector3d a_toolVel 
)
virtual

This method computes the interaction forces that are associated with the position of the device and the proxy.

Parameters
a_toolPosNew position of tool
a_toolVelNew velocity of tool
Returns
Haptic force.

Reimplemented from chai3d::cGenericForceAlgorithm.

void chai3d::cAlgorithmFingerProxy::setProxyRadius ( const double &  a_radius)
inline
double chai3d::cAlgorithmFingerProxy::getProxyRadius ( ) const
inline
cVector3d chai3d::cAlgorithmFingerProxy::getProxyGlobalPosition ( ) const
inline
void chai3d::cAlgorithmFingerProxy::setProxyGlobalPosition ( const cVector3d a_position)
inline
cVector3d chai3d::cAlgorithmFingerProxy::getDeviceGlobalPosition ( ) const
inline
cVector3d chai3d::cAlgorithmFingerProxy::getForce ( )
inline
cVector3d chai3d::cAlgorithmFingerProxy::getNormalForce ( )
inline
cVector3d chai3d::cAlgorithmFingerProxy::getTangentialForce ( )
inline
int chai3d::cAlgorithmFingerProxy::getNumCollisionEvents ( )
inline
void chai3d::cAlgorithmFingerProxy::setEpsilonBaseValue ( double  a_value)

This method sets the epsilon value which is used during geometry computation of the proxy model.

double chai3d::cAlgorithmFingerProxy::getEpsilonBaseValue ( )
inline
void chai3d::cAlgorithmFingerProxy::render ( cRenderOptions a_options)
protectedvirtual

This method render the force algorithm graphically using OpenGL.

Parameters
a_optionsRendering options.

Reimplemented from chai3d::cGenericForceAlgorithm.

bool chai3d::cAlgorithmFingerProxy::goalAchieved ( const cVector3d a_proxy,
const cVector3d a_goal 
) const
protectedvirtual

This method tests whether the proxy has reached the goal point, allowing for subclass-specific approximations.

Parameters
a_goalThe location to which we'd like to move the proxy.
a_proxyThe current position of the proxy.
Returns
true is the proxy has effectively reached the goal, false otherwise.
void chai3d::cAlgorithmFingerProxy::computeNextBestProxyPosition ( const cVector3d a_goal)
protectedvirtual

Given the new position of the device and considering the current position of the proxy, this method attempts to move the proxy towards the device position (the goal). If its path is blocked by an obstacle (e.g., a triangle in a mesh), the proxy is moved to this intersection point and a new goal is calculated as the closest point to the original goal in the half-plane above the intersection triangle. The process is repeated if necessary, bringing the proxy to its final location.

Parameters
a_goalThe goal position of the proxy subject to constraints.
void chai3d::cAlgorithmFingerProxy::testFrictionAndMoveProxy ( const cVector3d a_goal,
const cVector3d a_proxy,
cVector3d a_normal,
cGenericObject a_parent 
)
protectedvirtual

This method attempts to move the proxy, subject to friction constraints. This is called from computeNextBestProxyPosition() when the proxy is ready to move along a known surface.

Parameters
a_goalThe location to which we'd like to move the proxy.
a_proxyThe current position of the proxy.
a_normalThe surface normal at the obstructing surface.
a_parentThe surface along which we're moving.
void chai3d::cAlgorithmFingerProxy::updateForce ( )
protectedvirtual

This method uses the contact to determine the force to apply to the device. The function computes a force proportional to the distance between the positions of the proxy and the device and scaled by the average stiffness of each contact triangle.

void chai3d::cAlgorithmFingerProxy::adjustDynamicProxy ( const cVector3d a_goal)
protected
bool chai3d::cAlgorithmFingerProxy::computeNextProxyPositionWithContraints0 ( const cVector3d a_goalGlobalPos)
protected
bool chai3d::cAlgorithmFingerProxy::computeNextProxyPositionWithContraints1 ( const cVector3d a_goalGlobalPos)
protected
bool chai3d::cAlgorithmFingerProxy::computeNextProxyPositionWithContraints2 ( const cVector3d a_goalGlobalPos)
protected
cVector3d chai3d::cAlgorithmFingerProxy::computeShadedSurfaceNormal ( cCollisionEvent a_contactPoint)
protected

This method computes the surface normal at the proxy position.

Parameters
a_contactPointPosition of proxy.
Returns
Surface normal.

Member Data Documentation

cCollisionEvent* chai3d::cAlgorithmFingerProxy::m_collisionEvents[3]
bool chai3d::cAlgorithmFingerProxy::m_useDynamicProxy
double chai3d::cAlgorithmFingerProxy::m_frictionDynHysteresisMultiplier

Dynamic friction hysteresis multiplier In CHAI's proxy, the angle computed from the coefficient is multiplied by this constant to avoid rapidly oscillating between slipping and sticking without having to turn the dynamic friction level way down.

double chai3d::cAlgorithmFingerProxy::m_forceShadingAngleThreshold
cCollisionSettings chai3d::cAlgorithmFingerProxy::m_collisionSettings
cVector3d chai3d::cAlgorithmFingerProxy::m_proxyGlobalPos
protected
cVector3d chai3d::cAlgorithmFingerProxy::m_deviceGlobalPos
protected
cVector3d chai3d::cAlgorithmFingerProxy::m_lastGlobalForce
protected
cVector3d chai3d::cAlgorithmFingerProxy::m_nextBestProxyGlobalPos
protected
bool chai3d::cAlgorithmFingerProxy::m_slipping
protected
cVector3d chai3d::cAlgorithmFingerProxy::m_normalForce
protected
cVector3d chai3d::cAlgorithmFingerProxy::m_tangentialForce
protected
unsigned int chai3d::cAlgorithmFingerProxy::m_numCollisionEvents
protected
double chai3d::cAlgorithmFingerProxy::m_radius
protected
cCollisionRecorder chai3d::cAlgorithmFingerProxy::m_collisionRecorderConstraint0
protected
cCollisionRecorder chai3d::cAlgorithmFingerProxy::m_collisionRecorderConstraint1
protected
cCollisionRecorder chai3d::cAlgorithmFingerProxy::m_collisionRecorderConstraint2
protected
cVector3d chai3d::cAlgorithmFingerProxy::m_contactPointLocalPos0
protected
cVector3d chai3d::cAlgorithmFingerProxy::m_contactPointLocalPos1
protected
cVector3d chai3d::cAlgorithmFingerProxy::m_contactPointLocalPos2
protected
double chai3d::cAlgorithmFingerProxy::m_epsilonInitialValue
protected

To address numerical errors during geometric computation, several epsilon values are computed and used.

double chai3d::cAlgorithmFingerProxy::m_epsilon
protected
double chai3d::cAlgorithmFingerProxy::m_epsilonCollisionDetection
protected
double chai3d::cAlgorithmFingerProxy::m_epsilonBaseValue
protected
double chai3d::cAlgorithmFingerProxy::m_epsilonMinimalValue
protected
unsigned int chai3d::cAlgorithmFingerProxy::m_algoCounter
protected
cVector3d chai3d::cAlgorithmFingerProxy::surfaceNormal
protected

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