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)
|
||||
|
||||
PROJECT(BULLET_PHYSICS)
|
||||
SET(BULLET_VERSION 2.83)
|
||||
SET(BULLET_VERSION 2.85)
|
||||
|
||||
IF(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
|
||||
@@ -1353,9 +1353,6 @@ typedef struct bInvalidHandle {
|
||||
btVector3DoubleData m_thisPivotToThisComOffset;
|
||||
btVector3DoubleData m_jointAxisTop[6];
|
||||
btVector3DoubleData m_jointAxisBottom[6];
|
||||
char *m_linkName;
|
||||
char *m_jointName;
|
||||
btCollisionObjectDoubleData *m_linkCollider;
|
||||
btVector3DoubleData m_linkInertia;
|
||||
double m_linkMass;
|
||||
int m_parentIndex;
|
||||
@@ -1367,6 +1364,10 @@ typedef struct bInvalidHandle {
|
||||
double m_jointTorque[6];
|
||||
double m_jointDamping;
|
||||
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_jointAxisTop[6];
|
||||
btVector3FloatData m_jointAxisBottom[6];
|
||||
char *m_linkName;
|
||||
char *m_jointName;
|
||||
btCollisionObjectFloatData *m_linkCollider;
|
||||
btVector3FloatData m_linkInertia;
|
||||
int m_dofCount;
|
||||
float m_linkMass;
|
||||
@@ -1393,6 +1391,10 @@ typedef struct bInvalidHandle {
|
||||
int m_posVarCount;
|
||||
float m_jointDamping;
|
||||
float m_jointFriction;
|
||||
char *m_linkName;
|
||||
char *m_jointName;
|
||||
btCollisionObjectFloatData *m_linkCollider;
|
||||
char *m_paddingPtr;
|
||||
};
|
||||
|
||||
|
||||
@@ -1400,13 +1402,14 @@ typedef struct bInvalidHandle {
|
||||
class btMultiBodyDoubleData
|
||||
{
|
||||
public:
|
||||
btTransformDoubleData m_baseWorldTransform;
|
||||
btVector3DoubleData m_baseInertia;
|
||||
double m_baseMass;
|
||||
char *m_baseName;
|
||||
btMultiBodyLinkDoubleData *m_links;
|
||||
btCollisionObjectDoubleData *m_baseCollider;
|
||||
btTransformDoubleData m_baseWorldTransform;
|
||||
btVector3DoubleData m_baseInertia;
|
||||
char *m_paddingPtr;
|
||||
int m_numLinks;
|
||||
double m_baseMass;
|
||||
char m_padding[4];
|
||||
};
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ int main(int argc,char** argv)
|
||||
fprintf(dump, "%s\n", data);
|
||||
|
||||
|
||||
char* filename = "../../../../data/slope.bullet";
|
||||
char* filename = "../../../../data/r2d2_multibody.bullet";
|
||||
|
||||
if (argc==2)
|
||||
filename = argv[1];
|
||||
|
||||
@@ -70,22 +70,17 @@ typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
#ifndef _INTPTR_T_DEFINED
|
||||
#ifdef _WIN64
|
||||
typedef __int64 intptr_t;
|
||||
#ifdef _WIN64
|
||||
typedef __int64 btintptr_t;
|
||||
#else
|
||||
typedef long btintptr_t;
|
||||
#endif
|
||||
|
||||
#else
|
||||
typedef long intptr_t;
|
||||
#endif
|
||||
#define _INTPTR_T_DEFINED
|
||||
typedef intptr_t btintptr_t;
|
||||
#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__)
|
||||
|
||||
@@ -1070,7 +1065,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
|
||||
/* calculate size of datablock with strings */
|
||||
cp= names[nr_names-1];
|
||||
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;
|
||||
dna_write(file, names[0], len);
|
||||
|
||||
@@ -1083,7 +1078,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
|
||||
/* calculate datablock size */
|
||||
cp= types[nr_types-1];
|
||||
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;
|
||||
|
||||
dna_write(file, types[0], len);
|
||||
@@ -1105,7 +1100,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
|
||||
/* calc datablock size */
|
||||
sp= structs[nr_structs-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;
|
||||
|
||||
dna_write(file, structs[0], len);
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "ImportURDFSetup.h"
|
||||
#include "BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h"
|
||||
|
||||
//#define TEST_MULTIBODY_SERIALIZATION 1
|
||||
|
||||
#include "BulletDynamics/Featherstone/btMultiBodyLinkCollider.h"
|
||||
#include "Bullet3Common/b3FileUtils.h"
|
||||
@@ -377,6 +377,7 @@ void ImportUrdfSetup::initPhysics()
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST_MULTIBODY_SERIALIZATION
|
||||
m_dynamicsWorld->serialize(s);
|
||||
b3ResourcePath p;
|
||||
|
||||
@@ -677,18 +677,10 @@ struct btMultiBodyLinkDoubleData
|
||||
btVector3DoubleData m_jointAxisTop[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)
|
||||
double m_linkMass;
|
||||
int m_parentIndex;
|
||||
int m_jointType;
|
||||
|
||||
|
||||
|
||||
|
||||
int m_dofCount;
|
||||
int m_posVarCount;
|
||||
@@ -698,7 +690,12 @@ struct btMultiBodyLinkDoubleData
|
||||
|
||||
double m_jointDamping;
|
||||
double m_jointFriction;
|
||||
|
||||
|
||||
char *m_linkName;
|
||||
char *m_jointName;
|
||||
btCollisionObjectDoubleData *m_linkCollider;
|
||||
char *m_paddingPtr;
|
||||
|
||||
};
|
||||
|
||||
struct btMultiBodyLinkFloatData
|
||||
@@ -708,12 +705,6 @@ struct btMultiBodyLinkFloatData
|
||||
btVector3FloatData m_thisPivotToThisComOffset;
|
||||
btVector3FloatData m_jointAxisTop[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)
|
||||
int m_dofCount;
|
||||
float m_linkMass;
|
||||
@@ -729,23 +720,26 @@ struct btMultiBodyLinkFloatData
|
||||
float m_jointDamping;
|
||||
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
|
||||
struct btMultiBodyDoubleData
|
||||
{
|
||||
btTransformDoubleData m_baseWorldTransform;
|
||||
btVector3DoubleData m_baseInertia; // inertia of the base (in local frame; diagonal)
|
||||
double m_baseMass;
|
||||
|
||||
char *m_baseName;
|
||||
btMultiBodyLinkDoubleData *m_links;
|
||||
btCollisionObjectDoubleData *m_baseCollider;
|
||||
|
||||
btTransformDoubleData m_baseWorldTransform;
|
||||
btVector3DoubleData m_baseInertia; // inertia of the base (in local frame; diagonal)
|
||||
|
||||
char *m_paddingPtr;
|
||||
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
|
||||
|
||||
@@ -29,7 +29,7 @@ subject to the following restrictions:
|
||||
#include <float.h>
|
||||
|
||||
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
|
||||
#define BT_BULLET_VERSION 284
|
||||
#define BT_BULLET_VERSION 285
|
||||
|
||||
inline int btGetVersion()
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -484,7 +484,7 @@ public:
|
||||
|
||||
buffer[9] = '2';
|
||||
buffer[10] = '8';
|
||||
buffer[11] = '4';
|
||||
buffer[11] = '5';
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user