Ian Chen avatar Ian Chen committed 23412bd Merge

Merge from default

Comments (0)

Files changed (15)

 6cefc0062eaf56a3f414d2d2e0cde897be75b840 gazebo-prerelease_1.3.0
 dc47d59da98b573859681e458e0961b0863ebf25 gazebo-prerelease_1.3.0
 ca149ddc5402996433830057cb7b4a605a636383 gazebo-prerelease_1.3.0
+e93d70fe8d38c68fb48c53f35a74f4b17be7c750 gazebo_1.3.1
+cf5483c2183e0d19342466a8f2ab0050e0407a1c gazebo-prerelease_1.3.1
+cf5483c2183e0d19342466a8f2ab0050e0407a1c gazebo-prerelease_1.3.1
+6aeec94a2cf66f175400b25c00a4b1a64ddee18a gazebo-prerelease_1.3.1
+6aeec94a2cf66f175400b25c00a4b1a64ddee18a gazebo-prerelease_1.3.1
+a7d1ab02e2c32f453eb13f9ff0bb0b0cbda822f3 gazebo-prerelease_1.3.1
+a7d1ab02e2c32f453eb13f9ff0bb0b0cbda822f3 gazebo-prerelease_1.3.1
+ee535bb56127ad041893ed0eff4377829212d1c1 gazebo-prerelease_1.3.1
+ee535bb56127ad041893ed0eff4377829212d1c1 gazebo-prerelease_1.3.1
+33d7c60fdaea2354301274c88d5aee7dbad4239b gazebo-prerelease_1.3.1
+33d7c60fdaea2354301274c88d5aee7dbad4239b gazebo-prerelease_1.3.1
+7b725239d23e4cb387572c4cba02c2eec5a490b2 gazebo-prerelease_1.3.1
+7b725239d23e4cb387572c4cba02c2eec5a490b2 gazebo-prerelease_1.3.1
+f04fd5401a543425d53eddd5d7fda331107d4be8 gazebo-prerelease_1.3.1
 
 set (GAZEBO_VERSION_NAME "lithium")
 set (GAZEBO_MAJOR_VERSION 1)
-set (GAZEBO_MINOR_VERSION 3)
+set (GAZEBO_MINOR_VERSION 4)
 set (GAZEBO_PATCH_VERSION 0)
 
 set (GAZEBO_VERSION ${GAZEBO_MAJOR_VERSION}.${GAZEBO_MINOR_VERSION})

gazebo/math/Vector3.hh

       /// \brief Multiplication operators
       /// \param[in] _v the scaling factor
       /// \return a scaled vector
+      public: friend inline Vector3 operator*(double _s,
+                                              const Vector3 &_v)
+      { return Vector3(_v.x * _s, _v.y * _s, _v.z * _s); }
+
+      /// \brief Multiplication operators
+      /// \param[in] _v the scaling factor
+      /// \return a scaled vector
       public: Vector3 operator*(double _v) const;
 
       /// \brief Multiplication operator

gazebo/msgs/msgs.cc

           msgs::Set(geomMsg->mutable_mesh()->mutable_scale(),
               geomElem->GetValueVector3("scale"));
 
