11#include <sawConstraintController/mtsVFDataRCM.h>
41 int tesselationNumber = 8)
43 H.SetSize(tesselationNumber,6);
44 h.SetSize(tesselationNumber);
50 ZAxisToRotation(direction, R);
51 for (
int i = 1; i <= tesselationNumber; i++) {
52 unitV_pl.
Assign(cos(i*2*3.14159/tesselationNumber), sin(i*2*3.14159/tesselationNumber), 0);
54 H(i-1, 0) = -unitV_wd.
X();
55 H(i-1, 1) = -unitV_wd.
Y();
56 H(i-1, 2) = -unitV_wd.
Z();
62 void ZAxisToRotation(
vct3 Zaxis, vctFixedSizeMatrix<double, 3, 3> &R)
65 vct3 YVec3(0., 1., 0.);
66 vct3 ZVec3(0., 0., 1.);
85 bool sanityCheckOkay =
true;
86 for (
int cc = 0; cc < 3; cc++) {
87 for (
int rr = 0; rr < 3; rr++) {
91 if (sanityCheckOkay ==
false) {
102 double normD = lineD(0) * lineD(0) + lineD(1) * lineD(1) + lineD(2) * lineD(2);
104 double sqrtNorm = sqrt(normD);
105 lineD(0) /= sqrtNorm;
106 lineD(1) /= sqrtNorm;
107 lineD(2) /= sqrtNorm;
111 double bx = givenPt(0) - linePoint(0);
112 double by = givenPt(1) - linePoint(1);
113 double bz = givenPt(2) - linePoint(2);
114 double d = bx*lineD(0) + by*lineD(1)+bz*lineD(2);
118 xcl(0) = linePoint(0) + lineD(0)*d;
119 xcl(1) = linePoint(1) + lineD(1)*d;
120 xcl(2) = linePoint(2) + lineD(2)*d;
126 double x = closestPoint[0] - tip[0];
127 double y = closestPoint[1] - tip[1];
128 double z = closestPoint[2] - tip[2];
129 if(tip*closestPoint > 0)
130 return sqrt(x*x + y*y + z*z);
132 return -sqrt(x*x + y*y + z*z);
void FillInTableauRefs(const mtsVFBase::CONTROLLERMODE mode, const double tickTime)
Updates co with virtual fixture data.
mtsVF_RCM()
Definition mtsVFRCM.h:20
mtsVF_RCM(const std::string &name, mtsVFDataRCM *data)
Definition mtsVFRCM.h:21
CONTROLLERMODE
Definition mtsVFBase.h:39
mtsVFJointPosition()
Definition mtsVFJointPos.h:38
NormType Norm(void) const
Definition vctFixedSizeConstVectorBase.h:453
Implementation of a fixed-size matrix using template metaprogramming.
Definition vctFixedSizeMatrix.h:54
ThisType & Assign(const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
Definition vctFixedSizeVectorBase.h:274
ThisType & ProductOf(const vctFixedSizeConstVectorBase< _size, __stride, value_type, __dataPtrType > &vector, const value_type scalar)
Definition vctFixedSizeVectorBase.h:1003
value_type & Y(void)
Definition vctFixedSizeVectorBase.h:572
value_type & Z(void)
Definition vctFixedSizeVectorBase.h:585
value_type & X(void)
Definition vctFixedSizeVectorBase.h:559
ThisType & Divide(const value_type scalar)
Definition vctFixedSizeVectorBase.h:1159
bool Zeros(void)
Definition vctFixedSizeVectorBase.h:256
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition cmnClassRegisterMacros.h:199
const int CMN_DYNAMIC_CREATION
Definition cmnClassRegisterMacros.h:328
Defines cmnGenericObject.
#define CMN_LOG_LOD_RUN_VERBOSE
Definition cmnLogLoD.h:95
#define CMN_LOG_CLASS_RUN_ERROR
Definition cmnLogger.h:117
#define CMN_ISFINITE(x)
Definition cmnPortability.h:433
Declaration of nmrLSqLin.
_elementType vctDotProduct(const vctDynamicConstVectorBase< _vector1OwnerType, _elementType > &vector1, const vctDynamicConstVectorBase< _vector2OwnerType, _elementType > &vector2)
Definition vctDynamicConstVectorBase.h:1087
Typedef for dynamic matrices.
vctDynamicMatrix< double > vctDoubleMat
Definition vctDynamicMatrixTypes.h:35
Typedef for dynamic vectors.
vctDynamicVector< double > vctDoubleVec
Definition vctDynamicVectorTypes.h:37
Typedef for fixed size vectors.
vctFixedSizeVector< double, 3 > vct3
Definition vctFixedSizeVectorTypes.h:46