/usr/include/kdl/stiffness.hpp is in liborocos-kdl-dev 1.3.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | // Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Version: 1.0
// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// URL: http://www.orocos.org/kdl
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef KDL_STIFFNESS_H
#define KDL_STIFFNESS_H
#include "frames.hpp"
namespace KDL {
/**
* Preliminary class to implement Stiffness, only diagonal stiffness is implemented
* no transformations provided...
*
* Implements a diagonal stiffness matrix.
* first 3 elements are stiffness for translations
* last 3 elements are stiffness for rotations.
*/
class Stiffness {
double data[6];
public:
Stiffness() {
data[0]=0;
data[1]=0;
data[2]=0;
data[3]=0;
data[4]=0;
data[5]=0;
}
Stiffness(double* d) {
data[0]=d[0];
data[1]=d[1];
data[2]=d[2];
data[3]=d[3];
data[4]=d[4];
data[5]=d[5];
}
Stiffness(double x,double y,double z,double rx,double ry,double rz) {
data[0]=x;
data[1]=y;
data[2]=z;
data[3]=rx;
data[4]=ry;
data[5]=rz;
}
double& operator[](int i) {
return data[i];
}
double operator[](int i) const {
return data[i];
}
Twist Inverse(const Wrench& w) const{
Twist t;
t[0]=w[0]/data[0];
t[1]=w[1]/data[1];
t[2]=w[2]/data[2];
t[3]=w[3]/data[3];
t[4]=w[4]/data[4];
t[5]=w[5]/data[5];
return t;
}
};
inline Wrench operator * (const Stiffness& s, const Twist& t) {
Wrench w;
w[0]=s[0]*t[0];
w[1]=s[1]*t[1];
w[2]=s[2]*t[2];
w[3]=s[3]*t[3];
w[4]=s[4]*t[4];
w[5]=s[5]*t[5];
return w;
}
inline Stiffness operator+(const Stiffness& s1, const Stiffness& s2) {
Stiffness s;
s[0]=s1[0]+s2[0];
s[1]=s1[1]+s2[1];
s[2]=s1[2]+s2[2];
s[3]=s1[3]+s2[3];
s[4]=s1[4]+s2[4];
s[5]=s1[5]+s2[5];
return s;
}
inline void posrandom(Stiffness& F) {
posrandom(F[0]);
posrandom(F[1]);
posrandom(F[2]);
posrandom(F[3]);
posrandom(F[4]);
posrandom(F[5]);
}
inline void random(Stiffness& F) {
posrandom(F);
}
}
#endif
|