use multibody by default when using FILE/Open URDF (instead of maximal coordinate rigid body+typed constraints)

This commit is contained in:
Erwin Coumans
2015-08-06 00:35:03 -07:00
parent 6d8ad72d68
commit dcab0e2b1f
5 changed files with 15 additions and 17 deletions

Binary file not shown.

View File

@@ -266,9 +266,8 @@ void openFileDemo(const char* filename)
s_parameterInterface->removeAllParameters(); s_parameterInterface->removeAllParameters();
CommonExampleOptions options(s_guiHelper,0); CommonExampleOptions options(s_guiHelper,1);
options.m_fileName = filename; options.m_fileName = filename;
char fullPath[1024]; char fullPath[1024];
sprintf(fullPath, "%s", filename); sprintf(fullPath, "%s", filename);
b3FileUtils::toLower(fullPath); b3FileUtils::toLower(fullPath);

View File

@@ -794,8 +794,8 @@ bool UrdfParser::loadUrdf(const char* urdfText, ErrorLogger* logger, bool forceF
vis.m_localMaterial = **mat; vis.m_localMaterial = **mat;
} else } else
{ {
logger->reportError("Cannot find material with name:"); //logger->reportError("Cannot find material with name:");
logger->reportError(vis.m_materialName.c_str()); //logger->reportError(vis.m_materialName.c_str());
} }
} }
} }

View File

@@ -493,7 +493,10 @@ int stbi_write_png(char const *filename, int x, int y, int comp, const void *dat
unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len); unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len);
if (!png) return 0; if (!png) return 0;
f = fopen(filename, "wb"); f = fopen(filename, "wb");
if (!f) { free(png); return 0; } if (!f) {
free(png);
return 0;
}
fwrite(png, 1, len, f); fwrite(png, 1, len, f);
fclose(f); fclose(f);
free(png); free(png);

View File

@@ -61,6 +61,9 @@ struct LWRightBody
//Exponential map //Exponential map
//google for "Practical Parameterization of Rotations Using the Exponential Map", F. Sebastian Grassia //google for "Practical Parameterization of Rotations Using the Exponential Map", F. Sebastian Grassia
//btQuaternion q_w = [ sin(|w|*dt/2) * w/|w| , cos(|w|*dt/2)]
//btQuaternion q_new = q_w * q_old;
btVector3 axis; btVector3 axis;
btScalar fAngle = m_angularVelocity.length(); btScalar fAngle = m_angularVelocity.length();
//limit the angular motion //limit the angular motion
@@ -88,6 +91,7 @@ struct LWRightBody
predictedOrn.normalize(); predictedOrn.normalize();
m_worldPose.m_worldOrientation = predictedOrn; m_worldPose.m_worldOrientation = predictedOrn;
} }
} }
@@ -99,13 +103,9 @@ struct LWRightBody
///quick demo showing the right-handed coordinate system and positive rotations around each axis
class Tutorial : public CommonExampleInterface class Tutorial : public CommonExampleInterface
{ {
CommonGraphicsApp* m_app; CommonGraphicsApp* m_app;
float m_x;
float m_y;
float m_z;
int m_tutorialIndex; int m_tutorialIndex;
LWRightBody* m_body; LWRightBody* m_body;
@@ -114,14 +114,14 @@ public:
Tutorial(CommonGraphicsApp* app, int tutorialIndex) Tutorial(CommonGraphicsApp* app, int tutorialIndex)
:m_app(app), :m_app(app),
m_x(0),
m_y(0),
m_z(0),
m_tutorialIndex(tutorialIndex) m_tutorialIndex(tutorialIndex)
{ {
m_app->setUpAxis(2); m_app->setUpAxis(2);
switch (m_tutorialIndex)
{
}
{ {
int boxId = m_app->registerCubeShape(100,100,1); int boxId = m_app->registerCubeShape(100,100,1);
@@ -186,10 +186,6 @@ public:
} }
virtual void stepSimulation(float deltaTime) virtual void stepSimulation(float deltaTime)
{ {
m_x+=0.01f;
m_y+=0.01f;
m_z+=0.01f;
//m_body->m_worldPose.m_worldPosition+= btVector3(0,0.01,0);
//m_body->m_linearVelocity=btVector3(0,0.1,0); //m_body->m_linearVelocity=btVector3(0,0.1,0);
m_body->m_angularVelocity =btVector3(0,0.1,0); m_body->m_angularVelocity =btVector3(0,0.1,0);
m_body->integrateTransform(deltaTime); m_body->integrateTransform(deltaTime);