Revision: 7739
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7739&view=rev
Author:   natepak
Date:     2009-05-29 13:08:16 +0000 (Fri, 29 May 2009)

Log Message:
-----------
More bullet updates

Modified Paths:
--------------
    code/gazebo/branches/bullet/cmake/SearchForStuff.cmake
    code/gazebo/branches/bullet/server/Pose3d.cc
    code/gazebo/branches/bullet/server/Pose3d.hh
    code/gazebo/branches/bullet/server/Quatern.cc
    code/gazebo/branches/bullet/server/Quatern.hh
    code/gazebo/branches/bullet/server/Vector3.hh
    code/gazebo/branches/bullet/server/physics/CMakeLists.txt
    code/gazebo/branches/bullet/server/physics/MapGeom.cc
    code/gazebo/branches/bullet/server/physics/MapGeom.hh
    code/gazebo/branches/bullet/server/physics/PhysicsEngine.cc
    code/gazebo/branches/bullet/server/physics/PhysicsEngine.hh
    code/gazebo/branches/bullet/server/physics/bullet/BulletGeom.cc
    code/gazebo/branches/bullet/server/physics/bullet/BulletHeightmapGeom.cc
    code/gazebo/branches/bullet/server/physics/bullet/BulletHeightmapGeom.hh
    code/gazebo/branches/bullet/server/physics/bullet/BulletMotionState.cc
    code/gazebo/branches/bullet/server/physics/bullet/BulletPhysics.cc
    code/gazebo/branches/bullet/server/physics/bullet/CMakeLists.txt
    code/gazebo/branches/bullet/server/physics/ode/CMakeLists.txt
    code/gazebo/branches/bullet/server/physics/ode/ODEPhysics.cc
    code/gazebo/branches/bullet/server/rendering/OgreCreator.cc
    code/gazebo/branches/bullet/server/rendering/OgreVisual.cc
    code/gazebo/branches/bullet/worlds/bullet.world

Modified: code/gazebo/branches/bullet/cmake/SearchForStuff.cmake
===================================================================
--- code/gazebo/branches/bullet/cmake/SearchForStuff.cmake      2009-05-29 
09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/cmake/SearchForStuff.cmake      2009-05-29 
13:08:16 UTC (rev 7739)
@@ -243,9 +243,11 @@
   MESSAGE (STATUS "Looking for libfreeimage - found")
 ENDIF (NOT freeimage_library)
 
+
 ########################################
 # Find avformat and avcodec
 IF (HAVE_FFMPEG)
