fix various warning

add b3ResourcePath utility, to locate resources relative to executable
This commit is contained in:
Erwin Coumans (Google)
2015-07-03 18:17:14 -07:00
parent 4a9441c5fd
commit 8517e85b21
18 changed files with 176 additions and 92 deletions

View File

@@ -24,6 +24,7 @@ subject to the following restrictions:
#include "../CommonInterfaces/CommonGUIHelperInterface.h"
#include "Bullet3Common/b3FileUtils.h"
#include <string>
#include "../../Utils/b3ResourcePath.h"
@@ -101,7 +102,8 @@ bool BulletURDFImporter::loadURDF(const char* fileName)
b3FileUtils fu;
bool fileFound = fu.findFile(fileName, relativeFileName, 1024);
//bool fileFound = fu.findFile(fileName, relativeFileName, 1024);
bool fileFound = b3ResourcePath::findResourcePath(fileName,relativeFileName,1024);
std::string xml_string;
m_data->m_pathPrefix[0] = 0;
@@ -390,7 +392,7 @@ void convertURDFToVisualShape(const UrdfVisual* visual, const char* urdfPathPref
upAxis);
glmesh = new GLInstanceGraphicsShape;
int index = 0;
// int index = 0;
glmesh->m_indices = new b3AlignedObjectArray<int>();
glmesh->m_vertices = new b3AlignedObjectArray<GLInstanceVertex>();
@@ -501,7 +503,7 @@ void convertURDFToVisualShape(const UrdfVisual* visual, const char* urdfPathPref
glmesh = new GLInstanceGraphicsShape;
int index = 0;
// int index = 0;
glmesh->m_indices = new b3AlignedObjectArray<int>();
glmesh->m_vertices = new b3AlignedObjectArray<GLInstanceVertex>();
@@ -702,7 +704,7 @@ btCollisionShape* convertURDFToCollisionShape(const UrdfCollision* collision, co
upAxis );
glmesh = new GLInstanceGraphicsShape;
int index = 0;
// int index = 0;
glmesh->m_indices = new b3AlignedObjectArray<int>();
glmesh->m_vertices = new b3AlignedObjectArray<GLInstanceVertex>();

View File

@@ -9,7 +9,9 @@
#include "BulletDynamics/Featherstone/btMultiBodyJointMotor.h"
#include "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h"
#include "../CommonInterfaces/CommonParameterInterface.h"
#ifdef ENABLE_ROS_URDF
#include "ROSURDFImporter.h"
#endif
#include "BulletUrdfImporter.h"
@@ -197,18 +199,20 @@ void ImportUrdfSetup::initPhysics()
//now print the tree using the new interface
URDFImporterInterface* bla=0;
static bool newURDF = false;
newURDF = !newURDF;
static bool newURDF = true;
if (newURDF)
{
b3Printf("using new URDF\n");
bla = new BulletURDFImporter(m_guiHelper);
} else
}
#ifdef USE_ROS_URDF
else
{
b3Printf("using ROS URDF\n");
bla = new ROSURDFImporter(m_guiHelper);
}
newURDF = !newURDF;
#endif//USE_ROS_URDF
URDFImporterInterface& u2b = *bla;
bool loadOk = u2b.loadURDF(m_fileName);

View File

@@ -12,8 +12,8 @@
#include "URDFJointTypes.h"
MyMultiBodyCreator::MyMultiBodyCreator(GUIHelperInterface* guiHelper)
:m_guiHelper(guiHelper),
m_bulletMultiBody(0)
:m_bulletMultiBody(0),
m_guiHelper(guiHelper)
{
}

View File

@@ -152,7 +152,7 @@ bool ROSURDFImporter::loadURDF(const char* fileName)
m_data->m_robot->getLinks(m_data->m_links);
//initialize the 'index' of each link
for (int i=0;i<m_data->m_links.size();i++)
for (int i=0;i<(int)m_data->m_links.size();i++)
{
m_data->m_links[i]->m_link_index = i;
}
@@ -413,7 +413,7 @@ void ROSconvertURDFToVisualShape(const Visual* visual, const char* urdfPathPrefi
upAxis);
glmesh = new GLInstanceGraphicsShape;
int index = 0;
//int index = 0;
glmesh->m_indices = new b3AlignedObjectArray<int>();
glmesh->m_vertices = new b3AlignedObjectArray<GLInstanceVertex>();
@@ -524,7 +524,7 @@ void ROSconvertURDFToVisualShape(const Visual* visual, const char* urdfPathPrefi
glmesh = new GLInstanceGraphicsShape;
int index = 0;
// int index = 0;
glmesh->m_indices = new b3AlignedObjectArray<int>();
glmesh->m_vertices = new b3AlignedObjectArray<GLInstanceVertex>();
@@ -726,7 +726,7 @@ btCollisionShape* convertURDFToCollisionShape(const Collision* visual, const cha
upAxis );
glmesh = new GLInstanceGraphicsShape;
int index = 0;
// int index = 0;
glmesh->m_indices = new b3AlignedObjectArray<int>();
glmesh->m_vertices = new b3AlignedObjectArray<GLInstanceVertex>();

View File

@@ -73,9 +73,10 @@ void printTree(const URDFImporterInterface& u2b, int linkIndex, int indentationL
struct URDF2BulletCachedData
{
URDF2BulletCachedData()
:m_totalNumJoints1(0),
m_currentMultiBodyLinkIndex(-1),
m_bulletMultiBody(0)
:
m_currentMultiBodyLinkIndex(-1),
m_bulletMultiBody(0),
m_totalNumJoints1(0)
{
}

View File

@@ -18,7 +18,7 @@ static bool parseVector4(btVector4& vec4, const std::string& vector_str)
btArray<std::string> pieces;
btArray<float> rgba;
urdfStringSplit(pieces, vector_str, urdfIsAnyOf(" "));
for (unsigned int i = 0; i < pieces.size(); ++i)
for (int i = 0; i < pieces.size(); ++i)
{
if (!pieces[i].empty())
{
@@ -39,7 +39,7 @@ static bool parseVector3(btVector3& vec3, const std::string& vector_str, ErrorLo
btArray<std::string> pieces;
btArray<float> rgba;
urdfStringSplit(pieces, vector_str, urdfIsAnyOf(" "));
for (unsigned int i = 0; i < pieces.size(); ++i)
for (int i = 0; i < pieces.size(); ++i)
{
if (!pieces[i].empty())
{
@@ -844,4 +844,4 @@ bool UrdfParser::loadUrdf(const char* urdfText, ErrorLogger* logger)
return initTreeAndRoot(logger);
}
}