- 3.0.2 rigid body dynamics module.
DoubleTrait.h
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
8 namespace iit {
9 namespace rbd {
10 
11 struct DoubleTrait {
12 
13  typedef double Scalar;
14 
15  inline static Scalar sin(const Scalar& x) { return std::sin(x); }
16  inline static Scalar cos(const Scalar& x) { return std::cos(x); }
17  inline static Scalar tan(const Scalar& x) { return std::tan(x); }
18  inline static Scalar sinh(const Scalar& x) { return std::sinh(x); }
19  inline static Scalar cosh(const Scalar& x) { return std::cosh(x); }
20  inline static Scalar tanh(const Scalar& x) { return std::tanh(x); }
21  inline static Scalar exp(const Scalar& x) { return std::exp(x); }
22  inline static Scalar fabs(const Scalar& x) { return std::fabs(x); }
23  inline static Scalar sqrt(const Scalar& x) {return std::sqrt(x); }
24 
25  template <int Rows, int Cols>
26  inline static Eigen::Matrix<Scalar, Cols, 1> solve(const Eigen::Matrix<Scalar, Rows, Cols>& A, const Eigen::Matrix<Scalar, Rows, 1>& b)
27  {
28  return A.inverse()*b;
29  }
30 
31 };
32 
33 }
34 }
Definition: DoubleTrait.h:11
static Scalar sin(const Scalar &x)
Definition: DoubleTrait.h:15
double Scalar
Definition: DoubleTrait.h:13
static Scalar cosh(const Scalar &x)
Definition: DoubleTrait.h:19
static Scalar sqrt(const Scalar &x)
Definition: DoubleTrait.h:23
static Eigen::Matrix< Scalar, Cols, 1 > solve(const Eigen::Matrix< Scalar, Rows, Cols > &A, const Eigen::Matrix< Scalar, Rows, 1 > &b)
Definition: DoubleTrait.h:26
static Scalar tanh(const Scalar &x)
Definition: DoubleTrait.h:20
static Scalar sinh(const Scalar &x)
Definition: DoubleTrait.h:18
static Scalar fabs(const Scalar &x)
Definition: DoubleTrait.h:22
static Scalar cos(const Scalar &x)
Definition: DoubleTrait.h:16
static Scalar tan(const Scalar &x)
Definition: DoubleTrait.h:17
static Scalar exp(const Scalar &x)
Definition: DoubleTrait.h:21