Merge pull request #529 from erwincoumans/master
[InverseDynamics] 4-spaces->tabs for src/BulletInverseDynamics, Add custom namespaces per configuration
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#define BT_ID_POW(a,b) std::pow(a,b)
|
#define BT_ID_POW(a,b) std::pow(a,b)
|
||||||
#define BT_ID_SNPRINTF snprintf
|
#define BT_ID_SNPRINTF snprintf
|
||||||
#define BT_ID_PI M_PI
|
#define BT_ID_PI M_PI
|
||||||
|
#define BT_ID_USE_DOUBLE_PRECISION
|
||||||
#else
|
#else
|
||||||
#define BT_ID_POW(a,b) btPow(a,b)
|
#define BT_ID_POW(a,b) btPow(a,b)
|
||||||
#define BT_ID_PI SIMD_PI
|
#define BT_ID_PI SIMD_PI
|
||||||
@@ -24,11 +25,18 @@
|
|||||||
#define INVDYN_INCLUDE_HELPER_2(x) #x
|
#define INVDYN_INCLUDE_HELPER_2(x) #x
|
||||||
#define INVDYN_INCLUDE_HELPER(x) INVDYN_INCLUDE_HELPER_2(x)
|
#define INVDYN_INCLUDE_HELPER(x) INVDYN_INCLUDE_HELPER_2(x)
|
||||||
#include INVDYN_INCLUDE_HELPER(BT_CUSTOM_INVERSE_DYNAMICS_CONFIG_H)
|
#include INVDYN_INCLUDE_HELPER(BT_CUSTOM_INVERSE_DYNAMICS_CONFIG_H)
|
||||||
|
#ifndef btInverseDynamics
|
||||||
|
#error "custom inverse dynamics config, but no custom namespace defined"
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
|
#define btInverseDynamics btInverseDynamicsBullet3
|
||||||
// Use default configuration with bullet's types
|
// Use default configuration with bullet's types
|
||||||
// Use the same scalar type as rest of bullet library
|
// Use the same scalar type as rest of bullet library
|
||||||
#include "LinearMath/btScalar.h"
|
#include "LinearMath/btScalar.h"
|
||||||
typedef btScalar idScalar;
|
typedef btScalar idScalar;
|
||||||
|
#ifdef BT_USE_DOUBLE_PRECISION
|
||||||
|
#define BT_ID_USE_DOUBLE_PRECISION
|
||||||
|
#endif
|
||||||
// use bullet types for arrays and array indices
|
// use bullet types for arrays and array indices
|
||||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||||
// this is to make it work with C++2003, otherwise we could do this:
|
// this is to make it work with C++2003, otherwise we could do this:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
///@file Configuration for Inverse Dynamics Library without external dependencies
|
///@file Configuration for Inverse Dynamics Library without external dependencies
|
||||||
#ifndef INVDYNCONFIG_BUILTIN_HPP_
|
#ifndef INVDYNCONFIG_BUILTIN_HPP_
|
||||||
#define INVDYNCONFIG_BUILTIN_HPP_
|
#define INVDYNCONFIG_BUILTIN_HPP_
|
||||||
|
#define btInverseDynamics btInverseDynamicsBuiltin
|
||||||
#ifdef BT_USE_DOUBLE_PRECISION
|
#ifdef BT_USE_DOUBLE_PRECISION
|
||||||
// choose double/single precision version
|
// choose double/single precision version
|
||||||
typedef double idScalar;
|
typedef double idScalar;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
///@file Configuration for Inverse Dynamics Library with Eigen
|
///@file Configuration for Inverse Dynamics Library with Eigen
|
||||||
#ifndef INVDYNCONFIG_EIGEN_HPP_
|
#ifndef INVDYNCONFIG_EIGEN_HPP_
|
||||||
#define INVDYNCONFIG_EIGEN_HPP_
|
#define INVDYNCONFIG_EIGEN_HPP_
|
||||||
|
#define btInverseDynamics btInverseDynamicsEigen
|
||||||
#ifdef BT_USE_DOUBLE_PRECISION
|
#ifdef BT_USE_DOUBLE_PRECISION
|
||||||
// choose double/single precision version
|
// choose double/single precision version
|
||||||
typedef double idScalar;
|
typedef double idScalar;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef MULTIBODYTREE_HPP_
|
#ifndef MULTIBODYTREE_HPP_
|
||||||
#define MULTIBODYTREE_HPP_
|
#define MULTIBODYTREE_HPP_
|
||||||
|
|
||||||
|
#include "IDConfig.hpp"
|
||||||
#include "IDMath.hpp"
|
#include "IDMath.hpp"
|
||||||
|
|
||||||
namespace btInverseDynamics {
|
namespace btInverseDynamics {
|
||||||
@@ -304,5 +305,4 @@ private:
|
|||||||
InitCache* m_init_cache;
|
InitCache* m_init_cache;
|
||||||
};
|
};
|
||||||
} // namespace btInverseDynamics
|
} // namespace btInverseDynamics
|
||||||
|
|
||||||
#endif // MULTIBODYTREE_HPP_
|
#endif // MULTIBODYTREE_HPP_
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#include "../IDConfig.hpp"
|
||||||
|
|
||||||
namespace btInverseDynamics {
|
namespace btInverseDynamics {
|
||||||
class vec3;
|
class vec3;
|
||||||
class vecx;
|
class vecx;
|
||||||
|
|||||||
@@ -248,7 +248,11 @@ int calculateDifferentiationError(const MultiBodyTreeCreator& creator, idScalar
|
|||||||
// first test: absolute difference between numerical and numerial
|
// first test: absolute difference between numerical and numerial
|
||||||
// differentiation should be small
|
// differentiation should be small
|
||||||
TEST(InvDynKinematicsDifferentiation, errorAbsolute) {
|
TEST(InvDynKinematicsDifferentiation, errorAbsolute) {
|
||||||
|
#ifdef BT_ID_USE_DOUBLE_PRECISION
|
||||||
const idScalar kDeltaT = 1e-7;
|
const idScalar kDeltaT = 1e-7;
|
||||||
|
#else
|
||||||
|
const idScalar kDeltaT = 1e-2;
|
||||||
|
#endif
|
||||||
const idScalar kDuration = 1e-2;
|
const idScalar kDuration = 1e-2;
|
||||||
const idScalar kAcceptableError = 1e-4;
|
const idScalar kAcceptableError = 1e-4;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user