Revision: 8476
http://playerstage.svn.sourceforge.net/playerstage/?rev=8476&view=rev
Author: natepak
Date: 2009-12-19 00:39:10 +0000 (Sat, 19 Dec 2009)
Log Message:
-----------
Added libdl and fixed zero errors with meshes
Modified Paths:
--------------
code/gazebo/trunk/cmake/SearchForStuff.cmake
code/gazebo/trunk/server/Mesh.cc
code/gazebo/trunk/server/controllers/ControllerFactory.cc
code/gazebo/trunk/server/gui/icon.xpm
code/gazebo/trunk/server/physics/TrimeshShape.cc
code/gazebo/trunk/server/physics/ode/ODEPhysics.cc
Modified: code/gazebo/trunk/cmake/SearchForStuff.cmake
===================================================================
--- code/gazebo/trunk/cmake/SearchForStuff.cmake 2009-12-18 21:51:53 UTC
(rev 8475)
+++ code/gazebo/trunk/cmake/SearchForStuff.cmake 2009-12-19 00:39:10 UTC
(rev 8476)
@@ -315,6 +315,29 @@
ENDIF (libtool_library AND libtool_include_dir)
########################################
+# Find libdl
+FIND_PATH(libdl_include_dir dlfcn.h /usr/include /usr/local/include)
+IF (NOT libdl_include_dir)
+ MESSAGE (STATUS "Looking for dlfcn.h - not found")
+ MESSAGE (STATUS "Warning: Unable to find libdl, plugins will not be
supported.")
+ SET (libdl_include_dir /usr/include)
+ELSE (NOT libdl_include_dir)
+ MESSAGE (STATUS "Looking for dlfcn.h - found")
+ENDIF (NOT libdl_include_dir)
+
+FIND_LIBRARY(libdl_library dl /usr/lib /usr/local/lib)
+IF (NOT libdl_library)
+ MESSAGE (STATUS "Looking for libdl - not found")
+ MESSAGE (STATUS "Warning: Unable to find libdl, plugins will not be
supported.")
+ELSE (NOT libdl_library)
+ MESSAGE (STATUS "Looking for libdl - found")
+ENDIF (NOT libdl_library)
+
+IF (libdl_library AND libdl_include_dir)
+ SET (HAVE_DL TRUE)
+ENDIF (libdl_library AND libdl_include_dir)
+
+########################################
# Find bullet
FIND_PATH( bullet_include_dir btBulletDynamicsCommon.h ${bullet_include_dirs}
ENV CPATH)
IF (NOT bullet_include_dir)
Modified: code/gazebo/trunk/server/Mesh.cc
===================================================================
--- code/gazebo/trunk/server/Mesh.cc 2009-12-18 21:51:53 UTC (rev 8475)
+++ code/gazebo/trunk/server/Mesh.cc 2009-12-19 00:39:10 UTC (rev 8476)
@@ -294,6 +294,13 @@
/// Add a vertex to the mesh
void SubMesh::AddVertex( Vector3 v )
{
+ if (fabs(v.x) < 0.00001)
+ v.x = 0.0;
+ if (fabs(v.y) < 0.00001)
+ v.y = 0.0;
+ if (fabs(v.z) < 0.00001)
+ v.z = 0.0;
+
this->vertices.push_back( v );
}
@@ -308,6 +315,14 @@
/// Add a normal to the mesh
void SubMesh::AddNormal( Vector3 n )
{
+ if (fabs(n.x) < 0.00001)
+ n.x = 0.0;
+ if (fabs(n.y) < 0.00001)
+ n.y = 0.0;
+ if (fabs(n.z) < 0.00001)
+ n.z = 0.0;
+
+
this->normals.push_back(n);
}
Modified: code/gazebo/trunk/server/controllers/ControllerFactory.cc
===================================================================
--- code/gazebo/trunk/server/controllers/ControllerFactory.cc 2009-12-18
21:51:53 UTC (rev 8475)
+++ code/gazebo/trunk/server/controllers/ControllerFactory.cc 2009-12-19
00:39:10 UTC (rev 8476)
@@ -33,10 +33,11 @@
#include "Controller.hh"
#include "ControllerFactory.hh"
-
-#ifdef HAVE_LTDL
+#ifdef HAVE_DL
+#include <dlfcn.h>
+#elif HAVE_LTDL
#include <ltdl.h>
-#endif // HAVE_LTDL
+#endif
using namespace gazebo;
@@ -72,8 +73,31 @@
// Load a controller plugin. Used by Model and Sensor when creating
controllers.
void ControllerFactory::LoadPlugin(const std::string &plugin, const
std::string &classname)
{
-#ifdef HAVE_LTDL
+#ifdef HAVE_DL
+ std::cerr << "\n\n\n\n\USING DL\n\n\n\n";
+ void* handle = dlopen(plugin.c_str(), RTLD_LAZY|RTLD_GLOBAL);
+ if (!handle)
+ {
+ std::ostringstream stream;
+ stream << "Failed to load " << plugin << ": " << dlerror();
+ gzthrow(stream.str());
+ }
+
+ std::string registerName = "RegisterPluginController";
+ void *(*registerFunc)() = (void *(*)())dlsym(handle, registerName.c_str());
+ if(!registerFunc)
+ {
+ std::ostringstream stream;
+ stream << "Failed to resolve " << registerName << ": " << dlerror();
+ gzthrow(stream.str());
+ }
+
+ // Register the new controller.
+ registerFunc();
+
+#elif HAVE_LTDL
+
std::cout << "Load Plugin[" << plugin << "] Classname[" << classname <<
"]\n";
static bool init_done = false;
@@ -108,13 +132,14 @@
stream << "Failed to resolve " << registerName << ": " << lt_dlerror();
gzthrow(stream.str());
}
-
+
// Register the new controller.
- registerFunc();
-
+ registerFunc();
+
#else // HAVE_LTDL
gzthrow("Cannot load plugins as libtool is not installed.");
#endif // HAVE_LTDL
+
}
Modified: code/gazebo/trunk/server/gui/icon.xpm
===================================================================
--- code/gazebo/trunk/server/gui/icon.xpm 2009-12-18 21:51:53 UTC (rev
8475)
+++ code/gazebo/trunk/server/gui/icon.xpm 2009-12-19 00:39:10 UTC (rev
8476)
@@ -1,5 +1,5 @@
/* XPM */
-static char * icon_xpm[] = {
+const static char * icon_xpm[] = {
"16 16 103 2",
" c None",
". c #BFBFBF",
Modified: code/gazebo/trunk/server/physics/TrimeshShape.cc
===================================================================
--- code/gazebo/trunk/server/physics/TrimeshShape.cc 2009-12-18 21:51:53 UTC
(rev 8475)
+++ code/gazebo/trunk/server/physics/TrimeshShape.cc 2009-12-19 00:39:10 UTC
(rev 8476)
@@ -66,6 +66,7 @@
this->scaleP->Load(node);
this->mesh = meshManager->Load( **this->meshNameP );
+ //this->mesh->Print();
Mass mass = this->parent->GetMass();
Modified: code/gazebo/trunk/server/physics/ode/ODEPhysics.cc
===================================================================
--- code/gazebo/trunk/server/physics/ode/ODEPhysics.cc 2009-12-18 21:51:53 UTC
(rev 8475)
+++ code/gazebo/trunk/server/physics/ode/ODEPhysics.cc 2009-12-19 00:39:10 UTC
(rev 8476)
@@ -417,7 +417,7 @@
ODEGeom *geom2 = NULL;
int i;
int numc = 0;
- dContactGeom contactGeoms[64];
+ dContactGeom contactGeoms[3000];
dContact contact;
self = (ODEPhysics*) data;
@@ -453,7 +453,7 @@
int numContacts = 5;
if (geom1->GetType() == Shape::TRIMESH && geom2->GetType()==Shape::TRIMESH)
- numContacts = 64;
+ numContacts = 3000;
numc = dCollide(o1,o2,numContacts, contactGeoms, sizeof(contactGeoms[0]));
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit