fix in structure alignment of btMultiBodyLinkDoubleData and btMultiBodyDoubleData
causing serialization issue in URDF/SDF loading in double-precision mode on Windows 32bit. (it was fine on Mac/Linux 64bit) bump serialization version to 2.85, as we change the file format fix in name clash in makesdna.cpp -> intptr_t is already defined.
This commit is contained in:
@@ -5,7 +5,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
|||||||
SET(MSVC_INCREMENTAL_DEFAULT ON)
|
SET(MSVC_INCREMENTAL_DEFAULT ON)
|
||||||
|
|
||||||
PROJECT(BULLET_PHYSICS)
|
PROJECT(BULLET_PHYSICS)
|
||||||
SET(BULLET_VERSION 2.83)
|
SET(BULLET_VERSION 2.85)
|
||||||
|
|
||||||
IF(COMMAND cmake_policy)
|
IF(COMMAND cmake_policy)
|
||||||
cmake_policy(SET CMP0003 NEW)
|
cmake_policy(SET CMP0003 NEW)
|
||||||
|
|||||||
@@ -1353,9 +1353,6 @@ typedef struct bInvalidHandle {
|
|||||||
btVector3DoubleData m_thisPivotToThisComOffset;
|
btVector3DoubleData m_thisPivotToThisComOffset;
|
||||||
btVector3DoubleData m_jointAxisTop[6];
|
btVector3DoubleData m_jointAxisTop[6];
|
||||||
btVector3DoubleData m_jointAxisBottom[6];
|
btVector3DoubleData m_jointAxisBottom[6];
|
||||||
char *m_linkName;
|
|
||||||
char *m_jointName;
|
|
||||||
btCollisionObjectDoubleData *m_linkCollider;
|
|
||||||
btVector3DoubleData m_linkInertia;
|
btVector3DoubleData m_linkInertia;
|
||||||
double m_linkMass;
|
double m_linkMass;
|
||||||
int m_parentIndex;
|
int m_parentIndex;
|
||||||
@@ -1367,6 +1364,10 @@ typedef struct bInvalidHandle {
|
|||||||
double m_jointTorque[6];
|
double m_jointTorque[6];
|
||||||
double m_jointDamping;
|
double m_jointDamping;
|
||||||
double m_jointFriction;
|
double m_jointFriction;
|
||||||
|
char *m_linkName;
|
||||||
|
char *m_jointName;
|
||||||
|
btCollisionObjectDoubleData *m_linkCollider;
|
||||||
|
char *m_paddingPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1379,9 +1380,6 @@ typedef struct bInvalidHandle {
|
|||||||
btVector3FloatData m_thisPivotToThisComOffset;
|
btVector3FloatData m_thisPivotToThisComOffset;
|
||||||
btVector3FloatData m_jointAxisTop[6];
|
btVector3FloatData m_jointAxisTop[6];
|
||||||
btVector3FloatData m_jointAxisBottom[6];
|
btVector3FloatData m_jointAxisBottom[6];
|
||||||
char *m_linkName;
|
|
||||||
char *m_jointName;
|
|
||||||
btCollisionObjectFloatData *m_linkCollider;
|
|
||||||
btVector3FloatData m_linkInertia;
|
btVector3FloatData m_linkInertia;
|
||||||
int m_dofCount;
|
int m_dofCount;
|
||||||
float m_linkMass;
|
float m_linkMass;
|
||||||
@@ -1393,6 +1391,10 @@ typedef struct bInvalidHandle {
|
|||||||
int m_posVarCount;
|
int m_posVarCount;
|
||||||
float m_jointDamping;
|
float m_jointDamping;
|
||||||
float m_jointFriction;
|
float m_jointFriction;
|
||||||
|
char *m_linkName;
|
||||||
|
char *m_jointName;
|
||||||
|
btCollisionObjectFloatData *m_linkCollider;
|
||||||
|
char *m_paddingPtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1400,13 +1402,14 @@ typedef struct bInvalidHandle {
|
|||||||
class btMultiBodyDoubleData
|
class btMultiBodyDoubleData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
btTransformDoubleData m_baseWorldTransform;
|
||||||
|
btVector3DoubleData m_baseInertia;
|
||||||
|
double m_baseMass;
|
||||||
char *m_baseName;
|
char *m_baseName;
|
||||||
btMultiBodyLinkDoubleData *m_links;
|
btMultiBodyLinkDoubleData *m_links;
|
||||||
btCollisionObjectDoubleData *m_baseCollider;
|
btCollisionObjectDoubleData *m_baseCollider;
|
||||||
btTransformDoubleData m_baseWorldTransform;
|
char *m_paddingPtr;
|
||||||
btVector3DoubleData m_baseInertia;
|
|
||||||
int m_numLinks;
|
int m_numLinks;
|
||||||
double m_baseMass;
|
|
||||||
char m_padding[4];
|
char m_padding[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ int main(int argc,char** argv)
|
|||||||
fprintf(dump, "%s\n", data);
|
fprintf(dump, "%s\n", data);
|
||||||
|
|
||||||
|
|
||||||
char* filename = "../../../../data/slope.bullet";
|
char* filename = "../../../../data/r2d2_multibody.bullet";
|
||||||
|
|
||||||
if (argc==2)
|
if (argc==2)
|
||||||
filename = argv[1];
|
filename = argv[1];
|
||||||
|
|||||||
@@ -70,22 +70,17 @@ typedef unsigned __int32 uint32_t;
|
|||||||
typedef unsigned __int64 uint64_t;
|
typedef unsigned __int64 uint64_t;
|
||||||
|
|
||||||
#ifndef _INTPTR_T_DEFINED
|
#ifndef _INTPTR_T_DEFINED
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
typedef __int64 intptr_t;
|
typedef __int64 btintptr_t;
|
||||||
|
#else
|
||||||
|
typedef long btintptr_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
typedef long intptr_t;
|
typedef intptr_t btintptr_t;
|
||||||
#endif
|
|
||||||
#define _INTPTR_T_DEFINED
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _UINTPTR_T_DEFINED
|
|
||||||
#ifdef _WIN64
|
|
||||||
typedef unsigned __int64 uintptr_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned long uintptr_t;
|
|
||||||
#endif
|
|
||||||
#define _UINTPTR_T_DEFINED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(__linux__) || defined(__NetBSD__)
|
#elif defined(__linux__) || defined(__NetBSD__)
|
||||||
|
|
||||||
@@ -1070,7 +1065,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
|
|||||||
/* calculate size of datablock with strings */
|
/* calculate size of datablock with strings */
|
||||||
cp= names[nr_names-1];
|
cp= names[nr_names-1];
|
||||||
cp+= strlen(names[nr_names-1]) + 1; /* +1: null-terminator */
|
cp+= strlen(names[nr_names-1]) + 1; /* +1: null-terminator */
|
||||||
len= (intptr_t) (cp - (char*) names[0]);
|
len= (btintptr_t) (cp - (char*) names[0]);
|
||||||
len= (len+3) & ~3;
|
len= (len+3) & ~3;
|
||||||
dna_write(file, names[0], len);
|
dna_write(file, names[0], len);
|
||||||
|
|
||||||
@@ -1083,7 +1078,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
|
|||||||
/* calculate datablock size */
|
/* calculate datablock size */
|
||||||
cp= types[nr_types-1];
|
cp= types[nr_types-1];
|
||||||
cp+= strlen(types[nr_types-1]) + 1; /* +1: null-terminator */
|
cp+= strlen(types[nr_types-1]) + 1; /* +1: null-terminator */
|
||||||
len= (intptr_t) (cp - (char*) types[0]);
|
len= (btintptr_t) (cp - (char*) types[0]);
|
||||||
len= (len+3) & ~3;
|
len= (len+3) & ~3;
|
||||||
|
|
||||||
dna_write(file, types[0], len);
|
dna_write(file, types[0], len);
|
||||||
@@ -1105,7 +1100,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
|
|||||||
/* calc datablock size */
|
/* calc datablock size */
|
||||||
sp= structs[nr_structs-1];
|
sp= structs[nr_structs-1];
|
||||||
sp+= 2+ 2*( sp[1] );
|
sp+= 2+ 2*( sp[1] );
|
||||||
len= (intptr_t) ((char*) sp - (char*) structs[0]);
|
len= (btintptr_t) ((char*) sp - (char*) structs[0]);
|
||||||
len= (len+3) & ~3;
|
len= (len+3) & ~3;
|
||||||
|
|
||||||
dna_write(file, structs[0], len);
|
dna_write(file, structs[0], len);
|
||||||
|
|||||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#include "ImportURDFSetup.h"
|
#include "ImportURDFSetup.h"
|
||||||
#include "BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h"
|
#include "BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h"
|
||||||
|
//#define TEST_MULTIBODY_SERIALIZATION 1
|
||||||
|
|
||||||
#include "BulletDynamics/Featherstone/btMultiBodyLinkCollider.h"
|
#include "BulletDynamics/Featherstone/btMultiBodyLinkCollider.h"
|
||||||
#include "Bullet3Common/b3FileUtils.h"
|
#include "Bullet3Common/b3FileUtils.h"
|
||||||
@@ -377,6 +377,7 @@ void ImportUrdfSetup::initPhysics()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef TEST_MULTIBODY_SERIALIZATION
|
#ifdef TEST_MULTIBODY_SERIALIZATION
|
||||||
m_dynamicsWorld->serialize(s);
|
m_dynamicsWorld->serialize(s);
|
||||||
b3ResourcePath p;
|
b3ResourcePath p;
|
||||||
|
|||||||
@@ -677,19 +677,11 @@ struct btMultiBodyLinkDoubleData
|
|||||||
btVector3DoubleData m_jointAxisTop[6];
|
btVector3DoubleData m_jointAxisTop[6];
|
||||||
btVector3DoubleData m_jointAxisBottom[6];
|
btVector3DoubleData m_jointAxisBottom[6];
|
||||||
|
|
||||||
|
|
||||||
char *m_linkName;
|
|
||||||
char *m_jointName;
|
|
||||||
btCollisionObjectDoubleData *m_linkCollider;
|
|
||||||
|
|
||||||
btVector3DoubleData m_linkInertia; // inertia of the base (in local frame; diagonal)
|
btVector3DoubleData m_linkInertia; // inertia of the base (in local frame; diagonal)
|
||||||
double m_linkMass;
|
double m_linkMass;
|
||||||
int m_parentIndex;
|
int m_parentIndex;
|
||||||
int m_jointType;
|
int m_jointType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int m_dofCount;
|
int m_dofCount;
|
||||||
int m_posVarCount;
|
int m_posVarCount;
|
||||||
double m_jointPos[7];
|
double m_jointPos[7];
|
||||||
@@ -699,6 +691,11 @@ struct btMultiBodyLinkDoubleData
|
|||||||
double m_jointDamping;
|
double m_jointDamping;
|
||||||
double m_jointFriction;
|
double m_jointFriction;
|
||||||
|
|
||||||
|
char *m_linkName;
|
||||||
|
char *m_jointName;
|
||||||
|
btCollisionObjectDoubleData *m_linkCollider;
|
||||||
|
char *m_paddingPtr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct btMultiBodyLinkFloatData
|
struct btMultiBodyLinkFloatData
|
||||||
@@ -708,12 +705,6 @@ struct btMultiBodyLinkFloatData
|
|||||||
btVector3FloatData m_thisPivotToThisComOffset;
|
btVector3FloatData m_thisPivotToThisComOffset;
|
||||||
btVector3FloatData m_jointAxisTop[6];
|
btVector3FloatData m_jointAxisTop[6];
|
||||||
btVector3FloatData m_jointAxisBottom[6];
|
btVector3FloatData m_jointAxisBottom[6];
|
||||||
|
|
||||||
|
|
||||||
char *m_linkName;
|
|
||||||
char *m_jointName;
|
|
||||||
btCollisionObjectFloatData *m_linkCollider;
|
|
||||||
|
|
||||||
btVector3FloatData m_linkInertia; // inertia of the base (in local frame; diagonal)
|
btVector3FloatData m_linkInertia; // inertia of the base (in local frame; diagonal)
|
||||||
int m_dofCount;
|
int m_dofCount;
|
||||||
float m_linkMass;
|
float m_linkMass;
|
||||||
@@ -729,23 +720,26 @@ struct btMultiBodyLinkFloatData
|
|||||||
float m_jointDamping;
|
float m_jointDamping;
|
||||||
float m_jointFriction;
|
float m_jointFriction;
|
||||||
|
|
||||||
|
char *m_linkName;
|
||||||
|
char *m_jointName;
|
||||||
|
btCollisionObjectFloatData *m_linkCollider;
|
||||||
|
char *m_paddingPtr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
|
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
|
||||||
struct btMultiBodyDoubleData
|
struct btMultiBodyDoubleData
|
||||||
{
|
{
|
||||||
|
btTransformDoubleData m_baseWorldTransform;
|
||||||
|
btVector3DoubleData m_baseInertia; // inertia of the base (in local frame; diagonal)
|
||||||
|
double m_baseMass;
|
||||||
|
|
||||||
char *m_baseName;
|
char *m_baseName;
|
||||||
btMultiBodyLinkDoubleData *m_links;
|
btMultiBodyLinkDoubleData *m_links;
|
||||||
btCollisionObjectDoubleData *m_baseCollider;
|
btCollisionObjectDoubleData *m_baseCollider;
|
||||||
|
char *m_paddingPtr;
|
||||||
btTransformDoubleData m_baseWorldTransform;
|
|
||||||
btVector3DoubleData m_baseInertia; // inertia of the base (in local frame; diagonal)
|
|
||||||
|
|
||||||
int m_numLinks;
|
int m_numLinks;
|
||||||
double m_baseMass;
|
char m_padding[4];
|
||||||
|
|
||||||
char m_padding[4];
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
|
///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ subject to the following restrictions:
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
|
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
|
||||||
#define BT_BULLET_VERSION 284
|
#define BT_BULLET_VERSION 285
|
||||||
|
|
||||||
inline int btGetVersion()
|
inline int btGetVersion()
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -484,7 +484,7 @@ public:
|
|||||||
|
|
||||||
buffer[9] = '2';
|
buffer[9] = '2';
|
||||||
buffer[10] = '8';
|
buffer[10] = '8';
|
||||||
buffer[11] = '4';
|
buffer[11] = '5';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user