rotationalinertia.cpp
Go to the documentation of this file.
1 // Copyright (C) 2009 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 #include "rotationalinertia.hpp"
23 #include <Eigen/Core>
24 
25 
26 namespace KDL
27 {
28  RotationalInertia::RotationalInertia(double Ixx,double Iyy,double Izz,double Ixy,double Ixz,double Iyz)
29  {
30  data[0]=Ixx;
31  data[1]=data[3]=Ixy;
32  data[2]=data[6]=Ixz;
33  data[4]=Iyy;
34  data[5]=data[7]=Iyz;
35  data[8]=Izz;
36 
37  }
38 
40  {
41  }
42 
44  // Complexity : 9M+6A
45  Vector result;
46  Eigen::Map<Eigen::Vector3d>(result.data) = Eigen::Map<const Eigen::Matrix3d>(this->data) * Eigen::Map<const Eigen::Vector3d>(omega.data);
47  return result;
48  }
49 
51  RotationalInertia result;
52  Eigen::Map<Eigen::Matrix3d>(result.data) = a * Eigen::Map<const Eigen::Matrix3d>(I.data);
53  return result;
54  }
55 
57  RotationalInertia result;
58  Eigen::Map<Eigen::Matrix3d>(result.data) = Eigen::Map<const Eigen::Matrix3d>(Ia.data) + Eigen::Map<const Eigen::Matrix3d>(Ib.data);
59  return result;
60  }
61 }
62 
friend RotationalInertia operator*(double a, const RotationalInertia &I)
A concrete implementation of a 3 dimensional vector class.
Definition: frames.hpp:162
double data[3]
Definition: frames.hpp:165
friend RotationalInertia operator+(const RotationalInertia &Ia, const RotationalInertia &Ib)
RotationalInertia(double Ixx=0, double Iyy=0, double Izz=0, double Ixy=0, double Ixz=0, double Iyz=0)


orocos_kdl
Author(s):
autogenerated on Thu Apr 13 2023 02:19:14