John Hsu avatar John Hsu committed 586d537 Merge

merging from default

Comments (0)

Files changed (30)

cmake/GazeboUtils.cmake

   set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
 endmacro()
 
+# This should be migrated to more fine control solution based on set_property APPEND
+# directories. It's present on cmake 2.8.8 while precise version is 2.8.7  
+link_directories(${PROJECT_BINARY_DIR}/test)
+include_directories("${PROJECT_SOURCE_DIR}/test/gtest/include")
+
 #################################################
+# Hack: extra sources to build binaries can be supplied to gz_build_tests in the variable
+#       GZ_BUILD_TESTS_EXTRA_EXE_SRCS. This variable will be clean up at the end of the function
 macro (gz_build_tests)
-
   # Build all the tests
   foreach(GTEST_SOURCE_file ${ARGN})
     string(REGEX REPLACE ".cc" "" BINARY_NAME ${GTEST_SOURCE_file})
-    add_executable(${BINARY_NAME} ${GTEST_SOURCE_file})
-
-    # This should be migrated to more fine control solution based on set_property APPEND
-    # directories. It's present on cmake 2.8.8 while precise version is 2.8.7  
-    include_directories("${PROJECT_SOURCE_DIR}/test/gtest/include")
+    add_executable(${BINARY_NAME} ${GTEST_SOURCE_file} ${GZ_BUILD_TESTS_EXTRA_EXE_SRCS})
 
     add_dependencies(${BINARY_NAME}
       gtest gtest_main
              ${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
   endforeach()
 
+  set(GZ_BUILD_TESTS_EXTRA_EXE_SRCS "")
 endmacro()
 
 #################################################
-# INTERNAL function: do not call directly use gz_build_display_tests or gz_build_dri_tests
-macro (_gz_build_qt_tests)
-  # Build all the tests
-  foreach(QTEST_SOURCE_file ${ARGN})
-    string(REGEX REPLACE ".cc" "" BINARY_NAME ${QTEST_SOURCE_file})
-    string(REGEX REPLACE ".cc" ".hh" QTEST_HEADER_file ${QTEST_SOURCE_file})
-    QT4_WRAP_CPP(${BINARY_NAME}_MOC ${QTEST_HEADER_file} QTestFixture.hh)
 
-    add_executable(${BINARY_NAME}
+# Define GUI testing macros as empty and redefine them if support is found
+macro (gz_build_qt_tests)
+endmacro()
+macro (gz_build_display_tests)
+endmacro()
+macro (gz_build_dri_tests)
+endmacro()
+
+if (VALID_DISPLAY)
+  # Redefine build display tests
+  macro (gz_build_display_tests)
+    gz_build_tests(${ARGV})
+  endmacro()
+
+  # Redefine build qt tests
+  macro (gz_build_qt_tests)
+   # Build all the tests
+   foreach(QTEST_SOURCE_file ${ARGN})
+     string(REGEX REPLACE ".cc" "" BINARY_NAME ${QTEST_SOURCE_file})
+     string(REGEX REPLACE ".cc" ".hh" QTEST_HEADER_file ${QTEST_SOURCE_file})
+     QT4_WRAP_CPP(${BINARY_NAME}_MOC ${QTEST_HEADER_file} QTestFixture.hh)
+
+     add_executable(${BINARY_NAME}
       ${${BINARY_NAME}_MOC} ${QTEST_SOURCE_file} QTestFixture.cc)
 
     add_dependencies(${BINARY_NAME}
       ${QT_QTTEST_LIBRARY}
       ${QT_LIBRARIES}
       )
- 
+
     add_test(${BINARY_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME} -xml)
-  
+
     set_tests_properties(${BINARY_NAME} PROPERTIES TIMEOUT 240)
-  
+
     # Check that the test produced a result and create a failure if it didn't.
     # Guards against crashed and timed out tests.
     add_test(check_${BINARY_NAME} ${PROJECT_SOURCE_DIR}/tools/check_test_ran.py
              ${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
-  endforeach()
-endmacro()
-
-# Define GUI testing macros as empty and redefine them if support is found
-macro (gz_build_display_tests)
-endmacro()
-macro (gz_build_dri_tests)
-endmacro()
+    endforeach()
+  endmacro()
+endif()
 
 if (VALID_DRI_DISPLAY)
   macro (gz_build_dri_tests)
-    _gz_build_qt_tests(${ARGV})
+    gz_build_tests(${ARGV})
   endmacro()
 endif()
-
-if (VALID_DISPLAY)
-  macro (gz_build_display_tests)
-    _gz_build_qt_tests(${ARGV})
-  endmacro()
-endif()
-
-

gazebo/gui/CMakeLists.txt

   viewers/ViewFactory.hh
 )
 
-set (display_tests
+set (qt_tests 
   DataLogger_TEST.cc
   TimePanel_TEST.cc
   viewers/ImagesView_TEST.cc
 )
 
-# Generate executables for each of the QT unit tests
-gz_build_display_tests(${tests})
+gz_build_qt_tests(${qt_tests})
 
 set (resources resources.qrc)
 
+
 QT4_WRAP_CPP(headers_MOC ${qt_headers})
 QT4_ADD_RESOURCES(resources_RCC ${resources})
 
 gz_add_executable(gzclient ${sources} main.cc ${headers_MOC} ${headers} ${resources_RCC})
-
 gz_add_library(gazebo_gui ${sources} ${headers_MOC} ${headers} ${resources_RCC})
 
 add_dependencies(gazebo_gui gazebo_msgs)

gazebo/gui/DataLogger_TEST.cc

 /////////////////////////////////////////////////
 void DataLogger_TEST::RecordButton()
 {
+  this->Load("worlds/empty.world");
+
   // Create a new data logger widget
   gazebo::gui::DataLogger *dataLogger = new gazebo::gui::DataLogger;
+  dataLogger->show();
+  QCoreApplication::processEvents();
 
   // Get the record button
   QToolButton *recordButton = dataLogger->findChild<QToolButton*>(
       "dataLoggerRecordButton");
 
   // Get the destination label
-  QLabel *destPathLabel = dataLogger->findChild<QLabel*>(
+  QLineEdit *destPathLabel = dataLogger->findChild<QLineEdit*>(
       "dataLoggerDestnationPathLabel");
 
   // Get the time label
   recordButton->toggle();
 
   // Wait for a log status return message
-  while (destPathLabel->text().toStdString() == "Path: ")
+  while (destPathLabel->text().toStdString().empty())
   {
     // The following line tell QT to process its events. This is vital for
     // all tests, but it must be run in the main thread.
   // Make sure the status label says "Ready"
   txt = statusLabel->text().toStdString();
   QVERIFY(txt == "Ready");
+
+  dataLogger->hide();
 }
 
 /////////////////////////////////////////////////
 void DataLogger_TEST::StressTest()
 {
+  this->Load("worlds/empty.world");
+
   gazebo::transport::NodePtr node;
   gazebo::transport::PublisherPtr pub;
 

gazebo/gui/QTestFixture.cc

   // errors.
   gazebo::common::Console::Instance()->Init("test.log");
 
+  // Initialize the data logger. This will log state information.
+  gazebo::common::LogRecord::Instance()->Init("test");
+
   // Add local search paths
   gazebo::common::SystemPaths::Instance()->AddGazeboPaths(PROJECT_SOURCE_PATH);
 

gazebo/physics/Joint.cc

   this->AddType(Base::JOINT);
   this->forceApplied[0] = 0;
   this->forceApplied[1] = 0;
+  this->effortLimit[0] = -1;
+  this->effortLimit[1] = -1;
+  this->velocityLimit[0] = -1;
+  this->velocityLimit[1] = -1;
 }
 
 //////////////////////////////////////////////////

gazebo/physics/bullet/BulletHingeJoint.cc

 }
 
 //////////////////////////////////////////////////
-void BulletHingeJoint::SetForce(int _index, double _torque)
+void BulletHingeJoint::SetForce(int _index, double _effort)
 {
   if (_index < 0 || static_cast<unsigned int>(_index) >= this->GetAngleCount())
   {
     return;
   }
 
+  // truncating SetForce effort if velocity limit reached.
+  if (this->velocityLimit[_index] >= 0)
+  {
+    if (this->GetVelocity(_index) > this->velocityLimit[_index])
+      _effort = _effort > 0 ? 0 : _effort;
+    else if (this->GetVelocity(_index) < -this->velocityLimit[_index])
+      _effort = _effort < 0 ? 0 : _effort;
+  }
+
   // truncate effort unless effortLimit is negative.
   if (this->effortLimit[_index] >= 0)
-    _torque = math::clamp(_torque, -this->effortLimit[_index],
+    _effort = math::clamp(_effort, -this->effortLimit[_index],
        this->effortLimit[_index]);
 
   // math::Vector3 axis = this->GetLocalAxis(_index);
     this->bulletHinge->getRigidBodyA().getWorldTransform().getBasis() *
     hingeAxisLocal;
 
-  btVector3 hingeTorque = _torque * hingeAxisWorld;
+  btVector3 hingeTorque = _effort * hingeAxisWorld;
 
   this->bulletHinge->getRigidBodyA().applyTorque(hingeTorque);
   this->bulletHinge->getRigidBodyB().applyTorque(-hingeTorque);

gazebo/physics/bullet/BulletHingeJoint.hh

       public: virtual double GetMaxForce(int _index);
 
       // Documentation inherited.
-      public: virtual void SetForce(int _index, double _torque);
+      public: virtual void SetForce(int _index, double _effort);
 
       // Documentation inherited.
       public: virtual double GetForce(int _index);

gazebo/physics/bullet/BulletSliderJoint.cc

 }
 
 //////////////////////////////////////////////////
-void BulletSliderJoint::SetForce(int _index, double _force)
+void BulletSliderJoint::SetForce(int _index, double _effort)
 {
   if (_index < 0 || static_cast<unsigned int>(_index) >= this->GetAngleCount())
   {
     return;
   }
 
+  // truncating SetForce effort if velocity limit reached.
+  if (this->velocityLimit[_index] >= 0)
+  {
+    if (this->GetVelocity(_index) > this->velocityLimit[_index])
+      _effort = _effort > 0 ? 0 : _effort;
+    else if (this->GetVelocity(_index) < -this->velocityLimit[_index])
+      _effort = _effort < 0 ? 0 : _effort;
+  }
+
   // truncate effort if effortLimit is not negative
   if (this->effortLimit[_index] >= 0)
-    _force = math::clamp(_force, -this->effortLimit[_index],
+    _effort = math::clamp(_effort, -this->effortLimit[_index],
        this->effortLimit[_index]);
 
   /*btVector3 hingeAxisLocal = this->bulletSlider->getAFrame().getBasis().getColumn(2); // z-axis of constraint frame
   btVector3 hingeTorque = _torque * hingeAxisWorld;
   */
 
-  btVector3 force(0, 0, _force);
+  btVector3 force(0, 0, _effort);
   this->constraint->getRigidBodyA().applyCentralForce(force);
   this->constraint->getRigidBodyB().applyCentralForce(-force);
 }

gazebo/physics/bullet/BulletSliderJoint.hh

       public: virtual void SetVelocity(int _index, double _angle);
 
       /// \brief Set the slider force
-      public: virtual void SetForce(int _index, double _force);
+      public: virtual void SetForce(int _index, double _effort);
 
       /// \brief Set the max allowed force of an axis(index).
-      public: virtual void SetMaxForce(int _index, double _t);
+      public: virtual void SetMaxForce(int _index, double _force);
 
       /// \brief Get the max allowed force of an axis(index).
       public: virtual double GetMaxForce(int _index);

gazebo/physics/ode/ODEGearboxJoint.cc

 }
 
 //////////////////////////////////////////////////
-void ODEGearboxJoint::SetForce(int _index, double _torque)
+void ODEGearboxJoint::SetForce(int _index, double _effort)
 {
   gzlog << "SetForce not implemented for gearbox\n";
   return;
     return;
   }
 
+  // truncating SetForce effort if velocity limit reached.
+  if (this->velocityLimit[_index] >= 0)
+  {
+    if (this->GetVelocity(_index) > this->velocityLimit[_index])
+      _effort = _effort > 0 ? 0 : _effort;
+    else if (this->GetVelocity(_index) < -this->velocityLimit[_index])
+      _effort = _effort < 0 ? 0 : _effort;
+  }
+
   // truncate effort if effortLimit is not negative
   if (this->effortLimit[_index] >= 0)
-    _torque = math::clamp(_torque,
+    _effort = math::clamp(_effort,
       -this->effortLimit[_index], this->effortLimit[_index]);
 
-  ODEJoint::SetForce(_index, _torque);
+  ODEJoint::SetForce(_index, _effort);
   if (this->childLink)
     this->childLink->SetEnabled(true);
   if (this->parentLink)
     this->parentLink->SetEnabled(true);
-  dJointAddHingeTorque(this->jointId, _torque);
+
+  dJointAddHingeTorque(this->jointId, _effort);
 }
 
 //////////////////////////////////////////////////

gazebo/physics/ode/ODEGearboxJoint.hh

       public: virtual double GetMaxForce(int _index);
 
       // Documentation inherited
-      public: virtual void SetForce(int _index, double _torque);
+      public: virtual void SetForce(int _index, double _effort);
 
       // Documentation inherited
       public: virtual double GetParam(int _parameter) const;

gazebo/physics/ode/ODEHinge2Joint.cc

 
 
 //////////////////////////////////////////////////
-void ODEHinge2Joint::SetForce(int _index, double _torque)
+void ODEHinge2Joint::SetForce(int _index, double _effort)
 {
   if (_index < 0 || static_cast<unsigned int>(_index) >= this->GetAngleCount())
   {
     return;
   }
 
+  // truncating SetForce effort if velocity limit reached.
+  if (this->velocityLimit[_index] >= 0)
+  {
+    if (this->GetVelocity(_index) > this->velocityLimit[_index])
+      _effort = _effort > 0 ? 0 : _effort;
+    else if (this->GetVelocity(_index) < -this->velocityLimit[_index])
+      _effort = _effort < 0 ? 0 : _effort;
+  }
+
   // truncate effort if effortLimit is not negative
   if (this->effortLimit[_index] >= 0)
-    _torque = math::clamp(_torque,
+    _effort = math::clamp(_effort,
       -this->effortLimit[_index], this->effortLimit[_index]);
 
-  ODEJoint::SetForce(_index, _torque);
+  ODEJoint::SetForce(_index, _effort);
   if (this->childLink)
     this->childLink->SetEnabled(true);
   if (this->parentLink)
     this->parentLink->SetEnabled(true);
 
   if (_index == 0)
-    dJointAddHinge2Torques(this->jointId, _torque, 0);
+    dJointAddHinge2Torques(this->jointId, _effort, 0);
   else
-    dJointAddHinge2Torques(this->jointId, 0, _torque);
+    dJointAddHinge2Torques(this->jointId, 0, _effort);
 }
 
 //////////////////////////////////////////////////

gazebo/physics/ode/ODEHinge2Joint.hh

       public: virtual double GetMaxForce(int index);
 
       // Documentation inherited.
-      public: virtual void SetForce(int index, double torque);
+      public: virtual void SetForce(int _index, double _effort);
 
       // Documentation inherited.
       public: virtual double GetParam(int parameter) const;

gazebo/physics/ode/ODEHingeJoint.cc

 }
 
 //////////////////////////////////////////////////
-void ODEHingeJoint::SetForce(int _index, double _torque)
+void ODEHingeJoint::SetForce(int _index, double _effort)
 {
   if (_index < 0 || static_cast<unsigned int>(_index) >= this->GetAngleCount())
   {
     return;
   }
 
+  // truncating SetForce effort if velocity limit reached.
+  if (this->velocityLimit[_index] >= 0)
+  {
+    if (this->GetVelocity(_index) > this->velocityLimit[_index])
+      _effort = _effort > 0 ? 0 : _effort;
+    else if (this->GetVelocity(_index) < -this->velocityLimit[_index])
+      _effort = _effort < 0 ? 0 : _effort;
+  }
+
   // truncate effort if effortLimit is not negative
   if (this->effortLimit[_index] >= 0)
-    _torque = math::clamp(_torque,
+    _effort = math::clamp(_effort,
       -this->effortLimit[_index], this->effortLimit[_index]);
 
-  ODEJoint::SetForce(_index, _torque);
+  ODEJoint::SetForce(_index, _effort);
   if (this->childLink)
     this->childLink->SetEnabled(true);
   if (this->parentLink)
     this->parentLink->SetEnabled(true);
 
-  dJointAddHingeTorque(this->jointId, _torque);
+  dJointAddHingeTorque(this->jointId, _effort);
 }
 
 //////////////////////////////////////////////////

gazebo/physics/ode/ODEHingeJoint.hh

       public: virtual double GetMaxForce(int _index);
 
       // Documentation inherited
-      public: virtual void SetForce(int _index, double _torque);
+      public: virtual void SetForce(int _index, double _effort);
 
       // Documentation inherited
       public: virtual double GetParam(int _parameter) const;

gazebo/physics/ode/ODEScrewJoint.cc

 }
 
 //////////////////////////////////////////////////
-void ODEScrewJoint::SetForce(int _index, double _force)
+void ODEScrewJoint::SetForce(int _index, double _effort)
 {
   if (_index < 0 || static_cast<unsigned int>(_index) >= this->GetAngleCount())
   {
     return;
   }
 
+  // truncating SetForce effort if velocity limit reached.
+  if (this->velocityLimit[_index] >= 0)
+  {
+    if (this->GetVelocity(_index) > this->velocityLimit[_index])
+      _effort = _effort > 0 ? 0 : _effort;
+    else if (this->GetVelocity(_index) < -this->velocityLimit[_index])
+      _effort = _effort < 0 ? 0 : _effort;
+  }
+
   // truncate effort if effortLimit is not negative
   if (this->effortLimit[_index] >= 0.0)
-    _force = math::clamp(_force,
+    _effort = math::clamp(_effort,
       -this->effortLimit[_index], this->effortLimit[_index]);
 
-  ODEJoint::SetForce(_index, _force);
+  ODEJoint::SetForce(_index, _effort);
   if (this->childLink) this->childLink->SetEnabled(true);
   if (this->parentLink) this->parentLink->SetEnabled(true);
 
-  // dJointAddScrewForce(this->jointId, _force);
-  dJointAddScrewTorque(this->jointId, _force);
+  // dJointAddScrewForce(this->jointId, _effort);
+  dJointAddScrewTorque(this->jointId, _effort);
 }
 
 //////////////////////////////////////////////////

gazebo/physics/ode/ODEScrewJoint.hh

       public: virtual void SetVelocity(int _index, double _angle);
 
       // Documentation inherited
-      public: virtual void SetForce(int _index, double _force);
+      public: virtual void SetForce(int _index, double _effort);
 
       // Documentation inherited
       public: virtual void SetMaxForce(int _index, double _t);

gazebo/physics/ode/ODESliderJoint.cc

 }
 
 //////////////////////////////////////////////////
-void ODESliderJoint::SetForce(int _index, double _force)
+void ODESliderJoint::SetForce(int _index, double _effort)
 {
   if (_index < 0 || static_cast<unsigned int>(_index) >= this->GetAngleCount())
   {
     return;
   }
 
+  // truncating SetForce effort if velocity limit reached.
+  if (this->velocityLimit[_index] >= 0)
+  {
+    if (this->GetVelocity(_index) > this->velocityLimit[_index])
+      _effort = _effort > 0 ? 0 : _effort;
+    else if (this->GetVelocity(_index) < -this->velocityLimit[_index])
+      _effort = _effort < 0 ? 0 : _effort;
+  }
+
   // truncate effort if effortLimit is not negative
   if (this->effortLimit[_index] >= 0.0)
-    _force = math::clamp(_force, -this->effortLimit[_index],
+    _effort = math::clamp(_effort, -this->effortLimit[_index],
       this->effortLimit[_index]);
 
-  ODEJoint::SetForce(_index, _force);
+  ODEJoint::SetForce(_index, _effort);
   if (this->childLink)
     this->childLink->SetEnabled(true);
   if (this->parentLink)
     this->parentLink->SetEnabled(true);
 
-  dJointAddSliderForce(this->jointId, _force);
+  dJointAddSliderForce(this->jointId, _effort);
 }
 
 //////////////////////////////////////////////////

gazebo/physics/ode/ODESliderJoint.hh

       public: virtual void SetVelocity(int _index, double _angle);
 
       // Documentation inherited
-      public: virtual void SetForce(int _index, double _force);
+      public: virtual void SetForce(int _index, double _effort);
 
       // Documentation inherited
       public: virtual void SetMaxForce(int _index, double _t);

gazebo/physics/ode/ODEUniversalJoint.cc

 }
 
 //////////////////////////////////////////////////
-void ODEUniversalJoint::SetForce(int _index, double _torque)
+void ODEUniversalJoint::SetForce(int _index, double _effort)
 {
   if (_index < 0 || static_cast<unsigned int>(_index) >= this->GetAngleCount())
   {
     return;
   }
 
+  // truncating SetForce effort if velocity limit reached.
+  if (this->velocityLimit[_index] >= 0)
+  {
+    if (this->GetVelocity(_index) > this->velocityLimit[_index])
+      _effort = _effort > 0 ? 0 : _effort;
+    else if (this->GetVelocity(_index) < -this->velocityLimit[_index])
+      _effort = _effort < 0 ? 0 : _effort;
+  }
+
   // truncate effort if effortLimit is not negative
   if (this->effortLimit[_index] >= 0.0)
-    _torque = math::clamp(_torque, -this->effortLimit[_index],
+    _effort = math::clamp(_effort, -this->effortLimit[_index],
       this->effortLimit[_index]);
 
-  ODEJoint::SetForce(_index, _torque);
+  ODEJoint::SetForce(_index, _effort);
   if (this->childLink) this->childLink->SetEnabled(true);
   if (this->parentLink) this->parentLink->SetEnabled(true);
 
   if (_index == 0)
-    dJointAddUniversalTorques(this->jointId, _torque, 0);
+    dJointAddUniversalTorques(this->jointId, _effort, 0);
   else
-    dJointAddUniversalTorques(this->jointId, 0, _torque);
+    dJointAddUniversalTorques(this->jointId, 0, _effort);
 }
 
 //////////////////////////////////////////////////

gazebo/physics/ode/ODEUniversalJoint.hh

       public: virtual void SetVelocity(int _index, double _angle);
 
       // Documentation inherited
-      public: virtual void SetForce(int _index, double _torque);
+      public: virtual void SetForce(int _index, double _effort);
 
       // Documentation inherited
       public: virtual void SetMaxForce(int _index, double _t);

gazebo/rendering/Heightmap.cc

 Heightmap::Heightmap(ScenePtr _scene)
 {
   this->scene = _scene;
+  this->terrainGlobals = NULL;
 }
 
 //////////////////////////////////////////////////
 //////////////////////////////////////////////////
 void Heightmap::Load()
 {
+  if (this->terrainGlobals != NULL)
+    return;
+
   this->terrainGlobals = new Ogre::TerrainGlobalOptions();
 
   if (this->heightImage.GetWidth() != this->heightImage.GetHeight() ||

gazebo/rendering/Scene.cc

       {
         try
         {
-          this->terrain = new Heightmap(shared_from_this());
-          this->terrain->LoadFromMsg(_msg);
+          if (!this->terrain)
+          {
+            this->terrain = new Heightmap(shared_from_this());
+            this->terrain->LoadFromMsg(_msg);
+          }
+          else
+            gzerr << "Only one Heightmap can be created per Scene\n";
         } catch(...)
         {
           return false;

gazebo/rendering/Visual.cc

   }
   catch(Ogre::Exception &e)
   {
-    gzerr << "Unable to insert mesh[" << e.getDescription() << std::endl;
+    gzerr << "Unable to insert mesh[" << e.getDescription() << "]" << std::endl;
   }
 }
 

gazebo/sdf/interface/parser_urdf.cc

     visualsIt = _link->visual_groups.begin();
     visualsIt != _link->visual_groups.end(); ++visualsIt)
   {
-    /// @todo: extend to different groups,
-    /// only work with default meshes right now.
-    if (visualsIt->first == "default")
-    {
-      std::string lumpGroupName = std::string("lump::")+_link->name;
-      // gzdbg << "adding modified lump group name [" << lumpGroupName
-      //       << "] to link [" << _link->getParent()->name << "]\n.";
-      for (std::vector<UrdfVisualPtr>::iterator
-        visualIt = visualsIt->second->begin();
-        visualIt != visualsIt->second->end(); ++visualIt)
-      {
-        // transform visual origin from _link frame to
-        // parent link frame before adding to parent
-        (*visualIt)->origin = this->TransformToParentFrame((*visualIt)->origin,
-          _link->parent_joint->parent_to_joint_origin_transform);
-        // add the modified visual to parent
-        this->ReduceVisualToParent(_link->getParent(), lumpGroupName,
-          *visualIt);
-      }
-    }
-    else if (visualsIt->first.find(std::string("lump::")) == 0)
+    if (visualsIt->first.find(std::string("lump::")) == 0)
     {
       // it's a previously lumped mesh, re-lump under same _groupName
       std::string lumpGroupName = visualsIt->first;
           *visualIt);
       }
     }
+    else
+    {
+      // default and any other groups meshes
+      std::string lumpGroupName = std::string("lump::")+_link->name;
+      // gzdbg << "adding modified lump group name [" << lumpGroupName
+      //       << "] to link [" << _link->getParent()->name << "]\n.";
+      for (std::vector<UrdfVisualPtr>::iterator
+        visualIt = visualsIt->second->begin();
+        visualIt != visualsIt->second->end(); ++visualIt)
+      {
+        // transform visual origin from _link frame to
+        // parent link frame before adding to parent
+        (*visualIt)->origin = this->TransformToParentFrame((*visualIt)->origin,
+          _link->parent_joint->parent_to_joint_origin_transform);
+        // add the modified visual to parent
+        this->ReduceVisualToParent(_link->getParent(), lumpGroupName,
+          *visualIt);
+      }
+    }
   }
 }
 
       collisionsIt = _link->collision_groups.begin();
       collisionsIt != _link->collision_groups.end(); ++collisionsIt)
     {
-      if (collisionsIt->first == "default")
-      {
-        // if it's a "default" mesh, it will be added under "lump::"+_link name
-        std::string lumpGroupName = std::string("lump::")+_link->name;
-        // gzdbg << "lumping collision [" << collisionsIt->first
-        //       << "] for link [" << _link->name
-        //       << "] to parent [" << _link->getParent()->name
-        //       << "] with group name [" << lumpGroupName << "]\n";
-        for (std::vector<UrdfCollisionPtr>::iterator
-          collisionIt = collisionsIt->second->begin();
-          collisionIt != collisionsIt->second->end(); ++collisionIt)
-        {
-          // transform collision origin from _link frame to
-          // parent link frame before adding to parent
-          (*collisionIt)->origin = this->TransformToParentFrame(
-            (*collisionIt)->origin,
-            _link->parent_joint->parent_to_joint_origin_transform);
-
-          // add the modified collision to parent
-          this->ReduceCollisionToParent(_link->getParent(), lumpGroupName,
-            *collisionIt);
-        }
-      }
-      else if (collisionsIt->first.find(std::string("lump::")) == 0)
+      if (collisionsIt->first.find(std::string("lump::")) == 0)
       {
         // if it's a previously lumped mesh, relump under same _groupName
         std::string lumpGroupName = collisionsIt->first;
             *collisionIt);
         }
       }
+      else
+      {
+        // default and any other group meshes
+        std::string lumpGroupName = std::string("lump::")+_link->name;
+        // gzdbg << "lumping collision [" << collisionsIt->first
+        //       << "] for link [" << _link->name
+        //       << "] to parent [" << _link->getParent()->name
+        //       << "] with group name [" << lumpGroupName << "]\n";
+        for (std::vector<UrdfCollisionPtr>::iterator
+          collisionIt = collisionsIt->second->begin();
+          collisionIt != collisionsIt->second->end(); ++collisionIt)
+        {
+          // transform collision origin from _link frame to
+          // parent link frame before adding to parent
+          (*collisionIt)->origin = this->TransformToParentFrame(
+            (*collisionIt)->origin,
+            _link->parent_joint->parent_to_joint_origin_transform);
+
+          // add the modified collision to parent
+          this->ReduceCollisionToParent(_link->getParent(), lumpGroupName,
+            *collisionIt);
+        }
+      }
     }
     // this->PrintCollisionGroups(_link->getParent());
 }

gazebo/sensors/ContactSensor.hh

       /// Subsequently, World::Update invokes ContactManager::PublishContacts
       /// to publish all contacts generated within a timestep onto
       /// Gazebo topic ~/physics/contacts.
-      /// 
+      ///
       /// Each ContactSensor subscribes to the Gazebo ~/physics/contacts topic,
       /// retrieves all contact pairs in a time step and filters them wthin
       /// ContactSensor::OnContacts against <collision> body name
       /// All collision pairs between ContactSensor <collision> body and
       /// other bodies in the world are stored in an array inside
       /// contacts.proto.
-      /// 
+      ///
       /// Within each element of the contact.proto array inside contacts.proto,
       /// list of collisions between collision bodies
       /// (collision1 and collision 2) are stored in an array of

test/ServerFixture.hh

                  ASSERT_NO_THROW(this->server->LoadFile(_worldFilename));
                ASSERT_NO_THROW(this->server->Init());
 
-               rendering::create_scene(
-                   gazebo::physics::get_world()->GetName(), false);
+               if (!rendering::get_scene(
+                     gazebo::physics::get_world()->GetName()))
+               {
+                 rendering::create_scene(
+                     gazebo::physics::get_world()->GetName(), false);
+               }
 
                this->SetPause(_paused);
 

test/regression/CMakeLists.txt

   link_directories ( ${BULLET_LIBRARY_DIRS} )
 endif()
 
-include_directories(${PROJECT_SOURCE_DIR}/test/gtest/include)
-
-set (gtest_sources
+set(tests
   bandwidth.cc
-  camera_sensor.cc
   factory.cc
   file_handling.cc
-  heightmap.cc
   laser.cc
   msgs.cc
   physics.cc
   pioneer2dx.cc
+  transport.cc
+  server_fixture.cc
+  speed.cc
+  )
+
+set (GZ_BUILD_TESTS_EXTRA_EXE_SRCS
+    "${PROJECT_SOURCE_DIR}/gazebo/Server.cc;${PROJECT_SOURCE_DIR}/gazebo/Master.cc;${PROJECT_SOURCE_DIR}/gazebo/gazebo.cc")
+gz_build_tests(${tests})
+
+set(display_tests
+)
+
+# Build the display tests (need extra sources to compile)
+set (GZ_BUILD_TESTS_EXTRA_EXE_SRCS
+    "${PROJECT_SOURCE_DIR}/gazebo/Server.cc;${PROJECT_SOURCE_DIR}/gazebo/Master.cc;${PROJECT_SOURCE_DIR}/gazebo/gazebo.cc")
+gz_build_display_tests(${display_tests})
+
+set(dri_tests
+  camera_sensor.cc
+  heightmap.cc
   pr2.cc
   projector.cc
-  server_fixture.cc
-  speed.cc
   speed_pr2.cc
-  transport.cc)
+)
 
-set (plugins)
-
-# Build plugins
-foreach (src ${plugins})
-  add_library(${src} SHARED ${src}.cc)
-  target_link_libraries(${src} libgazebo gazebo_sensors)
-endforeach (src ${plugins})
-
-# Build tests
-foreach(GTEST_SOURCE_file ${gtest_sources})
-  string(REGEX REPLACE ".cc" "" BINARY_NAME ${GTEST_SOURCE_file})
-  add_executable(${BINARY_NAME} ${GTEST_SOURCE_file} ${PROJECT_SOURCE_DIR}/gazebo/Server.cc ${PROJECT_SOURCE_DIR}/gazebo/Master.cc ${PROJECT_SOURCE_DIR}/gazebo/gazebo.cc)
-
-target_link_libraries(${BINARY_NAME}
-  ${GTEST_LIBRARY}
-  ${GTEST_MAIN_LIBRARY}
-    gazebo_common
-    gazebo_sdf_interface
-    gazebo_transport
-    gazebo_physics
-    gazebo_sensors
-    gazebo_rendering
-    gazebo_msgs
-    pthread
-    ${tinyxml_libraries}
-    )
-  add_test(${BINARY_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME} --gtest_output=xml:${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
-  set_tests_properties(${BINARY_NAME} PROPERTIES TIMEOUT 240)
-  # Check that the test produced a result and create a failure if it didn't.
-  # Guards against crashed and timed out tests.
-  add_test(check_${BINARY_NAME} ${PROJECT_SOURCE_DIR}/tools/check_test_ran.py ${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
-endforeach()
+set (GZ_BUILD_TESTS_EXTRA_EXE_SRCS
+    "${PROJECT_SOURCE_DIR}/gazebo/Server.cc;${PROJECT_SOURCE_DIR}/gazebo/Master.cc;${PROJECT_SOURCE_DIR}/gazebo/gazebo.cc")
+gz_build_dri_tests(${dri_tests})

test/regression/heightmap.cc

 {
 };
 
-std::string heightmapModel =
-"<sdf version='1.3'>"
-"<model name='heightmap'>"
-"      <static>true</static>"
-"      <link name='link'>"
-"        <collision name='collision'>"
-"          <geometry>"
-"            <heightmap>"
-"              <uri>file://media/materials/textures/heightmap_bowl.png</uri>"
-"              <size>129 129 10</size>"
-"              <pos>0 0 0</pos>"
-"            </heightmap>"
-"          </geometry>"
-"        </collision>"
-"        <visual name='visual'>"
-"          <geometry>"
-"            <heightmap>"
-"              <texture>"
-"                <diffuse>file://media/materials/textures/"
-"dirt_diffusespecular.png</diffuse>"
-"                <normal>file://media/materials/textures/"
-"flat_normal.png</normal>"
-"                <size>50</size>"
-"              </texture>"
-"              <texture>"
-"                <diffuse>file://media/materials/textures/"
-"grass_diffusespecular.png</diffuse>"
-"                <normal>file://media/materials/textures/"
-"flat_normal.png</normal>"
-"                <size>20</size>"
-"              </texture>"
-"              <texture>"
-"                <diffuse>file://media/materials/textures/"
-"fungus_diffusespecular.png</diffuse>"
-"                <normal>file://media/materials/textures/"
-"flat_normal.png</normal>"
-"                <size>80</size>"
-"              </texture>"
-"              <blend>"
-"                <min_height>2</min_height>"
-"                <fade_dist>5</fade_dist>"
-"              </blend>"
-"              <blend>"
-"                <min_height>4</min_height>"
-"                <fade_dist>5</fade_dist>"
-"              </blend>"
-"              <uri>file://media/materials/textures/heightmap_bowl.png</uri>"
-"              <size>129 129 10</size>"
-"              <pos>0 0 0</pos>"
-"            </heightmap>"
-"          </geometry>"
-"        </visual>"
-"      </link>"
-"    </model>"
-"</sdf>";
-
 /////////////////////////////////////////////////
 TEST_F(HeightmapTest, Heights)
 {
-  Load("worlds/empty.world");
+  Load("worlds/heightmap_test.world");
 
   // Make sure the render engine is available.
   if (rendering::RenderEngine::Instance()->GetRenderPathType() ==
   // Make sure we can get a valid pointer to the scene.
   rendering::ScenePtr scene = GetScene();
 
-  // Spawn the heightmap.
-  SpawnSDF(heightmapModel);
+  rendering::Heightmap *heightmap = NULL;
 
   // Wait for the heightmap to get loaded by the scene.
   {
     int i = 0;
-    while (i < 20 && scene->GetHeightmap() == NULL)
+    while (i < 20 && (heightmap = scene->GetHeightmap()) == NULL)
     {
       // Make sure to PreRender so that the Scene can process its messages
       scene->PreRender();
+
       common::Time::MSleep(100);
       i++;
     }
   physics::ModelPtr model = GetModel("heightmap");
   EXPECT_TRUE(model);
 
-
   physics::CollisionPtr collision =
     model->GetLink("link")->GetCollision("collision");
 
 
       // The render test requires a point relative to the center of the
       // heightmap.
-      renderTest.push_back(scene->GetHeightmap()->GetHeight(xd, yd));
+      renderTest.push_back(heightmap->GetHeight(xd, yd));
 
       // Debug output
       if (fabs(physicsTest.back() - renderTest.back()) >= 0.13)

test/worlds/heightmap_test.world

+<?xml version="1.0" ?>
+<sdf version="1.3">
+  <world name="default">
+    <include><uri>model://camera</uri></include>
+
+    <model name="heightmap">
+      <static>true</static>
+      <link name="link">
+        <collision name="collision">
+          <geometry>
+            <heightmap>
+              <uri>file://media/materials/textures/heightmap_bowl.png</uri>
+              <size>129 129 10</size>
+              <pos>0 0 0</pos>
+            </heightmap>
+          </geometry>
+        </collision>
+
+        <visual name="visual">
+          <geometry>
+            <heightmap>
+              <texture>
+                <diffuse>file://media/materials/textures/dirt_diffusespecular.png</diffuse>
+                <normal>file://media/materials/textures/flat_normal.png</normal>
+                <size>50</size>
+              </texture>
+              <texture>
+                <diffuse>file://media/materials/textures/grass_diffusespecular.png</diffuse>
+                <normal>file://media/materials/textures/flat_normal.png</normal>
+                <size>20</size>
+              </texture>
+              <texture>
+                <diffuse>file://media/materials/textures/fungus_diffusespecular.png</diffuse>
+                <normal>file://media/materials/textures/flat_normal.png</normal>
+                <size>80</size>
+              </texture>
+              <blend>
+                <min_height>2</min_height>
+                <fade_dist>5</fade_dist>
+              </blend>
+              <blend>
+                <min_height>4</min_height>
+                <fade_dist>5</fade_dist>
+              </blend>
+              <uri>file://media/materials/textures/heightmap_bowl.png</uri>
+              <size>129 129 10</size>
+              <pos>0 0 0</pos>
+            </heightmap>
+          </geometry>
+        </visual>
+      </link>
+    </model>
+  </world>
+</sdf>
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.