-          // The if clause is used to detect instances of "filename" with
-          // the sdf. Eventually this code will be deprecated as people
-          // switch to using uris.
-          if (geomElem->GetValueString("filename") != "__default__")
-          {
-            geomMsg->mutable_mesh()->set_filename(
-                common::find_file(geomElem->GetValueString("filename")));
-          }
-          else
-          {
-            geomMsg->mutable_mesh()->set_filename(
-                geomElem->GetValueString("uri"));
-          }
+          geomMsg->mutable_mesh()->set_filename(
+              geomElem->GetValueString("uri"));
         }
         else if (geomElem->GetName() == "empty")
         {

gazebo/physics/JointController.cc

 /////////////////////////////////////////////////
 void JointController::Reset()
 {
+  // Reset setpoints and feed-forward.
   this->positions.clear();
   this->velocities.clear();
   this->forces.clear();
+  // Should the PID's be reset as well?
 }
 
 /////////////////////////////////////////////////
   common::Time stepTime = currTime - this->prevUpdateTime;
   this->prevUpdateTime = currTime;
 
-  if (this->forces.size() > 0)
+  // Skip the update step if SimTime appears to have gone backward.
+  // Negative update time wreaks havok on the integrators.
+  // This happens when World::ResetTime is called.
+  // TODO: fix this when World::ResetTime is improved
+  if (stepTime > 0)
   {
-    std::map<std::string, double>::iterator iter;
-    for (iter = this->forces.begin(); iter != this->forces.end(); ++iter)
-      this->joints[iter->first]->SetForce(0, iter->second);
-  }
+    if (this->forces.size() > 0)
+    {
+      std::map<std::string, double>::iterator iter;
+      for (iter = this->forces.begin(); iter != this->forces.end(); ++iter)
+        this->joints[iter->first]->SetForce(0, iter->second);
+    }
 
-  if (this->positions.size() > 0)
-  {
-    double cmd;
-    std::map<std::string, double>::iterator iter;
+    if (this->positions.size() > 0)
+    {
+      double cmd;
+      std::map<std::string, double>::iterator iter;
 
-    for (iter = this->positions.begin(); iter != this->positions.end(); ++iter)
+      for (iter = this->positions.begin(); iter != this->positions.end();
+           ++iter)
+      {
+        cmd = this->posPids[iter->first].Update(
+            this->joints[iter->first]->GetAngle(0).Radian() - iter->second,
+            stepTime);
+        this->joints[iter->first]->SetForce(0, cmd);
+      }
+    }
+
+    if (this->velocities.size() > 0)
     {
-      cmd = this->posPids[iter->first].Update(
-          this->joints[iter->first]->GetAngle(0).Radian() - iter->second,
-          stepTime);
-      this->joints[iter->first]->SetForce(0, cmd);
-    }
-  }
+      double cmd;
+      std::map<std::string, double>::iterator iter;
 
-  if (this->velocities.size() > 0)
-  {
-    double cmd;
-    std::map<std::string, double>::iterator iter;
-
-    for (iter = this->velocities.begin();
-         iter != this->velocities.end(); ++iter)
-    {
-      cmd = this->velPids[iter->first].Update(
-          this->joints[iter->first]->GetVelocity(0) - iter->second,
-          stepTime);
-      this->joints[iter->first]->SetForce(0, cmd);
+      for (iter = this->velocities.begin();
+           iter != this->velocities.end(); ++iter)
+      {
+        cmd = this->velPids[iter->first].Update(
+            this->joints[iter->first]->GetVelocity(0) - iter->second,
+            stepTime);
+        this->joints[iter->first]->SetForce(0, cmd);
+      }
     }
   }
 

gazebo/physics/Model.cc

 {
   this->AddType(MODEL);
   this->updateMutex = new boost::recursive_mutex();
-  this->jointController = NULL;
 }
 
 //////////////////////////////////////////////////
 Model::~Model()
 {
   delete this->updateMutex;
-  delete this->jointController;
 }
 
 //////////////////////////////////////////////////
   this->joints.push_back(joint);
 
   if (!this->jointController)
-    this->jointController = new JointController(
-        boost::shared_dynamic_cast<Model>(shared_from_this()));
+    this->jointController.reset(new JointController(
+        boost::shared_dynamic_cast<Model>(shared_from_this())));
   this->jointController->AddJoint(joint);
 }
 