+
   SET (libavformat_search_path 
     /usr/include /usr/include/libavformat /usr/local/include 
     /usr/local/include/libavformat
@@ -260,6 +262,7 @@
   IF (NOT LIBAVFORMAT_PATH)
     MESSAGE (STATUS "Looking for avformat.h - not found")
     MESSAGE (STATUS "  Warning: audio/video will not be built")
+    SET (LIBAVFORMAT_PATH /usr/include)
   ELSE (NOT LIBAVFORMAT_PATH)
     MESSAGE (STATUS "Looking for avformat.h - found")
   ENDIF (NOT LIBAVFORMAT_PATH)
@@ -268,6 +271,7 @@
   IF (NOT LIBAVCODEC_PATH)
     MESSAGE (STATUS "Looking for avcodec.h - not found")
     MESSAGE (STATUS "  Warning: audio/video will not be built")
+    SET (LIBAVCODEC_PATH /usr/include)
   ELSE (NOT LIBAVCODEC_PATH)
     MESSAGE (STATUS "Looking for avcodec.h - found")
   ENDIF (NOT LIBAVCODEC_PATH)

Modified: code/gazebo/branches/bullet/server/Pose3d.cc
===================================================================
--- code/gazebo/branches/bullet/server/Pose3d.cc        2009-05-29 09:33:48 UTC 
(rev 7738)
+++ code/gazebo/branches/bullet/server/Pose3d.cc        2009-05-29 13:08:16 UTC 
(rev 7739)
@@ -40,6 +40,8 @@
 {
   this->pos = pos;
   this->rot = rot;
+
+  this->rot.Normalize();
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -48,6 +50,7 @@
 {
   this->pos = pose.pos;
   this->rot = pose.rot;
+  this->rot.Normalize();
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -63,6 +66,13 @@
   return this->pos.IsFinite() && this->rot.IsFinite();
 }
 
+////////////////////////////////////////////////////////////////////////////////
+/// Get the inverse of this pose
+Pose3d Pose3d::GetInverse() const
+{
+  Quatern inv = this->rot.GetInverse();
+  return Pose3d( inv * this->pos, inv );
+}
 
 
////////////////////////////////////////////////////////////////////////////////
 // Add two poses: result = this + obj
@@ -70,7 +80,7 @@
 {
   Pose3d result;
 
-  result.pos = this->CoordPositionAdd(obj);
+  result.pos = this->CoordPositionAdd(obj.pos);
   result.rot = this->CoordRotationAdd(obj.rot);
 
   return result;
@@ -80,7 +90,7 @@
 /// Add-Equals operator
 const Pose3d &Pose3d::operator+=(const Pose3d &obj)
 {
-  this->pos = this->CoordPositionAdd(obj);
+  this->pos = this->CoordPositionAdd(obj.pos);
   this->rot = this->CoordRotationAdd(obj.rot);
 
   return *this;
@@ -108,45 +118,33 @@
   return *this;
 }
 
+
 
////////////////////////////////////////////////////////////////////////////////
-// Add one point to a vector: result = this + pos
-Vector3 Pose3d::CoordPositionAdd(const Vector3 &pos) const
+/// Multiplication operator
+Pose3d Pose3d::operator*(const Pose3d &pose)
 {
-  Quatern tmp;
-  Vector3 result;
-
-  // result = pose.rot + pose.rot * this->pos * pose.rot!
-  tmp.u = 0.0;
-  tmp.x = pos.x;
-  tmp.y = pos.y;
-  tmp.z = pos.z;
-
-  tmp = this->rot * (tmp * this->rot.GetInverse());
-  result.x = this->pos.x + tmp.x;
-  result.y = this->pos.y + tmp.y;
-  result.z = this->pos.z + tmp.z;
-
-  return result;
+  return Pose3d(this->CoordPositionAdd(pose.pos), this->rot * pose.rot);
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Add one point to another: result = this + pose
-Vector3 Pose3d::CoordPositionAdd(const Pose3d &pose) const
+Vector3 Pose3d::CoordPositionAdd(const Vector3 &_pos) const
 {
   Quatern tmp;
   Vector3 result;
 
   // result = pose.rot + pose.rot * this->pos * pose.rot!
   tmp.u = 0.0;
-  tmp.x = this->pos.x;
-  tmp.y = this->pos.y;
-  tmp.z = this->pos.z;
+  tmp.x = _pos.x;
+  tmp.y = _pos.y;
+  tmp.z = _pos.z;
 
-  tmp = pose.rot * (tmp * pose.rot.GetInverse());
-  result.x = pose.pos.x + tmp.x;
-  result.y = pose.pos.y + tmp.y;
-  result.z = pose.pos.z + tmp.z;
+  tmp = this->rot * (tmp * this->rot.GetInverse());
 
+  result.x = this->pos.x + tmp.x;
+  result.y = this->pos.y + tmp.y;
+  result.z = this->pos.z + tmp.z;
+ 
   return result;
 }
 

Modified: code/gazebo/branches/bullet/server/Pose3d.hh
===================================================================
--- code/gazebo/branches/bullet/server/Pose3d.hh        2009-05-29 09:33:48 UTC 
(rev 7738)
+++ code/gazebo/branches/bullet/server/Pose3d.hh        2009-05-29 13:08:16 UTC 
(rev 7739)
@@ -62,6 +62,9 @@
   /// \brief See if a pose is finite (e.g., not nan)
   public: bool IsFinite() const;
 
+  /// \brief Get the inverse of this pose
+  public: Pose3d GetInverse() const;
+
   /// \brief Addition operator
   /// \param pose Pose to add to this pose
   /// \return The resulting pose
@@ -81,16 +84,14 @@
   /// \param pose Pose to subtract from this one
   /// \return The resulting pose
   public: const Pose3d &operator-=(const Pose3d &pose);
+
+  /// \brief Multiplication operator
+  public: Pose3d operator*(const Pose3d &pose);
           
-  /// \brief Add one point to a vector: result = this + pos
-  /// \param pos Position to add to this pose
-  /// \return The resulting position
-  public: Vector3 CoordPositionAdd(const Vector3 &pos) const;
-
   /// \brief Add one point to another: result = this + pose
   /// \param pose The Pose to add
   /// \return The resulting position
-  public: Vector3 CoordPositionAdd(const Pose3d &pose) const;
+  public: Vector3 CoordPositionAdd(const Vector3 &pos) const;
 
   /// \brief Subtract one position from another: result = this - pose
   /// \param pose Pose to subtract

Modified: code/gazebo/branches/bullet/server/Quatern.cc
===================================================================
--- code/gazebo/branches/bullet/server/Quatern.cc       2009-05-29 09:33:48 UTC 
(rev 7738)
+++ code/gazebo/branches/bullet/server/Quatern.cc       2009-05-29 13:08:16 UTC 
(rev 7739)
@@ -97,25 +97,14 @@
 // Invert the quaternion
 void Quatern::Invert()
 {
-  this->x = -this->x;
-  this->y = -this->y;
-  this->z = -this->z;
+  (*this) = this->GetInverse();
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Get the inverse of this quaternion
 Quatern Quatern::GetInverse() const 
 {
-  Quatern q;
-
-  q.u = this->u;
-  q.x = -this->x;
-  q.y = -this->y;
-  q.z = -this->z;
-
-  //q.Normalize();
-
-  return q;
+  return Quatern(this->u, -this->x, -this->y, -this->z);
 }
 
 
@@ -285,6 +274,17 @@
 }
 
 
////////////////////////////////////////////////////////////////////////////////
+/// Rotate a vector 
+Vector3 Quatern::operator*( const Vector3 &v ) const
+{
+  Quatern tmp(0.0, v.x, v.y, v.z);
+  
+  tmp = (*this) * (tmp * this->GetInverse());
+
+  return Vector3(tmp.x, tmp.y, tmp.z);
+}
+
+////////////////////////////////////////////////////////////////////////////////
 /// Rotate a vector using the quaternion
 Vector3 Quatern::RotateVector(Vector3 vec) const
 {

Modified: code/gazebo/branches/bullet/server/Quatern.hh
===================================================================
--- code/gazebo/branches/bullet/server/Quatern.hh       2009-05-29 09:33:48 UTC 
(rev 7738)
+++ code/gazebo/branches/bullet/server/Quatern.hh       2009-05-29 13:08:16 UTC 
(rev 7739)
@@ -128,6 +128,9 @@
   /// \return This quatern multiplied by the parameter
   public: Quatern operator*( const Quatern &qt ) const;
 
+  /// \brief Vector3 multiplication operator
+  public: Vector3 operator*( const Vector3 &v ) const;
+
   /// \brief Rotate a vector using the quaternion
   /// \return The rotated vector
   public: Vector3 RotateVector(Vector3 vec) const;

Modified: code/gazebo/branches/bullet/server/Vector3.hh
===================================================================
--- code/gazebo/branches/bullet/server/Vector3.hh       2009-05-29 09:33:48 UTC 
(rev 7738)
+++ code/gazebo/branches/bullet/server/Vector3.hh       2009-05-29 13:08:16 UTC 
(rev 7739)
@@ -161,6 +161,12 @@
 
 };
 
+/// \brief Return the negative of the vector
+inline Vector3 operator-(const Vector3 &v)
+{
+  return Vector3(-v.x, -v.y, -v.z);
+}
+
 /// \}
 }
 

Modified: code/gazebo/branches/bullet/server/physics/CMakeLists.txt
===================================================================
--- code/gazebo/branches/bullet/server/physics/CMakeLists.txt   2009-05-29 
09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/CMakeLists.txt   2009-05-29 
13:08:16 UTC (rev 7739)
@@ -13,6 +13,7 @@
              PhysicsEngine.cc
              Mass.cc
              PhysicsFactory.cc
+             MapGeom.cc
 ) 
 
 SET (headers Joint.hh
@@ -23,6 +24,7 @@
              Mass.hh
              PhysicsFactory.hh
              PhysicsRaySensor.hh
+             MapGeom.hh
 )
 
 #ADD_LIBRARY(gazebo_physics STATIC ${sources})

Modified: code/gazebo/branches/bullet/server/physics/MapGeom.cc
===================================================================
--- code/gazebo/branches/bullet/server/physics/MapGeom.cc       2009-05-29 
09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/MapGeom.cc       2009-05-29 
13:08:16 UTC (rev 7739)
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <math.h>
 
+#include "PhysicsEngine.hh"
 #include "GazeboConfig.hh"
 #include "OgreVisual.hh"
 #include "Image.hh"

Modified: code/gazebo/branches/bullet/server/physics/MapGeom.hh
===================================================================
--- code/gazebo/branches/bullet/server/physics/MapGeom.hh       2009-05-29 
09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/MapGeom.hh       2009-05-29 
13:08:16 UTC (rev 7739)
@@ -21,17 +21,18 @@
 /* Desc: Occupancy grid geom
  * Author: Nate Koenig
  * Date: 14 Jly 2008
- * CVS: $Id: BulletMapGeom.hh 7634 2009-05-11 01:43:31Z natepak $
+ * SVN: $Id: MapGeom.hh 7634 2009-05-11 01:43:31Z natepak $
  */
 
-#ifndef BulletMAPGEOM_HH
-#define BulletMAPGEOM_HH
+#ifndef MAPGEOM_HH
+#define MAPGEOM_HH
 
 #include <deque>
 
 #include "Vector2.hh"
 #include "Param.hh"
-#include "BulletGeom.hh"
+#include "Mass.hh"
+#include "Geom.hh"
 
 namespace gazebo
 {
@@ -88,13 +89,13 @@
   class QuadNode;
 
   /// \brief Map geom
-  class BulletMapGeom : public BulletGeom
+  class MapGeom : public Geom
   {
     /// \brief Constructor
-    public: BulletMapGeom(Body *body);
+    public: MapGeom(Body *body);
 
     /// \brief Destructor
-    public: virtual ~BulletMapGeom();
+    public: virtual ~MapGeom();
 
     /// \brief Update function 
     public: void Update();
@@ -104,7 +105,33 @@
 
     /// \brief Save child parameters
     public: void Save(std::string &prefix, std::ostream &stream);
- 
+
+    /// \brief Return the pose of the geom
+    public: virtual void SetPose(const Pose3d &pose, bool updateCoM=true) {}
+
+    /// \brief Return the pose of the geom
+    public: virtual Pose3d GetPose() const {return Pose3d();}
+
+    /// \brief Set the category bits, used during collision detection
+    /// \param bits The bits
+    public: void SetCategoryBits(unsigned int bits) {}
+  
+    /// \brief Set the collide bits, used during collision detection
+    /// \param bits The bits
+    public: void SetCollideBits(unsigned int bits) {}
+
+    /// \brief Get the mass of the geom
+    public: Mass GetBodyMassMatrix() {return Mass();}
+
+    /// \brief Set the mass
+    public: void SetMass(const Mass &mass) {}
+
+    /// \brief Set the mass from a double
+    public: void SetMass(const double &mass) {}
+
+    /// \brief Get the bounding box, defined by the physics engine
+    public: void GetBoundingBox( Vector3 &min, Vector3 &max ) {}
+
     /// \brief Build the quadtree
     private: void BuildTree(QuadNode *node);
 

Modified: code/gazebo/branches/bullet/server/physics/PhysicsEngine.cc
===================================================================
--- code/gazebo/branches/bullet/server/physics/PhysicsEngine.cc 2009-05-29 
09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/PhysicsEngine.cc 2009-05-29 
13:08:16 UTC (rev 7739)
@@ -26,6 +26,7 @@
 
 #include <boost/thread/recursive_mutex.hpp>
 
+#include "MapGeom.hh"
 #include "PhysicsEngine.hh"
 
 using namespace gazebo;
@@ -89,3 +90,19 @@
 {
   this->mutex->unlock();
 }
+
+////////////////////////////////////////////////////////////////////////////////
+/// Create a new geom
+Geom *PhysicsEngine::CreateGeom(const std::string &type, Entity *parent)
+{
+  Geom *geom = NULL;
+  Body *body = (Body*)(parent);
+
+  if (type == "map")
+  {
+    parent->SetStatic(true);
+    geom = new MapGeom(body);
+  }
+
+  return geom;
+}

Modified: code/gazebo/branches/bullet/server/physics/PhysicsEngine.hh
===================================================================
--- code/gazebo/branches/bullet/server/physics/PhysicsEngine.hh 2009-05-29 
09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/PhysicsEngine.hh 2009-05-29 
13:08:16 UTC (rev 7739)
@@ -115,7 +115,7 @@
 
     /// \brief Create a new geom
     public: virtual Geom *CreateGeom(const std::string &type, 
-                                     Entity *parent) = 0;
+                                     Entity *parent);
 
     /// \brief Create a new body
     public: virtual Body *CreateBody(Entity *parent) = 0;

Modified: code/gazebo/branches/bullet/server/physics/bullet/BulletGeom.cc
===================================================================
--- code/gazebo/branches/bullet/server/physics/bullet/BulletGeom.cc     
2009-05-29 09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/bullet/BulletGeom.cc     
2009-05-29 13:08:16 UTC (rev 7739)
@@ -65,7 +65,6 @@
 void BulletGeom::Load(XMLConfigNode *node)
 {
   Geom::Load(node);
-  std::cout << "BulletGeom[" << this->GetName() << "] Set Init Pose[" << 
this->GetPose() << "]\n"; 
   this->visualNode->SetPose( this->GetPose() );
 }
 

Modified: 
code/gazebo/branches/bullet/server/physics/bullet/BulletHeightmapGeom.cc
===================================================================
--- code/gazebo/branches/bullet/server/physics/bullet/BulletHeightmapGeom.cc    
2009-05-29 09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/bullet/BulletHeightmapGeom.cc    
2009-05-29 13:08:16 UTC (rev 7739)
@@ -28,6 +28,8 @@
 #include <string.h>
 #include <math.h>
 
+#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
+
 #include "Image.hh"
 #include "Global.hh"
 #include "OgreHeightmap.hh"
@@ -78,13 +80,79 @@
 // Create a lookup table of the terrain's height
 void BulletHeightmapGeom::FillHeightMap()
 {
-  
+  unsigned int x,y;
+  float *heights = new float[this->width * this->height];
+  float maxHeight = -FLT_MAX;
+
+  Vector3 scale = this->terrainSize / this->width;
+
+  // Iterate over all the verices
+  for (y=0; y<this->height; y++)
+  {
+    for (x=0; x<this->width; x++)
+    {
+      // Find the height at a vertex
+      heights[y*this->width + x] = this->ogreHeightmap->GetHeightAt(
+          Vector2<float>(x*scale.x, y*scale.y));
+
+      if (heights[y*this->width + x] > maxHeight)
+        maxHeight = heights[y*this->width + x];
+    }
+  }
+
+  if (this->collisionShape)
+    delete this->collisionShape;
+
+  // This will force the Z-axis to be up
+  int upIndex = 2;
+  int forwardIndex = 1;
+  int rightIndex = 0;
+
+  btVector3 localScaling(this->terrainSize.x, this->terrainSize.y, 
+                         this->terrainSize.z );
+
+  this->heightFieldShape  = new btHeightfieldTerrainShape( this->width, 
+      this->height, heights, maxHeight, upIndex, true, false); 
+
+  this->heightFieldShape->setUseDiamondSubdivision(true);
+  this->heightFieldShape->setLocalScaling(localScaling);
+
+  this->collisionShape = this->heightFieldShape;
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 /// Load the heightmap
 void BulletHeightmapGeom::Load(XMLConfigNode *node)
 {
+
+  Image tmpImage;
+
+  this->imageFilenameP->Load(node);
+  this->worldTextureP->Load(node);
+  this->detailTextureP->Load(node);
+  this->sizeP->Load(node);
+  this->offsetP->Load(node);
+
+  // Use the image to get the size of the heightmap
+  tmpImage.Load( (**this->imageFilenameP) );
+
+  // Width and height must be the same
+  if (tmpImage.GetWidth() != tmpImage.GetHeight())
+  {
+    gzthrow("Heightmap image must be square\n");
+  }
+
+  this->width = this->height = tmpImage.GetWidth();
+
+  this->terrainSize = (**this->sizeP);
+
+  // Step 1: Create the Ogre height map: Performs a ray scene query
+  this->ogreHeightmap->Load( (**this->imageFilenameP), (**this->worldTextureP),
+      (**this->detailTextureP), this->terrainSize );
+
+  // Step 2: Fill the bullet heightmap 
+  this->FillHeightMap();
+
   BulletGeom::Load(node);
 }
 

Modified: 
code/gazebo/branches/bullet/server/physics/bullet/BulletHeightmapGeom.hh
===================================================================
--- code/gazebo/branches/bullet/server/physics/bullet/BulletHeightmapGeom.hh    
2009-05-29 09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/bullet/BulletHeightmapGeom.hh    
2009-05-29 13:08:16 UTC (rev 7739)
@@ -24,12 +24,16 @@
  * CVS: $Id: BulletHeightmapGeom.hh 7640 2009-05-13 02:06:08Z natepak $
  */
 
-#ifndef BulletHEIGHTMAPGEOM_HH
-#define BulletHEIGHTMAPGEOM_HH
+#ifndef BULLETHEIGHTMAPGEOM_HH
+#define BULLETHEIGHTMAPGEOM_HH
 
+//#include <btBulletDynamicsCommon.h>
+//#include <btBulletCollisionCommon.h>
 #include "Vector2.hh"
 #include "BulletGeom.hh"
 
+class btHeightfieldTerrainShape;
+
 namespace gazebo
 {
   class OgreHeightmap;
@@ -96,8 +100,6 @@
 
     private: Vector3 terrainSize;
 
-    private: std::vector<double> heights;
-
     private: ParamT<std::string> *imageFilenameP;
     private: ParamT<std::string> *worldTextureP;
     private: ParamT<std::string> *detailTextureP;
@@ -105,6 +107,9 @@
     private: ParamT<Vector3> *offsetP;
 
     private: OgreHeightmap *ogreHeightmap;
+
+    private: int width, height;
+    private: btHeightfieldTerrainShape* heightFieldShape;
   };
 
   /// \}

Modified: code/gazebo/branches/bullet/server/physics/bullet/BulletMotionState.cc
===================================================================
--- code/gazebo/branches/bullet/server/physics/bullet/BulletMotionState.cc      
2009-05-29 09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/bullet/BulletMotionState.cc      
2009-05-29 13:08:16 UTC (rev 7739)
@@ -116,10 +116,15 @@
 
   newPose.pos.Set( origin.x(), origin.y(), origin.z() ); 
   newPose.rot.Set( rot.w(), rot.x(), rot.y(), rot.z() );
+  Quatern qrot;
+  qrot.SetFromEuler(Vector3(-180,0,0));
+  newPose.rot = newPose.rot + qrot;
 
-  std::cout << "New Rot[" << newPose.rot << "] OldRo[" << this->pose.rot << 
"]\n";
+  /*std::cout << "Old Pose[" << this->pose << "] New Pose[" 
+            << pose << "]\n";
+            */
 
   this->pose = newPose;
 
-  this->visual->SetPose(this->pose * this->comOffset);
+  this->visual->SetPose(newPose);//this->pose * this->comOffset);
 }

Modified: code/gazebo/branches/bullet/server/physics/bullet/BulletPhysics.cc
===================================================================
--- code/gazebo/branches/bullet/server/physics/bullet/BulletPhysics.cc  
2009-05-29 09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/bullet/BulletPhysics.cc  
2009-05-29 13:08:16 UTC (rev 7739)
@@ -32,8 +32,6 @@
 #include "BulletBoxGeom.hh"
 #include "BulletCylinderGeom.hh"
 #include "BulletTrimeshGeom.hh"
-#include "BulletHeightmapGeom.hh"
-#include "BulletMapGeom.hh"
 
 #include "PhysicsFactory.hh"
 #include "Mass.hh"
@@ -178,7 +176,7 @@
 /// Create a new geom
 Geom *BulletPhysics::CreateGeom(const std::string &type, Entity *parent)
 {
-  BulletGeom *geom = NULL;
+  Geom *geom = NULL;
   BulletBody *body = NULL;
 
   body = dynamic_cast<BulletBody*>(parent);
@@ -196,8 +194,10 @@
     geom = new BulletCylinderGeom(body);
   else
   {
-    gzerr(0) << "Unknown geom of type[" << type << "]\n";
-    geom = NULL;
+    geom = PhysicsEngine::CreateGeom(type, parent);
+
+    if (geom == NULL)
+      gzthrow("Unknown Geometry Type["+type+"]");
   }
 
   return geom;

Modified: code/gazebo/branches/bullet/server/physics/bullet/CMakeLists.txt
===================================================================
--- code/gazebo/branches/bullet/server/physics/bullet/CMakeLists.txt    
2009-05-29 09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/bullet/CMakeLists.txt    
2009-05-29 13:08:16 UTC (rev 7739)
@@ -13,7 +13,6 @@
              BulletBoxGeom.cc
              BulletCylinderGeom.cc
              BulletHeightmapGeom.cc
-             BulletMapGeom.cc
              BulletPlaneGeom.cc
              BulletRayGeom.cc
              BulletSphereGeom.cc

Modified: code/gazebo/branches/bullet/server/physics/ode/CMakeLists.txt
===================================================================
--- code/gazebo/branches/bullet/server/physics/ode/CMakeLists.txt       
2009-05-29 09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/ode/CMakeLists.txt       
2009-05-29 13:08:16 UTC (rev 7739)
@@ -14,7 +14,6 @@
              ODEBoxGeom.cc
              ODECylinderGeom.cc
              ODEHeightmapGeom.cc
-             ODEMapGeom.cc
              ODEPlaneGeom.cc
              ODERayGeom.cc
              ODESphereGeom.cc

Modified: code/gazebo/branches/bullet/server/physics/ode/ODEPhysics.cc
===================================================================
--- code/gazebo/branches/bullet/server/physics/ode/ODEPhysics.cc        
2009-05-29 09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/physics/ode/ODEPhysics.cc        
2009-05-29 13:08:16 UTC (rev 7739)
@@ -41,7 +41,6 @@
 #include "ODEBoxGeom.hh"
 #include "ODECylinderGeom.hh"
 #include "ODEHeightmapGeom.hh"
-#include "ODEMapGeom.hh"
 #include "ODEPlaneGeom.hh"
 #include "ODESphereGeom.hh"
 #include "ODETrimeshGeom.hh"
@@ -323,14 +322,12 @@
     parent->SetStatic(true);
     geom = new ODEHeightmapGeom(body);
   }
-  else if (type == "map")
-  {
-    parent->SetStatic(true);
-    geom = new ODEMapGeom(body);
-  }
   else
   {
-    gzthrow("Unknown Geometry Type["+type+"]");
+    Geom *myGeom = PhysicsEngine::CreateGeom(type, parent);
+
+    if (myGeom == NULL)
+      gzthrow("Unknown Geometry Type["+type+"]");
   }
 
   geom->SetSpaceId( body->GetSpaceId() );

Modified: code/gazebo/branches/bullet/server/rendering/OgreCreator.cc
===================================================================
--- code/gazebo/branches/bullet/server/rendering/OgreCreator.cc 2009-05-29 
09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/rendering/OgreCreator.cc 2009-05-29 
13:08:16 UTC (rev 7739)
@@ -747,7 +747,7 @@
     (*iter)->Update();
   }
 
-  {
+  /*{
     boost::recursive_mutex::scoped_lock 
lock(*Simulator::Instance()->GetMutex());
     // Update the visuals
     for (viter = this->visuals.begin(); viter != this->visuals.end(); viter++)
@@ -767,7 +767,7 @@
       else
         vis->SetPose(owner->GetPose() - owner->GetParent()->GetPose());
     }
-  }
+  }*/
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/branches/bullet/server/rendering/OgreVisual.cc
===================================================================
--- code/gazebo/branches/bullet/server/rendering/OgreVisual.cc  2009-05-29 
09:33:48 UTC (rev 7738)
+++ code/gazebo/branches/bullet/server/rendering/OgreVisual.cc  2009-05-29 
13:08:16 UTC (rev 7739)
@@ -186,7 +186,7 @@
   obj->setVisibilityFlags(GZ_ALL_CAMERA);
 
   // Set the pose of the scene node
-  this->SetPose(pose);
+  //this->SetPose(pose);
 
   // Get the size of the mesh
   if (obj)
@@ -614,6 +614,7 @@
     return;
 
   this->sceneNode->setPosition(pos.x, pos.y, pos.z);
+  this->sceneNode->needUpdate(true);
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -630,6 +631,7 @@
     return;
 
   this->sceneNode->setOrientation(rot.u, rot.x, rot.y, rot.z);
+  this->sceneNode->needUpdate(true);
 }
 
 
////////////////////////////////////////////////////////////////////////////////

Modified: code/gazebo/branches/bullet/worlds/bullet.world
===================================================================
--- code/gazebo/branches/bullet/worlds/bullet.world     2009-05-29 09:33:48 UTC 
(rev 7738)
+++ code/gazebo/branches/bullet/worlds/bullet.world     2009-05-29 13:08:16 UTC 
(rev 7739)
@@ -15,7 +15,7 @@
   <verbosity>5</verbosity>
 
   <physics:bullet>
-    <stepTime>0.001</stepTime>
+    <stepTime>0.00001</stepTime>
     <gravity>0 0 -9.8</gravity>
   </physics:bullet>
 
@@ -35,13 +35,13 @@
   </rendering:ogre>
 
   <model:physical name="sphere1_model">
-    <xyz>1 0 2.5</xyz>
+    <xyz>1.5 0 1.5</xyz>
     <rpy>0.0 0.0 0.0</rpy>
     <static>false</static>
 
     <body:sphere name="sphere1_body">
       <geom:sphere name="sphere1_geom">
-        <xyz>0 0 0</xyz>
+        <xyz>0.0 0.1 0.5</xyz>
         <size>0.2</size>
         <mass>1</mass>
 
@@ -54,10 +54,11 @@
         </visual>
       </geom:sphere>
 
-      <geom:sphere name="sphere2_geom">
-        <xyz>-0.5 0 -0.8</xyz>
+      <!--<geom:sphere name="sphere2_geom">
+        <xyz>0.4 0.0 0.8</xyz>
         <size>0.1</size>
-        <mass>.1</mass>
+        <mass>10</mass>
+
         <mu1>109999.0</mu1>
         <visual>
           <size>0.2 0.2 0.2</size>
@@ -65,7 +66,8 @@
           <material>Gazebo/Rocky</material>
         </visual>
       </geom:sphere>
-
+      -->
+      
     </body:sphere>
   </model:physical>
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to