- 3.0.2 rigid body dynamics module.
FloatTrait.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 namespace iit {
8 namespace rbd {
9 
10 
11 
12 struct FloatTrait {
13 
14  typedef float Scalar;
15 
16  inline static Scalar sin(const Scalar& x) { return std::sin(x); }
17  inline static Scalar cos(const Scalar& x) { return std::cos(x); }
18  inline static Scalar tan(const Scalar& x) { return std::tan(x); }
19  inline static Scalar sinh(const Scalar& x) { return std::sinh(x); }
20  inline static Scalar cosh(const Scalar& x) { return std::cosh(x); }
21  inline static Scalar tanh(const Scalar& x) { return std::tanh(x); }
22  inline static Scalar exp(const Scalar& x) { return std::exp(x); }
23  inline static Scalar fabs(const Scalar& x) { return std::fabs(x); }
24  inline static Scalar sqrt(const Scalar& x) {return std::sqrt(x); }
25 
26  template <int Rows, int Cols>
27  inline static Eigen::Matrix<Scalar, Cols, 1> solve(const Eigen::Matrix<Scalar, Rows, Cols>& A, const Eigen::Matrix<Scalar, Rows, 1>& b)
28  {
29  return A.inverse()*b;
30  }
31 
32 };
33 
34 }
35 }
static Scalar tanh(const Scalar &x)
Definition: FloatTrait.h:21
static Scalar exp(const Scalar &x)
Definition: FloatTrait.h:22
static Scalar cos(const Scalar &x)
Definition: FloatTrait.h:17
float Scalar
Definition: FloatTrait.h:14
static Eigen::Matrix< Scalar, Cols, 1 > solve(const Eigen::Matrix< Scalar, Rows, Cols > &A, const Eigen::Matrix< Scalar, Rows, 1 > &b)
Definition: FloatTrait.h:27
static Scalar fabs(const Scalar &x)
Definition: FloatTrait.h:23
static Scalar tan(const Scalar &x)
Definition: FloatTrait.h:18
static Scalar cosh(const Scalar &x)
Definition: FloatTrait.h:20
static Scalar sinh(const Scalar &x)
Definition: FloatTrait.h:19
static Scalar sin(const Scalar &x)
Definition: FloatTrait.h:16
Definition: FloatTrait.h:12
static Scalar sqrt(const Scalar &x)
Definition: FloatTrait.h:24