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


orocos_kdl
Author(s):
autogenerated on Fri Mar 12 2021 03:05:44