34 #ifndef _HAPTIC_RENDERING_FUNX_H
35 #define _HAPTIC_RENDERING_FUNX_H
41 #include <HDU/hduVector.h>
42 #include <HDU/hduError.h>
76 template <
typename Type>
80 static Type overlap = 30.0;
81 static Type limit = 0.25 * overlap;
82 static Type Fmax = 2.5;
83 static Type k = Fmax / overlap;
84 static Type gamma = 0.2;
85 static Type k2 = 10.0;
90 if(x<overlap && x>=limit)
92 else if(x>0.0 && x<limit)
94 Type beta = log(-(-exp(limit*3.0)+exp(limit)+Fmax*exp(limit)-exp(limit)*sqrt((exp(limit)+1.0)*(Fmax+gamma*k*limit-gamma*k*overlap)*(Fmax-exp(limit)*2.0+Fmax*exp(limit)+gamma*k*limit-gamma*k*overlap+gamma*k*limit*exp(limit)-gamma*k*overlap*exp(limit)+2.0))+Fmax*exp(limit*3.0)+exp(limit*2.0)*sqrt((exp(limit)+1.0)*(Fmax+gamma*k*limit-gamma*k*overlap)*(Fmax-exp(limit)*2.0+Fmax*exp(limit)+gamma*k*limit-gamma*k*overlap+gamma*k*limit*exp(limit)-gamma*k*overlap*exp(limit)+2.0))+gamma*k*limit*exp(limit)-gamma*k*overlap*exp(limit)+gamma*k*limit*exp(limit*3.0)-gamma*k*overlap*exp(limit*3.0))/(-exp(limit*2.0)+Fmax*exp(limit)*2.0+gamma*k*limit*exp(limit)*2.0-gamma*k*overlap*exp(limit)*2.0+1.0))*(1.0/2.0);
96 Type alpha = pow(cosh(beta - (limit/2.0)),2.0);
98 Type theta = Fmax + tanh(beta)/(pow(tanh(beta - (limit/2.0)),2.0)-1.0);
100 F = alpha * tanh(beta - x) + theta;
122 template <
typename Type>
126 static Type overlap_zone = 5.0;
129 static Type Fmax = 3.3;
130 static const Type k = Fmax / overlap_zone;
131 static const Type k2 = 100.0*k;
132 static Type a = 2.0 * Fmax / pow(overlap_zone,3.0);
133 static Type b = -1.0 * 3.0 * Fmax / pow(overlap_zone,2.0);
137 if(x<=overlap_zone && x>0.0)
139 F = (a * pow(x,3.) + b * pow(x,2.) + Fmax);
143 F = Fmax + k2 * (-x);
158 template <
typename Type>
169 template <
typename Type>
hduVector3Dd CalculateWorkspaceDemoForce(void *pUserData)
Function to define the workspace haptic demo force.
types.h file for this module. Contains types and structures used by the application.
hd_hl_apis_aux.h file for this module. Contains includes, prototypes and global vars.
hduVector3Dd Leg_COP_Monitoring(void *pUserData)
Function that tracks the detached leg COP and creates a force vector.
Type CalculatePolyForceMagnitude(Type x)
Function to determine force values using the polynomial force behaviour law.
Type CalculateTanhForceMagnitude(Type x)
Function to determine force values using the tanh customized force behaviour law. ...
Type CalculatePlaneForceMagnitude(Type x)
Function to determine force values of the plane in the plane drawing demo.
miscellaneous.h file for this module. Contains prototypes, includes and defines.
Type CalculateExponentialForceMagnitude(Type x)
Function to determine force values using the exponential force behaviour law.
hduVector3Dd CalculatePlaneDrawingDemoForce(void *pUserData)
Function to define the plane drawing haptic demo force.
void Demo2_BuildPlane(void *pUserData)
Function to define the plane for plane drawing demo.