gazebo/physics/Model.hh

 {
   namespace physics
   {
-    class JointController;
     class Gripper;
 
     /// \addtogroup gazebo_physics
       /// \param[in] _sdf SDF parameter.
       private: void LoadGripper(sdf::ElementPtr _sdf);
 
+      /// \brief Get a handle to the Controller for the joints in this model.
+      /// \return A handle to the Controller for the joints in this model.
+      public: JointControllerPtr GetJointController()
+        { return this->jointController; }
+
       /// used by Model::AttachStaticModel
       protected: std::vector<ModelPtr> attachedModels;
 
       private: boost::recursive_mutex *updateMutex;
 
       /// \brief Controller for the joints.
-      private: JointController *jointController;
+      private: JointControllerPtr jointController;
 
       private: bool pluginsLoaded;
     };

gazebo/physics/PhysicsTypes.hh

     class Link;
     class Collision;
     class Joint;
+    class JointController;
     class Contact;
     class PhysicsEngine;
     class Mass;
     /// \brief Boost shared pointer to a Joint object
     typedef boost::shared_ptr<Joint> JointPtr;
 
+    /// \def JointControllerPtr
+    /// \brief Boost shared pointer to a JointController object
+    typedef boost::shared_ptr<JointController> JointControllerPtr;
+
     /// \def  PhysicsEnginePtr
     /// \brief Boost shared pointer to a PhysicsEngine object
     typedef boost::shared_ptr<PhysicsEngine> PhysicsEnginePtr;
     /// \brief Vector of JointPtr
     typedef std::vector<JointPtr> Joint_V;
 
+    /// \def JointController_V
+    /// \brief Vector of JointControllerPtr
+    typedef std::vector<JointControllerPtr> JointController_V;
+
     /// \def Link_V
     /// \brief Vector of LinkPtr
     typedef std::vector<LinkPtr>  Link_V;

gazebo/physics/ode/ODEJoint.cc

   // f2, t2 are the force torque measured on parent body's cg
   // f1, t1 are the force torque measured on child body's cg
   dJointFeedback* fb = this->GetFeedback();
-  wrench.body1Force.Set(fb->f1[0], fb->f1[1], fb->f1[2]);
-  wrench.body1Torque.Set(fb->t1[0], fb->t1[1], fb->t1[2]);
-  wrench.body2Force.Set(fb->f2[0], fb->f2[1], fb->f2[2]);
-  wrench.body2Torque.Set(fb->t2[0], fb->t2[1], fb->t2[2]);
+  if (fb)
+  {
+    wrench.body1Force.Set(fb->f1[0], fb->f1[1], fb->f1[2]);
+    wrench.body1Torque.Set(fb->t1[0], fb->t1[1], fb->t1[2]);
+    wrench.body2Force.Set(fb->f2[0], fb->f2[1], fb->f2[2]);
+    wrench.body2Torque.Set(fb->t2[0], fb->t2[1], fb->t2[2]);
 
-  {
-    // convert torque from about child CG to joint anchor location
-    // cg position specified in child link frame
-    math::Vector3 cgPos = this->childLink->GetInertial()->GetPose().pos;
-    // moment arm rotated into world frame (given feedback is in world frame)
-    math::Vector3 childMomentArm =
-      this->childLink->GetWorldPose().rot.RotateVector(
-      this->anchorPos - cgPos);
+    if (this->childLink)
+    {
+      // convert torque from about child CG to joint anchor location
+      // cg position specified in child link frame
+      math::Vector3 cgPos = this->childLink->GetInertial()->GetPose().pos;
+      // moment arm rotated into world frame (given feedback is in world frame)
+      math::Vector3 childMomentArm =
+        this->childLink->GetWorldPose().rot.RotateVector(
+        this->anchorPos - cgPos);
 
-    // gzerr << "anchor [" << anchorPos
-    //       << "] iarm[" << this->childLink->GetInertial()->GetPose().pos
-    //       << "] childMomentArm[" << childMomentArm
-    //       << "] f1[" << wrench.body1Force
-    //       << "] t1[" << wrench.body1Torque
-    //       << "] fxp[" << wrench.body1Force.Cross(childMomentArm)
-    //       << "]\n";
+      // gzerr << "anchor [" << anchorPos
+      //       << "] iarm[" << this->childLink->GetInertial()->GetPose().pos
+      //       << "] childMomentArm[" << childMomentArm
+      //       << "] f1[" << wrench.body1Force
+      //       << "] t1[" << wrench.body1Torque
+      //       << "] fxp[" << wrench.body1Force.Cross(childMomentArm)
+      //       << "]\n";
 
-    wrench.body1Torque += wrench.body1Force.Cross(childMomentArm);
-  }
+      wrench.body1Torque += wrench.body1Force.Cross(childMomentArm);
+    }
 
-  // convert torque from about parent CG to joint anchor location
-  if (this->parentLink)
-  {
-    // parent cg specified in child link frame
-    math::Vector3 cgPos = ((this->parentLink->GetInertial()->GetPose() +
-                          this->parentLink->GetWorldPose()) -
-                          this->childLink->GetWorldPose()).pos;
+    // convert torque from about parent CG to joint anchor location
+    if (this->parentLink)
+    {
+      // parent cg specified in child link frame
+      math::Vector3 cgPos = ((this->parentLink->GetInertial()->GetPose() +
+                            this->parentLink->GetWorldPose()) -
+                            this->childLink->GetWorldPose()).pos;
 
-    // rotate moement arms into world frame
-    math::Vector3 parentMomentArm =
-      this->childLink->GetWorldPose().rot.RotateVector(
-      this->anchorPos - cgPos);
+      // rotate moement arms into world frame
+      math::Vector3 parentMomentArm =
+        this->childLink->GetWorldPose().rot.RotateVector(
+        this->anchorPos - cgPos);
 
-    wrench.body2Torque -= wrench.body2Force.Cross(parentMomentArm);
+      wrench.body2Torque -= wrench.body2Force.Cross(parentMomentArm);
 
-    // A good check is that
-    // the computed body2Torque shoud in fact be opposite of body1Torque
+      // A good check is that
+      // the computed body2Torque shoud in fact be opposite of body1Torque
+    }
+    else
+    {
+      // convert torque from about child CG to joint anchor location
+      // or simply use equal opposite force as body1 wrench
+      wrench.body2Force = -wrench.body1Force;
+      wrench.body2Torque = -wrench.body1Torque;
+    }
   }
   else
   {
-    // convert torque from about child CG to joint anchor location
-    // or simply use equal opposite force as body1 wrench
-    wrench.body2Force = -wrench.body1Force;
-    wrench.body2Torque = -wrench.body1Torque;
+    // forgot to set provide_feedback?
+    gzwarn << "GetForceTorque: forget to set <provide_feedback>?\n";
   }
 
   return wrench;

gazebo/rendering/RTShaderSystem.cc

 
   if (Ogre::RTShader::ShaderGenerator::initialize())
   {
+    this->initialized = true;
+
     std::string coreLibsPath, cachePath;
     this->GetPaths(coreLibsPath, cachePath);
 
     this->shaderGenerator->setShaderCachePath(cachePath);
 
     this->shaderGenerator->setTargetLanguage("glsl");
-
-    this->initialized = true;
   }
   else
     gzerr << "RT Shader system failed to initialize\n";
   sceneMgr->setShadowTextureCountPerLightType(Ogre::Light::LT_POINT, 0);
   sceneMgr->setShadowTextureCountPerLightType(Ogre::Light::LT_SPOTLIGHT, 0);
   sceneMgr->setShadowTextureCount(3);
-  sceneMgr->setShadowTextureConfig(0, 1024, 1024, Ogre::PF_FLOAT32_RGB);
-  sceneMgr->setShadowTextureConfig(1, 512, 512, Ogre::PF_FLOAT32_RGB);
-  sceneMgr->setShadowTextureConfig(2, 512, 512, Ogre::PF_FLOAT32_RGB);
+  sceneMgr->setShadowTextureConfig(0, 1024, 1024, Ogre::PF_FLOAT32_R);
+  sceneMgr->setShadowTextureConfig(1, 512, 512, Ogre::PF_FLOAT32_R);
+  sceneMgr->setShadowTextureConfig(2, 512, 512, Ogre::PF_FLOAT32_R);
   sceneMgr->setShadowTextureSelfShadow(true);
 
   // TODO: We have two different shadow caster materials, both taken from
   sceneMgr->setShadowCasterRenderBackFaces(true);
 
   // Disable fog on the caster pass.
-  /* Ogre::MaterialPtr passCaterMaterial =
-    Ogre::MaterialManager::getSingleton().getByName("PSSM/shadow_caster");
-  Ogre::Pass* pssmCasterPass = passCaterMaterial->getTechnique(0)->getPass(0);
-  pssmCasterPass->setFog(true); */
+  //  Ogre::MaterialPtr passCaterMaterial =
+  //   Ogre::MaterialManager::getSingleton().getByName("PSSM/shadow_caster");
+  // Ogre::Pass* pssmCasterPass =
+  // passCaterMaterial->getTechnique(0)->getPass(0);
+  // pssmCasterPass->setFog(true);
 
   // shadow camera setup
   this->pssmSetup = new Ogre::PSSMShadowCameraSetup();
   sceneMgr->setShadowCameraSetup(Ogre::ShadowCameraSetupPtr(this->pssmSetup));
 
-  double shadowFarDistance = 100;
-  double cameraNearClip = 0.3;
+  double shadowFarDistance = 1000;
+  double cameraNearClip = 0.01;
   sceneMgr->setShadowFarDistance(shadowFarDistance);
 
   this->pssmSetup->calculateSplitPoints(3, cameraNearClip, shadowFarDistance);
-  this->pssmSetup->setSplitPadding(cameraNearClip);
-  this->pssmSetup->setOptimalAdjustFactor(0, 4);
-  this->pssmSetup->setOptimalAdjustFactor(1, 1);
-  this->pssmSetup->setOptimalAdjustFactor(2, 0.5);
+  this->pssmSetup->setSplitPadding(0);
+
+  // These values do not seem to help at all. Leaving here until I have time
+  // to properly fix shadow z-fighting.
+  // this->pssmSetup->setOptimalAdjustFactor(0, 4);
+  // this->pssmSetup->setOptimalAdjustFactor(1, 1);
+  // this->pssmSetup->setOptimalAdjustFactor(2, 0.5);
 
   this->shadowRenderState = this->shaderGenerator->createSubRenderState(
       Ogre::RTShader::IntegratedPSSM3::Type);
-  Ogre::RTShader::IntegratedPSSM3* pssm3SubRenderState =
+  Ogre::RTShader::IntegratedPSSM3 *pssm3SubRenderState =
     static_cast<Ogre::RTShader::IntegratedPSSM3*>(this->shadowRenderState);
-  const Ogre::PSSMShadowCameraSetup::SplitPointList& srcSplitPoints =
+
+  const Ogre::PSSMShadowCameraSetup::SplitPointList &srcSplitPoints =
     this->pssmSetup->getSplitPoints();
   Ogre::RTShader::IntegratedPSSM3::SplitPointList dstSplitPoints;
 

gazebo/sdf/interface/parser_urdf.cc

            ge != gazebo_it->second.end(); ++ge)
       {
         TiXmlElement *physics     = new TiXmlElement("physics");
-        TiXmlElement *physics_ode     = new TiXmlElement("ode");
-        TiXmlElement *limit     = new TiXmlElement("limit");
+        TiXmlElement *physicsOde = new TiXmlElement("ode");
+        TiXmlElement *limit       = new TiXmlElement("limit");
         // insert stop_cfm, stop_erp, fudge_factor
         if ((*ge)->is_stop_cfm)
         {
         if ((*ge)->is_initial_joint_position)
             addKeyValue(elem, "initial_joint_position",
               values2str(1, &(*ge)->initial_joint_position));
+        */
+
         // insert provideFeedback
         if ((*ge)->provideFeedback)
-            addKeyValue(elem, "provideFeedback", "true");
+            addKeyValue(physicsOde, "provide_feedback", "true");
         else
-            addKeyValue(elem, "provideFeedback", "false");
-        */
+            addKeyValue(physicsOde, "provide_feedback", "false");
+
+        // insert fudge_factor
         if ((*ge)->is_fudge_factor)
-          addKeyValue(physics_ode, "fudge_factor",
+          addKeyValue(physicsOde, "fudge_factor",
                       values2str(1, &(*ge)->fudge_factor));
 
-        physics->LinkEndChild(physics_ode);
-        physics_ode->LinkEndChild(limit);
+        physics->LinkEndChild(physicsOde);
+        physicsOde->LinkEndChild(limit);
         elem->LinkEndChild(physics);
       }
     }
Add a comment to this file

media/materials/scripts/gazebo.material

File contents unchanged.

media/materials/scripts/shadow_caster.program

 
   default_params
   {
-    param_named_auto depth_range scene_depth_range
+    param_named_auto depth_range shadow_scene_depth_range
   }
 }
 
Add a comment to this file

media/materials/textures/CMakeLists.txt

File contents unchanged.

test/regression/camera_sensor.cc

   double rate = static_cast<double>(total_images)/dt.Double();
   gzdbg << "timer [" << dt.Double() << "] seconds rate [" << rate << "] fps\n";
   EXPECT_GT(rate, 7.0);
-  EXPECT_LT(rate, 10.0);
+  EXPECT_LT(rate, 11.0);
   camSensor->GetCamera()->DisconnectNewImageFrame(c);
   delete img;
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.