diff --git a/CMakeLists.txt b/CMakeLists.txt index e9601a8c0c..f675d6f336 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) set (GAZEBO_MAJOR_VERSION 11) -set (GAZEBO_MINOR_VERSION 5) +set (GAZEBO_MINOR_VERSION 7) # The patch version may have been bumped for prerelease purposes; be sure to # check gazebo-release/ubuntu/debian/changelog@default to determine what the # next patch version should be for a regular release. diff --git a/Changelog.md b/Changelog.md index 1469a2974e..c736a1cdb3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,59 @@ ## Gazebo 11 +## Gazebo 11.7.0 (2021-06-xx) + +1. Qualify `gazebo::util` in `using namespace` declarations. + * [Pull request #2979](https://github.com/osrf/gazebo/pull/2979) + +1. Distortion camera initialization fix + * [Issue #2527](https://github.com/osrf/gazebo/issues/2527) + * [Pull request #3033](https://github.com/osrf/gazebo/pull/3033) + +1. Use CURL::libcurl instead of cmake variables + * [Pull request #3030](https://github.com/osrf/gazebo/pull/3030) + +1. Allow specifying lens flare and camera distortion texture format + * [Issue #3005](https://github.com/osrf/gazebo/issues/3005) + * [Pull request #3009](https://github.com/osrf/gazebo/pull/3009) + +1. Camera distortion normalization improvement and fix folding + * [Pull request #3009](https://github.com/osrf/gazebo/pull/3009) + +1. Fix Windows compilation in Server.cc (not -> !) + * [Pull request #3021](https://github.com/osrf/gazebo/pull/3021) + +## Gazebo 11.6.0 (2021-06-09) + +1. Enable output of gzerr for SDF sibling elements of any type with same name, + following the SDF 1.7 specification. + Environment variable GAZEBO11_BACKWARDS_COMPAT_WARNINGS_ERRORS can be set to + use the previous behaviour and do not report these problems. + * [Pull request #3017](https://github.com/osrf/gazebo/pull/3017) + +1. Allow specifying lens flare and camera distortion texture format + * [Issue #3005](https://github.com/osrf/gazebo/issues/3005) + * [Pull request #3007](https://github.com/osrf/gazebo/pull/3007) + +1. Initialize the worldPoseDirty flag in Collision.cc + * A contribution from Zachary Michaels zmichaels11@gmail.com> + * [Pull request #2999](https://github.com/osrf/gazebo/pull/2999) + +1. Compile test plugins as MODULE instead of STATIC + * [Pull request #2897](https://github.com/osrf/gazebo/pull/2897) + +1. Add warning if GAZEBO_RESOURCE_PATH may not be set correctly + * [Pull request #2991](https://github.com/osrf/gazebo/pull/2991) + +## Gazebo 11.5.1 (2021-05-05) + +1. Avoid range-loop-construct in TopicManager + * [Pull request #2983](https://github.com/osrf/gazebo/pull/2983) + +1. Check for nullptr in TopicManager::ConnectPubToSub + * A contribution from Emerson Knapp (Amazon) + * [Pull request #2978](https://github.com/osrf/gazebo/pull/2978) + * [Issue #2875](https://github.com/osrf/gazebo/issues/2875) + ## Gazebo 11.5.0 (2021-04-20) 1. Specify wide angle camera cube map texture format @@ -15,12 +69,22 @@ 1. Optimize collision checking in ODE * [Pull request #2945](https://github.com/osrf/gazebo/pull/2945) +1. Fix size of spotlight visual + * [Pull request #2947](https://github.com/osrf/gazebo/pull/2947) + +1. Fix depth camera breaking shadows + * [Pull request #2907](https://github.com/osrf/gazebo/pull/2907) + 1. Fix color channel of point clouds from DepthCamera * [Pull request #2853](https://github.com/osrf/gazebo/pull/2853) 1. GpuRaySensor: validate scene existence * [Pull request #2937](https://github.com/osrf/gazebo/pull/2937) +1. LensFlare: allow inheritance + * [Pull request #2965](https://github.com/osrf/gazebo/pull/2965) + * [Pull request #2975](https://github.com/osrf/gazebo/pull/2975) + 1. Silence message conversion warning messages * [Pull request #2963](https://github.com/osrf/gazebo/pull/2963) * [Pull request #2973](https://github.com/osrf/gazebo/pull/2973) diff --git a/README.md b/README.md index 640cbd34ca..884a6c0d85 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Instructions are located at Gazebo cmake parameters available at configuring time: - - BUILD_TESTING (boot) [default False] + - BUILD_TESTING (bool) [default False] Include the test suite compilation in the default make call (make all). - ENABLE_DIAGNOSTICS If this is defined, it will enable diagnostic timers using the macros @@ -26,7 +26,7 @@ Gazebo cmake parameters available at configuring time: Check the building machine for supported compiler optimizations and use them to build the software. - USE_UPSTREAM_CFLAGS (bool) [default True] - Use the recommend gazebo developers compiler optimizations flags. + Use the recommended gazebo developers compiler optimizations flags. - USE_EXTERNAL_TINYXML (bool) [default True] Use external copy of tinyxml during the build. - USE_EXTERNAL_TINYXML2 (bool) [default True] diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 97007fec5c..a6f3cc02bf 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -92,15 +92,17 @@ endif () # Find packages find_package(CURL) -if (CURL_FOUND) - # FindCURL.cmake distributed with CMake exports - # the CURL_INCLUDE_DIRS variable, while the pkg_check_modules - # function exports the CURL_INCLUDEDIR variable. - # TODO: once the configure.bat VS2013 based script has been removed, - # remove the call pkg_check_modules(CURL libcurl) and all the uses of - # CURL_LIBDIR and CURL_INCLUDEDIR and use directly the variables - # CURL_INCLUDE_DIRS and CURL_LIBRARIES provided by FindCURL.cmake - set(CURL_INCLUDEDIR ${CURL_INCLUDE_DIRS}) +if (CURL_FOUND AND NOT TARGET CURL::libcurl AND CURL_LIBRARY) + # Make a target on Bionic because FindCURL.cmake only sets old-style CMake variables + add_library(CURL::libcurl SHARED IMPORTED) + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LOCATION "${CURL_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${CURL_LIBRARIES}") + if (WIN32) + set_target_properties(CURL::libcurl PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB") + endif() endif () # In Visual Studio we use configure.bat to trick all path cmake @@ -110,13 +112,6 @@ if (MSVC) endif() if (PKG_CONFIG_FOUND) - if (NOT CURL_FOUND) - pkg_check_modules(CURL libcurl) - endif () - if (NOT CURL_FOUND) - BUILD_ERROR ("Missing: libcurl. Required for connection to model database.") - endif() - pkg_check_modules(PROFILER libprofiler) if (PROFILER_FOUND) set (CMAKE_LINK_FLAGS_PROFILE "-Wl,--no-as-needed -lprofiler -Wl,--as-needed ${CMAKE_LINK_FLAGS_PROFILE}" CACHE INTERNAL "Link flags for profile") diff --git a/gazebo/CMakeLists.txt b/gazebo/CMakeLists.txt index 7ed1ea81c3..9ad9d02a7a 100644 --- a/gazebo/CMakeLists.txt +++ b/gazebo/CMakeLists.txt @@ -16,7 +16,6 @@ link_directories( ${SDFormat_LIBRARY_DIRS} ${PROJECT_BINARY_DIR}/test ${TBB_LIBRARY_DIR} - ${CURL_LIBDIR} ${IGNITION-MSGS_LIBRARY_DIRS} ) diff --git a/gazebo/Server.cc b/gazebo/Server.cc index cc27739712..5b4fe9c4f6 100644 --- a/gazebo/Server.cc +++ b/gazebo/Server.cc @@ -30,9 +30,11 @@ #include #include +#include #include #include +#include #include #include #include @@ -77,6 +79,26 @@ namespace gazebo { struct ServerPrivate { + void InspectSDFElement(const sdf::ElementPtr _elem) + { + if (common::getEnv("GAZEBO11_BACKWARDS_COMPAT_WARNINGS_ERRORS")) + return; + + // SDF 1.7 and above consider invalid sibling elements of ANY type with + // repeated names while SDF 1.6 and lower only elements of the SAME type + auto sdfVersion = + ignition::math::SemanticVersion(_elem->OriginalVersion()); + bool result; + if (sdfVersion >= ignition::math::SemanticVersion(1, 7)) + result = sdf::recursiveSiblingUniqueNames(_elem); + else + result = sdf::recursiveSameTypeUniqueNames(_elem); + + if (!result) + gzerr << "SDF is not valid, see errors above. " + << "This can lead to an unexpected behaviour." << "\n"; + } + /// \brief Boolean used to stop the server. static bool stop; @@ -358,7 +380,13 @@ bool Server::ParseArgs(int _argc, char **_argv) { gzwarn << "Falling back on worlds/empty.world\n"; if (!this->LoadFile("worlds/empty.world", physics)) + { + gzerr << "worlds/empty.world could not be opened, " + << "probably because it was not found. " + << "Your GAZEBO_RESOURCE_PATH is probably improperly set. " + << "Have you sourced /share/gazebo/setup.sh?\n"; return false; + } } if (this->dataPtr->vm.count("profile")) @@ -490,6 +518,8 @@ bool Server::PreLoad() bool Server::LoadImpl(sdf::ElementPtr _elem, const std::string &_physics) { + this->dataPtr->InspectSDFElement(_elem); + // If a physics engine is specified, if (_physics.length()) { diff --git a/gazebo/common/CMakeLists.txt b/gazebo/common/CMakeLists.txt index 6e32435d61..13ce89f4a4 100644 --- a/gazebo/common/CMakeLists.txt +++ b/gazebo/common/CMakeLists.txt @@ -17,14 +17,6 @@ if (HAVE_GDAL) include_directories(${GDAL_INCLUDE_DIR}) endif() -if (CURL_FOUND) - include_directories(${CURL_INCLUDEDIR}) - link_directories(${CURL_LIBDIR}) - if (WIN32) - add_definitions(-DCURL_STATICLIB) - endif() -endif() - include_directories(${tinyxml_INCLUDE_DIRS}) link_directories(${tinyxml_LIBRARY_DIRS}) @@ -237,7 +229,6 @@ target_compile_definitions(gazebo_common target_link_libraries(gazebo_common PUBLIC ${Boost_LIBRARIES} - ${CURL_LIBRARIES} ${freeimage_LIBRARIES} ignition-common3::graphics ${IGNITION-FUEL_TOOLS_LIBRARIES} @@ -248,6 +239,7 @@ target_link_libraries(gazebo_common ${SDFormat_LIBRARIES} ${tinyxml_LIBRARIES} PRIVATE + CURL::libcurl ${libtool_library} ${libavcodec_LIBRARIES} ${libavformat_LIBRARIES} diff --git a/gazebo/gui/model/JointInspector_TEST.cc b/gazebo/gui/model/JointInspector_TEST.cc index 129820b4c2..5310dfa681 100644 --- a/gazebo/gui/model/JointInspector_TEST.cc +++ b/gazebo/gui/model/JointInspector_TEST.cc @@ -169,7 +169,7 @@ void JointInspector_TEST::Swap() // Get swap button QList toolButtons = jointInspector->findChildren(); - QVERIFY(toolButtons.size() == 2); + QCOMPARE(toolButtons.size(), 2); // Trigger swap toolButtons[1]->click(); @@ -201,7 +201,7 @@ void JointInspector_TEST::RemoveButton() // Get buttons QList toolButtons = jointInspector->findChildren(); - QVERIFY(toolButtons.size() == 2); + QCOMPARE(toolButtons.size(), 2); QVERIFY(toolButtons[0]->text() == ""); // Trigger remove @@ -242,22 +242,22 @@ void JointInspector_TEST::AppliedSignal() // Get spins QList spins = jointInspector->findChildren(); - QVERIFY(spins.size() == 34); + QCOMPARE(spins.size(), 34); // Get combo boxes QList combos = jointInspector->findChildren(); - QVERIFY(combos.size() == 5); + QCOMPARE(combos.size(), 5); // Get line edits QList lineEdits = jointInspector->findChildren(); - QVERIFY(lineEdits.size() == 41); + QCOMPARE(lineEdits.size(), 43); // Get push buttons QList pushButtons = jointInspector->findChildren(); - QVERIFY(pushButtons.size() == 3); + QCOMPARE(pushButtons.size(), 3); // Edit link (1~2) combos[combos.size()-1]->setCurrentIndex(1); diff --git a/gazebo/physics/Collision.cc b/gazebo/physics/Collision.cc index 88e00274e0..93cc24cf1a 100644 --- a/gazebo/physics/Collision.cc +++ b/gazebo/physics/Collision.cc @@ -57,7 +57,7 @@ static SDFCollisionInitializer g_SDFInit; ////////////////////////////////////////////////// Collision::Collision(LinkPtr _link) -: Entity(_link), maxContacts(1) +: Entity(_link), maxContacts(1), worldPoseDirty(true) { this->AddType(Base::COLLISION); diff --git a/gazebo/rendering/Camera.cc b/gazebo/rendering/Camera.cc index 29f98f083d..d0d1cbb219 100644 --- a/gazebo/rendering/Camera.cc +++ b/gazebo/rendering/Camera.cc @@ -1628,7 +1628,10 @@ void Camera::SetRenderTarget(Ogre::RenderTarget *_target) } if (this->dataPtr->distortion) + { this->dataPtr->distortion->SetCamera(shared_from_this()); + this->renderTarget->update(); + } if (this->GetScene()->GetSkyX() != NULL) this->renderTarget->addListener(this->GetScene()->GetSkyX()); diff --git a/gazebo/rendering/Distortion.cc b/gazebo/rendering/Distortion.cc index 370ed285eb..e3aa23da1d 100644 --- a/gazebo/rendering/Distortion.cc +++ b/gazebo/rendering/Distortion.cc @@ -50,6 +50,9 @@ namespace gazebo /// \brief Lens center used for distortion public: ignition::math::Vector2d lensCenter = {0.5, 0.5}; + /// \brief Compositor name to be used for distortion + public: std::string compositorName = "CameraDistortionMap/Default"; + /// \brief Scale applied to distorted image. public: ignition::math::Vector2d distortionScale = {1.0, 1.0}; @@ -57,6 +60,14 @@ namespace gazebo /// black pixels at the corners of the image. public: bool distortionCrop = true; + /// \brief Use the legacy distortion mode. If this is set to false, the + /// new mode modifies how Brown's distortion equations are applied to + /// better reflect real distortion. The image is projected from image + /// plane to camera plane to apply distortion equations, then projected + /// back to image plane. Note that the new distortion doesn't allow + /// the image to be cropped. + public: bool legacyMode = true; + /// \brief Lens distortion compositor public: Ogre::CompositorInstance *lensDistortionInstance; @@ -113,6 +124,22 @@ void Distortion::Load(sdf::ElementPtr _sdf) this->dataPtr->lensCenter = _sdf->Get("center"); this->dataPtr->distortionCrop = this->dataPtr->k1 < 0; + + const std::string compositorName = "ignition:compositor"; + if (_sdf->HasElement(compositorName)) + { + this->dataPtr->compositorName = _sdf->Get(compositorName); + } + const std::string legacyMode = "ignition:legacy_mode"; + if (_sdf->HasElement(legacyMode)) + { + this->dataPtr->legacyMode = _sdf->Get(legacyMode); + } + if (!this->dataPtr->legacyMode && this->dataPtr->distortionCrop) + { + gzwarn << "Enable legacy mode to use distortion cropping" << std::endl; + this->dataPtr->distortionCrop = false; + } } ////////////////////////////////////////////////// @@ -151,12 +178,16 @@ void Distortion::SetCamera(CameraPtr _camera) // seems to work best with a square distortion map texture unsigned int texSide = _camera->ImageHeight() > _camera->ImageWidth() ? _camera->ImageHeight() : _camera->ImageWidth(); + // calculate focal length from largest fov + const double fov = _camera->ImageHeight() > _camera->ImageWidth() ? + _camera->VFOV().Radian() : _camera->HFOV().Radian(); + const double focalLength = texSide/(2*tan(fov/2)); this->dataPtr->distortionTexWidth = texSide - 1; this->dataPtr->distortionTexHeight = texSide - 1; unsigned int imageSize = this->dataPtr->distortionTexWidth * this->dataPtr->distortionTexHeight; - double incrU = 1.0 / this->dataPtr->distortionTexWidth; - double incrV = 1.0 / this->dataPtr->distortionTexHeight; + double colStepSize = 1.0 / this->dataPtr->distortionTexWidth; + double rowStepSize = 1.0 / this->dataPtr->distortionTexHeight; // initialize distortion map this->dataPtr->distortionMap.resize(imageSize); @@ -165,30 +196,96 @@ void Distortion::SetCamera(CameraPtr _camera) this->dataPtr->distortionMap[i] = -1; } + ignition::math::Vector2d distortionCenterCoordinates( + this->dataPtr->lensCenter.X() * this->dataPtr->distortionTexWidth, + this->dataPtr->lensCenter.Y() * this->dataPtr->distortionTexWidth); + + // declare variables before the loop + const auto unsetPixelVector = ignition::math::Vector2d(-1, -1); + ignition::math::Vector2d normalizedLocation, + distortedLocation, + newDistortedCoordinates, + currDistortedCoordinates; + unsigned int distortedIdx, + distortedCol, + distortedRow; + double normalizedColLocation, normalizedRowLocation; + // fill the distortion map - for (unsigned int i = 0; i < this->dataPtr->distortionTexHeight; ++i) + for (unsigned int mapRow = 0; mapRow < this->dataPtr->distortionTexHeight; + ++mapRow) { - double v = i*incrV; - for (unsigned int j = 0; j < this->dataPtr->distortionTexWidth; ++j) + normalizedRowLocation = mapRow*rowStepSize; + for (unsigned int mapCol = 0; mapCol < this->dataPtr->distortionTexWidth; + ++mapCol) { - double u = j*incrU; - ignition::math::Vector2d uv(u, v); - ignition::math::Vector2d out = - this->Distort(uv, this->dataPtr->lensCenter, + normalizedColLocation = mapCol*colStepSize; + + normalizedLocation[0] = normalizedColLocation; + normalizedLocation[1] = normalizedRowLocation; + + if (this->dataPtr->legacyMode) + { + distortedLocation = this->Distort( + normalizedLocation, + this->dataPtr->lensCenter, this->dataPtr->k1, this->dataPtr->k2, this->dataPtr->k3, this->dataPtr->p1, this->dataPtr->p2); + } + else + { + distortedLocation = this->Distort( + normalizedLocation, + this->dataPtr->lensCenter, + this->dataPtr->k1, this->dataPtr->k2, this->dataPtr->k3, + this->dataPtr->p1, this->dataPtr->p2, + this->dataPtr->distortionTexWidth, + focalLength); + } // compute the index in the distortion map - unsigned int idxU = out.X() * this->dataPtr->distortionTexWidth; - unsigned int idxV = out.Y() * this->dataPtr->distortionTexHeight; - - if (idxU < this->dataPtr->distortionTexWidth && - idxV < this->dataPtr->distortionTexHeight) + distortedCol = distortedLocation.X() * this->dataPtr->distortionTexWidth; + distortedRow = distortedLocation.Y() * + this->dataPtr->distortionTexHeight; + + // Note that the following makes sure that, for significant distortions, + // there is not a problem where the distorted image seems to fold over + // itself. This is accomplished by favoring pixels closer to the center + // of distortion, and this change applies to both the legacy and + // nonlegacy distortion modes. + + // Make sure the distorted pixel is within the texture dimensions + if (distortedCol < this->dataPtr->distortionTexWidth && + distortedRow < this->dataPtr->distortionTexHeight) { - unsigned int mapIdx = idxV * this->dataPtr->distortionTexWidth + idxU; - this->dataPtr->distortionMap[mapIdx] = uv; + distortedIdx = distortedRow * this->dataPtr->distortionTexWidth + + distortedCol; + + // check if the index has already been set + if (this->dataPtr->distortionMap[distortedIdx] != unsetPixelVector) + { + // grab current coordinates that map to this destination + currDistortedCoordinates = + this->dataPtr->distortionMap[distortedIdx] * + this->dataPtr->distortionTexWidth; + + // grab new coordinates to map to + newDistortedCoordinates[0] = mapCol; + newDistortedCoordinates[1] = mapRow; + + // use the new mapping if it is closer to the center of the distortion + if (newDistortedCoordinates.Distance(distortionCenterCoordinates) < + currDistortedCoordinates.Distance(distortionCenterCoordinates)) + { + this->dataPtr->distortionMap[distortedIdx] = normalizedLocation; + } + } + else + { + this->dataPtr->distortionMap[distortedIdx] = normalizedLocation; + } } - // else: pixel maps outside the image bounds. + // else: mapping is outside of the image bounds. // This is expected and normal to ensure // no black borders; carry on } @@ -330,7 +427,7 @@ void Distortion::SetCamera(CameraPtr _camera) this->dataPtr->lensDistortionInstance = Ogre::CompositorManager::getSingleton().addCompositor( - _camera->OgreViewport(), "CameraDistortionMap/Default"); + _camera->OgreViewport(), this->dataPtr->compositorName); this->dataPtr->lensDistortionInstance->getTechnique()->getOutputTargetPass()-> getPass(0)->setMaterial(this->dataPtr->distortionMaterial); @@ -386,11 +483,20 @@ ignition::math::Vector2d Distortion::Distort( const ignition::math::Vector2d &_in, const ignition::math::Vector2d &_center, double _k1, double _k2, double _k3, double _p1, double _p2) +{ + return Distort(_in, _center, _k1, _k2, _k3, _p1, _p2, 1u, 1.0); +} + +////////////////////////////////////////////////// +ignition::math::Vector2d Distortion::Distort( + const ignition::math::Vector2d &_in, + const ignition::math::Vector2d &_center, double _k1, double _k2, double _k3, + double _p1, double _p2, unsigned int _width, double _f) { // apply Brown's distortion model, see // http://en.wikipedia.org/wiki/Distortion_%28optics%29#Software_correction - ignition::math::Vector2d normalized2d = _in - _center; + ignition::math::Vector2d normalized2d = (_in - _center)*(_width/_f); ignition::math::Vector3d normalized(normalized2d.X(), normalized2d.Y(), 0); double rSq = normalized.X() * normalized.X() + normalized.Y() * normalized.Y(); @@ -407,14 +513,15 @@ ignition::math::Vector2d Distortion::Distort( dist.Y() += _p1 * (rSq + 2 * (normalized.Y()*normalized.Y())) + 2 * _p2 * normalized.X() * normalized.Y(); - return _center + ignition::math::Vector2d(dist.X(), dist.Y()); + return ((_center*_width) + + ignition::math::Vector2d(dist.X(), dist.Y())*_f)/_width; } ////////////////////////////////////////////////// void Distortion::SetCrop(const bool _crop) { // Only update the distortion scale if the crop value is going to flip. - if (this->dataPtr->distortionCrop != _crop) + if (this->dataPtr->distortionCrop != _crop && this->dataPtr->legacyMode) { this->dataPtr->distortionCrop = _crop; this->CalculateAndApplyDistortionScale(); diff --git a/gazebo/rendering/Distortion.hh b/gazebo/rendering/Distortion.hh index 786fbbd15e..c172f3df31 100644 --- a/gazebo/rendering/Distortion.hh +++ b/gazebo/rendering/Distortion.hh @@ -54,7 +54,8 @@ namespace gazebo public: void SetCamera(CameraPtr _camera); /// \brief Set whether to crop the black border around the distorted - /// image points. + /// image points. Note that cropping only occurs for the legacy mode + /// distortion implementation. /// \param[in] _crop True to crop the black border /// \sa Crop public: void SetCrop(const bool _crop); @@ -104,6 +105,24 @@ namespace gazebo double _k1, double _k2, double _k3, double _p1, double _p2); + /// \brief Apply distortion model using camera coordinates projection + /// \param[in] _in Input uv coordinate. + /// \param[in] _center Normalized distortion center. + /// \param[in] _k1 Radial distortion coefficient k1. + /// \param[in] _k2 Radial distortion coefficient k2. + /// \param[in] _k3 Radial distortion coefficient k3. + /// \param[in] _p1 Tangential distortion coefficient p1. + /// \param[in] _p2 Tangential distortion coefficient p2. + /// \param[in] _width Width of the image texture in pixels. + /// \param[in] _f Focal length in pixels. + /// \return Distorted coordinate. + public: static ignition::math::Vector2d Distort( + const ignition::math::Vector2d &_in, + const ignition::math::Vector2d &_center, + double _k1, double _k2, double _k3, + double _p1, double _p2, + unsigned int _width, double _f); + /// \brief get the distortion map value. /// \return the distortion map value at the specified index, /// or (-1, -1) if the index diff --git a/gazebo/rendering/LensFlare.cc b/gazebo/rendering/LensFlare.cc index b312b01750..e5440a3495 100644 --- a/gazebo/rendering/LensFlare.cc +++ b/gazebo/rendering/LensFlare.cc @@ -349,6 +349,16 @@ namespace gazebo public: std::shared_ptr lensFlareCompositorListener; + /// \brief Scale of lens flare. + public: double lensFlareScale = 1.0; + + /// \brief Color of lens flare. + public: ignition::math::Vector3d lensFlareColor + = ignition::math::Vector3d(1.0, 1.0, 1.0); + + /// \brief Compositor name to be used for lens flare + public: std::string compositorName = "CameraLensFlare/Default"; + /// \brief Pointer to camera public: CameraPtr camera; @@ -369,13 +379,6 @@ namespace gazebo /// \brief Connection for the pre render event. public: event::ConnectionPtr preRenderConnection; - - /// \brief Scale of lens flare. - public: double lensFlareScale = 1.0; - - /// \brief Color of lens flare. - public: ignition::math::Vector3d lensFlareColor - = ignition::math::Vector3d(1.0, 1.0, 1.0); }; } } @@ -423,7 +426,7 @@ void LensFlare::SetCamera(CameraPtr _camera) this->dataPtr->lensFlareInstance = Ogre::CompositorManager::getSingleton().addCompositor( - this->dataPtr->camera->OgreViewport(), "CameraLensFlare/Default"); + this->dataPtr->camera->OgreViewport(), this->dataPtr->compositorName); this->dataPtr->lensFlareInstance->getTechnique()->getOutputTargetPass()-> getPass(0)->setMaterial(lensFlareMaterial); @@ -460,6 +463,12 @@ void LensFlare::SetColor(const ignition::math::Vector3d &_color) } } +////////////////////////////////////////////////// +void LensFlare::SetCompositorName(const std::string &_name) +{ + this->dataPtr->compositorName = _name; +} + ////////////////////////////////////////////////// void LensFlare::Update() { diff --git a/gazebo/rendering/LensFlare.hh b/gazebo/rendering/LensFlare.hh index a119ecb473..058e0a2da0 100644 --- a/gazebo/rendering/LensFlare.hh +++ b/gazebo/rendering/LensFlare.hh @@ -123,6 +123,11 @@ namespace gazebo /// \param[in] _color Color of lens flare public: void SetColor(const ignition::math::Vector3d &_color); + /// \brief Set the name of the lens flare compositor to use the next + /// time SetCamera is called. + /// \param[in] _name Name of the compositor to use + public: void SetCompositorName(const std::string &_name); + /// \brief Update function to search light source protected: void Update(); diff --git a/gazebo/rendering/RTShaderSystem.cc b/gazebo/rendering/RTShaderSystem.cc index 14d1f340f2..4a655f513c 100644 --- a/gazebo/rendering/RTShaderSystem.cc +++ b/gazebo/rendering/RTShaderSystem.cc @@ -477,7 +477,9 @@ bool RTShaderSystem::GetPaths(std::string &coreLibsPath, std::string &cachePath) // Core shader lib not found -> shader generating will fail. if (coreLibsPath.empty()) { - gzerr << "Unable to find shader lib. Shader generating will fail."; + gzerr << "Unable to find shader lib. Shader generating will fail. " + << "Your GAZEBO_RESOURCE_PATH is probably improperly set. " + << "Have you sourced /share/gazebo/setup.sh?\n"; return false; } @@ -778,6 +780,10 @@ void RTShaderSystem::UpdateShadows(ScenePtr _scene) glBindTexture(GL_TEXTURE_2D, texId); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + GL_LINEAR); } #endif diff --git a/gazebo/test/ServerFixture.cc b/gazebo/test/ServerFixture.cc index d86efdb502..ba1d7f0213 100644 --- a/gazebo/test/ServerFixture.cc +++ b/gazebo/test/ServerFixture.cc @@ -578,7 +578,9 @@ void ServerFixture::SpawnCamera(const std::string &_modelName, const std::string &_noiseType, double _noiseMean, double _noiseStdDev, bool _distortion, double _distortionK1, double _distortionK2, double _distortionK3, double _distortionP1, double _distortionP2, - double _cx, double _cy) + double _cx, double _cy, + bool _legacyMode, + double _horizontalFov) { msgs::Factory msg; std::ostringstream newModelStr; @@ -594,7 +596,7 @@ void ServerFixture::SpawnCamera(const std::string &_modelName, << " " << _rate << "" << " true" << " " - << " 0.78539816339744828" + << " " << _horizontalFov << "" << " " << " " << _width << "" << " " << _height << "" @@ -623,6 +625,9 @@ void ServerFixture::SpawnCamera(const std::string &_modelName, << " " << _distortionP1 << "" << " " << _distortionP2 << "" << "
" << _cx << " " << _cy << "
" + << " " + << (_legacyMode ? "true" : "false") + << "" << " "; } diff --git a/gazebo/test/ServerFixture.hh b/gazebo/test/ServerFixture.hh index 00d9542424..475707123a 100644 --- a/gazebo/test/ServerFixture.hh +++ b/gazebo/test/ServerFixture.hh @@ -254,6 +254,8 @@ namespace gazebo /// \param[in] _distortionP2 Distortion coefficient p2. /// \param[in] _cx Normalized optical center x, used for distortion. /// \param[in] _cy Normalized optical center y, used for distortion. + /// \param[in] _legacyMode Use the legacy distortion model. + /// \param[in] _horizontalFov The horizontal field of view. protected: void SpawnCamera(const std::string &_modelName, const std::string &_cameraName, const ignition::math::Vector3d &_pos = @@ -267,7 +269,9 @@ namespace gazebo bool _distortion = false, double _distortionK1 = 0.0, double _distortionK2 = 0.0, double _distortionK3 = 0.0, double _distortionP1 = 0.0, double _distortionP2 = 0.0, - double _cx = 0.5, double _cy = 0.5); + double _cx = 0.5, double _cy = 0.5, + bool _legacyMode = true, + double _horizontalFov = 0.78539816339744828); /// \brief Spawn a wide angle camera. /// \param[in] _modelName Name of the model. diff --git a/gazebo/transport/TopicManager.cc b/gazebo/transport/TopicManager.cc index 0184dd8325..14fa782fa4 100644 --- a/gazebo/transport/TopicManager.cc +++ b/gazebo/transport/TopicManager.cc @@ -271,7 +271,9 @@ void TopicManager::ConnectPubToSub(const std::string &_topic, const SubscriptionTransportPtr _sublink) { PublicationPtr publication = this->FindPublication(_topic); - publication->AddSubscription(_sublink); + if (publication) { + publication->AddSubscription(_sublink); + } } ////////////////////////////////////////////////// @@ -279,7 +281,9 @@ void TopicManager::DisconnectPubFromSub(const std::string &topic, const std::string &host, unsigned int port) { PublicationPtr publication = this->FindPublication(topic); - publication->RemoveSubscription(host, port); + if (publication) { + publication->RemoveSubscription(host, port); + } } ////////////////////////////////////////////////// diff --git a/gazebo/transport/TopicManager.hh b/gazebo/transport/TopicManager.hh index 7e790da506..7714e5daf7 100644 --- a/gazebo/transport/TopicManager.hh +++ b/gazebo/transport/TopicManager.hh @@ -128,7 +128,7 @@ namespace gazebo { if (iter2.first == _topic) { - for (const auto liter : iter2.second) + for (const auto &liter : iter2.second) { publication->AddSubscription(liter); } diff --git a/gazebo/util/Diagnostics.cc b/gazebo/util/Diagnostics.cc index 5432b247f4..1b3b4dc054 100644 --- a/gazebo/util/Diagnostics.cc +++ b/gazebo/util/Diagnostics.cc @@ -26,7 +26,7 @@ #include "gazebo/util/Diagnostics.hh" using namespace gazebo; -using namespace util; +using namespace gazebo::util; ////////////////////////////////////////////////// DiagnosticManager::DiagnosticManager() diff --git a/gazebo/util/IntrospectionClient.cc b/gazebo/util/IntrospectionClient.cc index 01239b762c..4998760cf1 100644 --- a/gazebo/util/IntrospectionClient.cc +++ b/gazebo/util/IntrospectionClient.cc @@ -30,7 +30,7 @@ #include "gazebo/util/IntrospectionClientPrivate.hh" using namespace gazebo; -using namespace util; +using namespace gazebo::util; ////////////////////////////////////////////////// IntrospectionClient::IntrospectionClient() diff --git a/gazebo/util/IntrospectionManager.cc b/gazebo/util/IntrospectionManager.cc index e19439570b..048e605317 100644 --- a/gazebo/util/IntrospectionManager.cc +++ b/gazebo/util/IntrospectionManager.cc @@ -30,7 +30,7 @@ #include "gazebo/util/IntrospectionManagerPrivate.hh" using namespace gazebo; -using namespace util; +using namespace gazebo::util; ////////////////////////////////////////////////// IntrospectionManager::IntrospectionManager() diff --git a/gazebo/util/LogPlay.cc b/gazebo/util/LogPlay.cc index 9fbde6462a..e0b80b381f 100644 --- a/gazebo/util/LogPlay.cc +++ b/gazebo/util/LogPlay.cc @@ -46,7 +46,7 @@ #include "gazebo/util/LogPlay.hh" using namespace gazebo; -using namespace util; +using namespace gazebo::util; ///////////////////////////////////////////////// LogPlay::LogPlay() diff --git a/gazebo/util/LogRecord.cc b/gazebo/util/LogRecord.cc index 027b96a313..e1e2543ffc 100644 --- a/gazebo/util/LogRecord.cc +++ b/gazebo/util/LogRecord.cc @@ -56,7 +56,7 @@ #include "gazebo/util/LogRecord.hh" using namespace gazebo; -using namespace util; +using namespace gazebo::util; ////////////////////////////////////////////////// LogRecord::LogRecord() diff --git a/gazebo/util/OpenAL.cc b/gazebo/util/OpenAL.cc index 04864a73de..faeb2adf32 100644 --- a/gazebo/util/OpenAL.cc +++ b/gazebo/util/OpenAL.cc @@ -42,7 +42,7 @@ #include "gazebo/util/OpenAL.hh" using namespace gazebo; -using namespace util; +using namespace gazebo::util; #ifdef HAVE_OPENAL ///////////////////////////////////////////////// diff --git a/media/materials/programs/spotlight_shadow_demo_fp.glsl b/media/materials/programs/spotlight_shadow_demo_fp.glsl index 1508127845..0a9948e517 100644 --- a/media/materials/programs/spotlight_shadow_demo_fp.glsl +++ b/media/materials/programs/spotlight_shadow_demo_fp.glsl @@ -1,13 +1,13 @@ -#version 120 +#version 130 -uniform sampler2D shadowMap0; +uniform sampler2DShadow shadowMap0; varying vec4 lightSpacePos0; varying vec4 worldPos; varying vec4 worldViewPos; //------------------------------------------------------------------------------ -float ShadowSimple(in sampler2D shadowMap, in vec4 shadowMapPos) +float ShadowSimple(in sampler2DShadow shadowMap, in vec4 shadowMapPos) { // perform perspective divide vec3 shadowMapUV = shadowMapPos.xyz / shadowMapPos.w; @@ -16,7 +16,7 @@ float ShadowSimple(in sampler2D shadowMap, in vec4 shadowMapPos) return 0.0; // get closest depth value from light's perspective - float closestDepth = texture2D(shadowMap, shadowMapUV.xy).r; + float closestDepth = texture(shadowMap, shadowMapUV); // get depth of current fragment from light's perspective float currentDepth = shadowMapUV.z; diff --git a/media/materials/scripts/distortion.compositor b/media/materials/scripts/distortion.compositor index e0bc7dd1a8..28eaffb3d6 100644 --- a/media/materials/scripts/distortion.compositor +++ b/media/materials/scripts/distortion.compositor @@ -4,7 +4,7 @@ compositor CameraDistortionMap/Default { // Temporary textures texture rt0 target_width target_height PF_A8R8G8B8 - + target rt0 { // Render output from previous compositor (or original scene) @@ -24,3 +24,30 @@ compositor CameraDistortionMap/Default } } } + +compositor CameraDistortionMap/PF_FLOAT32_R +{ + technique + { + // Temporary textures + texture rt0 target_width target_height PF_FLOAT32_R + + target rt0 + { + // Render output from previous compositor (or original scene) + input previous + } + target_output + { + // Start with clear output + input none + // Draw a fullscreen quad with noise + pass render_quad + { + // Renders a fullscreen quad with a material + material Gazebo/CameraDistortionMap + input 0 rt0 + } + } + } +} \ No newline at end of file diff --git a/media/materials/scripts/lens_flare.compositor b/media/materials/scripts/lens_flare.compositor index 47b03b9b70..ae15804f70 100644 --- a/media/materials/scripts/lens_flare.compositor +++ b/media/materials/scripts/lens_flare.compositor @@ -24,3 +24,30 @@ compositor CameraLensFlare/Default } } } + +compositor CameraLensFlare/PF_FLOAT32_R +{ + technique + { + // Temporary textures + texture rt0 target_width target_height PF_FLOAT32_R + + target rt0 + { + // Render output from previous compositor (or original scene) + input previous + } + target_output + { + // Start with clear output + input none + // Draw a fullscreen quad + pass render_quad + { + // Renders a fullscreen quad with a material + material Gazebo/CameraLensFlare + input 0 rt0 + } + } + } +} \ No newline at end of file diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index dd426626f9..4392f86e3c 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -28,7 +28,6 @@ if(WIN32 AND NOT UNIX) endif() include_directories(SYSTEM - ${CURL_INCLUDEDIR} ${PROJECT_SOURCE_DIR} ${PROTOBUF_INCLUDE_DIR} ${SDFormat_INCLUDE_DIRS} @@ -53,15 +52,11 @@ include_directories(SYSTEM # failures in clang. link_directories( ${CMAKE_CURRENT_BINARY_DIR} - ${CURL_LIBDIR} ${CCD_LIBRARY_DIRS} ${SDFormat_LIBRARY_DIRS} ${tinyxml_LIBRARY_DIRS} ) -if (WIN32) - add_definitions(-DCURL_STATICLIB) -endif() add_definitions(${Qt5Core_DEFINITIONS}) set (CMAKE_AUTOMOC ON) @@ -197,6 +192,8 @@ target_include_directories(SimpleTrackedVehiclePlugin SYSTEM PRIVATE target_link_libraries(SimpleTrackedVehiclePlugin TrackedVehiclePlugin) add_dependencies(SimpleTrackedVehiclePlugin TrackedVehiclePlugin) +target_link_libraries(StaticMapPlugin CURL::libcurl) + target_link_libraries(WheelTrackedVehiclePlugin TrackedVehiclePlugin) add_dependencies(WheelTrackedVehiclePlugin TrackedVehiclePlugin) diff --git a/plugins/LensFlareSensorPlugin.cc b/plugins/LensFlareSensorPlugin.cc index 96a166917b..93db560415 100644 --- a/plugins/LensFlareSensorPlugin.cc +++ b/plugins/LensFlareSensorPlugin.cc @@ -39,6 +39,9 @@ namespace gazebo /// \brief Lens flare color public: ignition::math::Vector3d color = ignition::math::Vector3d(1.4, 1.2, 1.0); + + /// \brief Lens flare compositor name + public: std::string compositorName; }; } @@ -84,6 +87,12 @@ void LensFlareSensorPlugin::Load(sensors::SensorPtr _sensor, this->dataPtr->color = _sdf->Get("color"); } + const std::string compositorName = "compositor"; + if (_sdf->HasElement(compositorName)) + { + this->dataPtr->compositorName = _sdf->Get(compositorName); + } + sensors::CameraSensorPtr cameraSensor = std::dynamic_pointer_cast(_sensor); @@ -140,6 +149,10 @@ void LensFlareSensorPlugin::AddLensFlare(rendering::CameraPtr _camera) rendering::LensFlarePtr lensFlare; lensFlare.reset(new rendering::LensFlare); + if (!this->dataPtr->compositorName.empty()) + { + lensFlare->SetCompositorName(this->dataPtr->compositorName); + } lensFlare->SetCamera(_camera); lensFlare->SetScale(this->dataPtr->scale); lensFlare->SetColor(this->dataPtr->color); diff --git a/plugins/LensFlareSensorPlugin.hh b/plugins/LensFlareSensorPlugin.hh index 9ff0e876b1..54aa04b587 100644 --- a/plugins/LensFlareSensorPlugin.hh +++ b/plugins/LensFlareSensorPlugin.hh @@ -28,6 +28,7 @@ namespace gazebo /// \brief Plugin that adds lens flare effect to a camera or multicamera /// sensor /// The plugin has the following optional parameter: + /// Name of the lens flare compositor to use. /// Scale of lens flare. Must be greater than 0 /// Color of lens flare. /// \todo A potentially useful feature would be an option for constantly diff --git a/plugins/rest_web/CMakeLists.txt b/plugins/rest_web/CMakeLists.txt index 6f8df8af8d..d7eb70cbf4 100644 --- a/plugins/rest_web/CMakeLists.txt +++ b/plugins/rest_web/CMakeLists.txt @@ -41,7 +41,10 @@ include_directories( ) add_library(RestWebPlugin SHARED ${server_src} ) -target_link_libraries(RestWebPlugin ${GAZEBO_libraries} gazebo_msgs) +target_link_libraries(RestWebPlugin + CURL::libcurl + ${GAZEBO_libraries} + gazebo_msgs) install (TARGETS RestWebPlugin LIBRARY DESTINATION ${GAZEBO_PLUGIN_LIB_INSTALL_DIR} ARCHIVE DESTINATION ${GAZEBO_PLUGIN_LIB_INSTALL_DIR} diff --git a/plugins/rest_web/RestUiLoginDialog.cc b/plugins/rest_web/RestUiLoginDialog.cc index d2ab6269e5..82f50fe351 100644 --- a/plugins/rest_web/RestUiLoginDialog.cc +++ b/plugins/rest_web/RestUiLoginDialog.cc @@ -16,7 +16,6 @@ */ #include -#include #include "RestUiLoginDialog.hh" #include "RestUiWidget.hh" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 975bed1bf1..3e9a896ac2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -24,12 +24,21 @@ endif() configure_file (test_config.h.in ${PROJECT_BINARY_DIR}/test_config.h) # Build gtest -add_library(gtest STATIC gtest/src/gtest-all.cc) -add_library(gtest_main STATIC gtest/src/gtest_main.cc) -target_link_libraries(gtest_main gtest) -set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a") -set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a") +if (WIN32) + # Windows will fail to link the non-static libraries between gtest_main and + # gtest unless .lib is created. It is easier to keep things static unless + # other reasons appear. + add_library(gtest STATIC gtest/src/gtest-all.cc) + add_library(gtest_main STATIC gtest/src/gtest_main.cc) +else() + # No static on UNIX to avoid problems on ARM platforms linking + # with no fPIC + add_library(gtest gtest/src/gtest-all.cc) + add_library(gtest_main gtest/src/gtest_main.cc) + target_link_libraries(gtest pthread) +endif() +target_link_libraries(gtest_main gtest) execute_process(COMMAND cmake -E remove_directory ${CMAKE_BINARY_DIR}/test_results) execute_process(COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test_results) include_directories(${GTEST_INCLUDE_DIRS}) diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index 45a52d80ba..6806306f01 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -95,6 +95,7 @@ set(tests rest_web.cc saving_and_loading.cc sdf.cc + sdf_errors.cc sensor.cc sdf_frame_semantics.cc server_fixture.cc @@ -164,6 +165,9 @@ endif() # Add plugin dependency add_dependencies(${TEST_TYPE}_joint_control_plugin JointControlPlugin) add_dependencies(${TEST_TYPE}_joint_test SpringTestPlugin) +add_dependencies(${TEST_TYPE}_plugin ExceptionModelPluginConstructor) +add_dependencies(${TEST_TYPE}_plugin ExceptionModelPluginInit) +add_dependencies(${TEST_TYPE}_plugin ExceptionModelPluginLoad) add_dependencies(${TEST_TYPE}_plugin_interface PluginInterfaceTest) add_dependencies(${TEST_TYPE}_tracked_vehicles SimpleTrackedVehiclePlugin) add_dependencies(${TEST_TYPE}_tracked_vehicles WheelTrackedVehiclePlugin) diff --git a/test/integration/camera_sensor.cc b/test/integration/camera_sensor.cc index b3965f572f..452cc2f227 100644 --- a/test/integration/camera_sensor.cc +++ b/test/integration/camera_sensor.cc @@ -1929,3 +1929,309 @@ TEST_F(CameraSensor, Light) } EXPECT_EQ(newColor, sun->DiffuseColor()); } + +///////////////////////////////////////////////// +TEST_F(CameraSensor, SetCompositorNames) +{ +#if not defined(__APPLE__) + Load("worlds/test/issue_3005_set_compositor_names.world"); + + // Make sure the render engine is available. + if (rendering::RenderEngine::Instance()->GetRenderPathType() == + rendering::RenderEngine::NONE) + { + gzerr << "No rendering engine, unable to run camera test\n"; + return; + } + + const unsigned int width = 12; + const unsigned int height = 12; + + for (auto camera_name : { + "camera_distortion_default", "camera_lens_flare_default"}) + { + // check camera with default texture format + sensors::SensorPtr sensor = sensors::get_sensor(camera_name); + sensors::CameraSensorPtr cameraSensor = + std::dynamic_pointer_cast(sensor); + + imageCount = 0; + img = new unsigned char[width * height * 3]; + event::ConnectionPtr c = + cameraSensor->Camera()->ConnectNewImageFrame( + std::bind(&::OnNewCameraFrame, &imageCount, img, + std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, + std::placeholders::_4, std::placeholders::_5)); + + // Get some images + int sleep = 0; + int maxSleep = 30; + while (imageCount < 10 && sleep < maxSleep) + { + common::Time::MSleep(50); + sleep++; + } + + unsigned int rSum = 0; + unsigned int gSum = 0; + unsigned int bSum = 0; + for (unsigned int i = 0; i < height*width*3; i+=3) + { + unsigned int r = img[i]; + unsigned int g = img[i+1]; + unsigned int b = img[i+2]; + rSum += r; + gSum += g; + bSum += b; + } + + EXPECT_NE(rSum, gSum); + EXPECT_NE(rSum, bSum); + EXPECT_NE(gSum, bSum); + + EXPECT_GT(rSum - bSum, 25000.0); + EXPECT_GT(rSum - gSum, 20000.0); + + delete [] img; + } + + for (auto camera_name : {"camera_distortion_test", "camera_lens_flare_test"}) + { + // check camera with grayscale texture format + sensors::SensorPtr sensor = sensors::get_sensor(camera_name); + sensors::CameraSensorPtr cameraSensor = + std::dynamic_pointer_cast(sensor); + + imageCount = 0; + img = new unsigned char[width * height * 3]; + event::ConnectionPtr c = + cameraSensor->Camera()->ConnectNewImageFrame( + std::bind(&::OnNewCameraFrame, &imageCount, img, + std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, + std::placeholders::_4, std::placeholders::_5)); + + // Get some images + int sleep = 0; + int maxSleep = 30; + while (imageCount < 10 && sleep < maxSleep) + { + common::Time::MSleep(50); + sleep++; + } + + unsigned int rSum = 0; + unsigned int gSum = 0; + unsigned int bSum = 0; + for (unsigned int i = 0; i < height*width*3; i+=3) + { + unsigned int r = img[i]; + unsigned int g = img[i+1]; + unsigned int b = img[i+2]; + rSum += r; + gSum += g; + bSum += b; + } + + // For grayscale, all RGB channels should have the same value + EXPECT_EQ(rSum, gSum); + EXPECT_EQ(gSum, bSum); + EXPECT_GT(gSum, 10000u); + + delete [] img; + } +#endif +} + +///////////////////////////////////////////////// +TEST_F(CameraSensor, CheckNewAndLegacyDistortionModes) +{ + Load("worlds/test/issue_3003_distortion_implementation_correction.world"); + + // Make sure the render engine is available. + if (rendering::RenderEngine::Instance()->GetRenderPathType() == + rendering::RenderEngine::NONE) + { + gzerr << "No rendering engine, unable to run camera test\n"; + return; + } + + // Spawn cameras. + const std::string modelNameBarrelLegacy = "camera_model_barrel_legacy"; + const std::string cameraNameBarrelLegacy = "camera_sensor_barrel_legacy"; + const std::string modelNameBarrelNew = "camera_model_barrel_new"; + const std::string cameraNameBarrelNew = "camera_sensor_barrel_new"; + + const std::string modelNamePincushionLegacy = + "camera_model_pincushion_legacy"; + const std::string cameraNamePincushionLegacy = + "camera_sensor_pincushion_legacy"; + const std::string modelNamePincushionNew = "camera_model_pincushion_new"; + const std::string cameraNamePincushionNew = "camera_sensor_pincushion_new"; + const unsigned int width = 160; + const unsigned int height = 120; + const double updateRate = 10; + const ignition::math::Pose3d setPose( + ignition::math::Vector3d(0.5, 0, 0), + ignition::math::Quaterniond(0, 0, 0)); + const double horizontalFov = 1.6; + + // spawn a camera with pincushion distortion + SpawnCamera(modelNamePincushionLegacy, cameraNamePincushionLegacy, + setPose.Pos(), setPose.Rot().Euler(), width, height, updateRate, + "", 0, 0, true, 0.5, 0, 0, 0, 0, 0.5, 0.5, + true, horizontalFov); + SpawnCamera(modelNamePincushionNew, cameraNamePincushionNew, + setPose.Pos(), setPose.Rot().Euler(), width, height, updateRate, + "", 0, 0, true, 0.5, 0, 0, 0, 0, 0.5, 0.5, + false, horizontalFov); + // spawn a camera with barrel distortion + SpawnCamera(modelNameBarrelLegacy, cameraNameBarrelLegacy, setPose.Pos(), + setPose.Rot().Euler(), width, height, updateRate, + "", 0, 0, true, -0.5, 0, 0, 0, 0, 0.5, 0.5, + true, horizontalFov); + SpawnCamera(modelNameBarrelNew, cameraNameBarrelNew, setPose.Pos(), + setPose.Rot().Euler(), width, height, updateRate, + "", 0, 0, true, -0.5, 0, 0, 0, 0, 0.5, 0.5, + false, horizontalFov); + + sensors::SensorPtr sensorPincushionLegacy = + sensors::get_sensor(cameraNamePincushionLegacy); + sensors::CameraSensorPtr camSensorPincushionLegacy = + std::dynamic_pointer_cast(sensorPincushionLegacy); + sensors::SensorPtr sensorPincushionNew = + sensors::get_sensor(cameraNamePincushionNew); + sensors::CameraSensorPtr camSensorPincushionNew = + std::dynamic_pointer_cast(sensorPincushionNew); + + sensors::SensorPtr sensorBarrelLegacy = + sensors::get_sensor(cameraNameBarrelLegacy); + sensors::CameraSensorPtr camSensorBarrelLegacy = + std::dynamic_pointer_cast(sensorBarrelLegacy); + sensors::SensorPtr sensorBarrelNew = + sensors::get_sensor(cameraNameBarrelNew); + sensors::CameraSensorPtr camSensorBarrelNew = + std::dynamic_pointer_cast(sensorBarrelNew); + + imageCount = 0; + imageCount2 = 0; + imageCount3 = 0; + imageCount4 = 0; + + img = new unsigned char[width * height*3]; + img2 = new unsigned char[width * height*3]; + img3 = new unsigned char[width * height*3]; + img4 = new unsigned char[width * height*3]; + + event::ConnectionPtr c1 = + camSensorPincushionLegacy->Camera()->ConnectNewImageFrame( + std::bind(&::OnNewCameraFrame, &imageCount, img, + std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, + std::placeholders::_4, std::placeholders::_5)); + event::ConnectionPtr c2 = + camSensorPincushionNew->Camera()->ConnectNewImageFrame( + std::bind(&::OnNewCameraFrame, &imageCount2, img2, + std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, + std::placeholders::_4, std::placeholders::_5)); + event::ConnectionPtr c3 = + camSensorBarrelLegacy->Camera()->ConnectNewImageFrame( + std::bind(&::OnNewCameraFrame, &imageCount3, img3, + std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, + std::placeholders::_4, std::placeholders::_5)); + event::ConnectionPtr c4 = + camSensorBarrelNew->Camera()->ConnectNewImageFrame( + std::bind(&::OnNewCameraFrame, &imageCount4, img4, + std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, + std::placeholders::_4, std::placeholders::_5)); + + // Get some images + while ( + imageCount < 10 || imageCount2 < 10 || + imageCount3 < 10 || imageCount4 < 10) + { + common::Time::MSleep(10); + } + + unsigned int colorSum1 = 0; + unsigned int colorSum2 = 0; + unsigned int colorSum3 = 0; + unsigned int colorSum4 = 0; + const unsigned int middleRow = height / 2; + for (unsigned int x = 0; x < width*3; x+=3) + { + unsigned int r1 = img[(middleRow*width*3) + x]; + unsigned int g1 = img[(middleRow*width*3) + x + 1]; + unsigned int b1 = img[(middleRow*width*3) + x + 2]; + colorSum1 += r1 + g1 + b1; + unsigned int r2 = img2[(middleRow*width*3) + x]; + unsigned int g2 = img2[(middleRow*width*3) + x + 1]; + unsigned int b2 = img2[(middleRow*width*3) + x + 2]; + colorSum2 += r2 + g2 + b2; + unsigned int r3 = img3[(middleRow*width*3) + x]; + unsigned int g3 = img3[(middleRow*width*3) + x + 1]; + unsigned int b3 = img3[(middleRow*width*3) + x + 2]; + colorSum3 += r3 + g3 + b3; + unsigned int r4 = img4[(middleRow*width*3) + x]; + unsigned int g4 = img4[(middleRow*width*3) + x + 1]; + unsigned int b4 = img4[(middleRow*width*3) + x + 2]; + colorSum4 += r4 + g4 + b4; + } + + // Check that the legacy mode distorts the pincushion images less + EXPECT_GT(colorSum1, colorSum2+800); + // Check that there is a good difference in the barrel images + // this difference is largely caused by the edges of the new + // distortion model which appear gray when they have no value + // and gray (192) has a much lower value than white (765) + EXPECT_GT(colorSum3, colorSum4+20000); + + // Check that the corners contain rendered pixels. + // Specifically, the corners in each image should be white and + // have a value of 765=255*3 since the background of the environment + // is white + unsigned int cornerColorSumImg1 = img[0] + img[1] + img[2]; + unsigned int cornerColorSumImg2 = img2[0] + img2[1] + img2[2]; + unsigned int cornerColorSumImg3 = img3[0] + img3[1] + img3[2]; + EXPECT_EQ(cornerColorSumImg1, 765u); + EXPECT_EQ(cornerColorSumImg2, 765u); + EXPECT_EQ(cornerColorSumImg3, 765u); + // Check that this image is not cropped and that the corner pixel + // has the gray value assigned to unrendered pixels + unsigned int cornerColorSumImg4 = img4[0] + img4[1] + img4[2]; + EXPECT_EQ(cornerColorSumImg4, 192u); + + auto getFirstColIdxOfMineCart = [](const unsigned char* img) + { + for (unsigned int x = 0; x < width*3; x+=3) + { + const unsigned int r = img[(middleRow*width*3) + x]; + const unsigned int g = img[(middleRow*width*3) + x + 1]; + const unsigned int b = img[(middleRow*width*3) + x + 2]; + const unsigned int pixelSum = r + g + b; + if (pixelSum != 765u && pixelSum != 192u) { + return x; + } + } + return (width-1) * 3; + }; + + // Check mine cart location meets expectations + const unsigned int mineCartColIdx1 = getFirstColIdxOfMineCart(img); + const unsigned int mineCartColIdx2 = getFirstColIdxOfMineCart(img2); + const unsigned int mineCartColIdx3 = getFirstColIdxOfMineCart(img3); + const unsigned int mineCartColIdx4 = getFirstColIdxOfMineCart(img4); + + // Check that, in the pin cushion case, the mine cart is seen closer to the + // left in the new version. This makes sense as the new distortion mode + // should have more significant distortion than the legacy mode. + EXPECT_GT(mineCartColIdx1, mineCartColIdx2+15); + // Check that, in the barrel case, the mine cart is seen closer to the left + // in the legacy distortion mode than in the new mode. This makes sense + // because the legacy mode crops the image removing the edges where there + // is no image information. + EXPECT_LT(mineCartColIdx3, mineCartColIdx4-25); + + delete[] img; + delete[] img2; + delete[] img3; + delete[] img4; +} diff --git a/test/integration/sdf_errors.cc b/test/integration/sdf_errors.cc new file mode 100644 index 0000000000..c1bce2b223 --- /dev/null +++ b/test/integration/sdf_errors.cc @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2021 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +#include + +#include "gazebo/common/CommonIface.hh" +#include "gazebo/test/ServerFixture.hh" + +using namespace gazebo; + +///////////////////////////////////////////////// +#ifdef _WIN32 +static int setenv(const char *envname, const char *envval, int overwrite) +{ + char *original = getenv(envname); + if (!original || !!overwrite) + { + std::string envstring = std::string(envname) + "=" + envval; + return _putenv(envstring.c_str()); + } + return 0; +} +#endif + +class SDFLogsTest : public ServerFixture +{ + public: void SetUp() + { +#ifndef _WIN32 + const boost::filesystem::path home = common::getEnv("HOME"); +#else + const boost::filesystem::path home = common::getEnv("HOMEPATH"); +#endif + boost::filesystem::path log_path("/.gazebo/server-11345/default.log"); + path = home / log_path; + } + + public: void EXPECT_LOG_STRING(const std::string expected_text) + { + EXPECT_TRUE(log_string_search(expected_text)) << + "The text '" + expected_text + "'" + + " was not found in the log. The test expects it to be there"; + } + + public: void EXPECT_NO_ERR_IN_LOG() + { + EXPECT_NO_LOG_STRING("[Err] "); + } + + public: void EXPECT_NO_LOG_STRING(const std::string no_expected_text) + { + EXPECT_FALSE(log_string_search(no_expected_text)) << + "The text '" + no_expected_text + "'" + + " was found in the log. The test does not expect it be there"; + } + + public: void EXPECT_SDF_ERR_IN_LOG() + { + EXPECT_LOG_STRING("[Err] "); + std::string sdfErrorString = "SDF is not valid"; + EXPECT_LOG_STRING(sdfErrorString); + } + + private: bool log_string_search(const std::string expected_text) + { + // Open the log file, and read back the string + std::ifstream ifs(path.string().c_str(), std::ios::in); + std::string loggedString; + + while (!ifs.eof()) + { + std::string line; + std::getline(ifs, line); + loggedString += line; + } + + return loggedString.find(expected_text) != std::string::npos; + } + + private: boost::filesystem::path path; +}; + +///////////////////////////////////////////////// +TEST_F(SDFLogsTest, EmptyWorldNoErrors) +{ + Load("worlds/empty.world"); + EXPECT_NO_ERR_IN_LOG(); +} + +///////////////////////////////////////////////// +TEST_F(SDFLogsTest, DuplicateSiblingSameType16) +{ + Load("worlds/test_sdf16_err_sibling_same_type.world"); + EXPECT_SDF_ERR_IN_LOG(); +} + +///////////////////////////////////////////////// +TEST_F(SDFLogsTest, DuplicateSiblingSameTypeDisabled16) +{ + setenv("GAZEBO11_BACKWARDS_COMPAT_WARNINGS_ERRORS", "", 1); + Load("worlds/test_sdf16_err_sibling_same_type.world"); + EXPECT_NO_ERR_IN_LOG(); +#ifdef _WIN32 + _putenv("GAZEBO11_BACKWARDS_COMPAT_WARNINGS_ERRORS"); +#else + unsetenv("GAZEBO11_BACKWARDS_COMPAT_WARNINGS_ERRORS"); +#endif +} + +///////////////////////////////////////////////// +TEST_F(SDFLogsTest, DuplicateSiblingDifferentType16) +{ + Load("worlds/test_sdf16_err_sibling_different_type.world"); + // 1.6 SDF does NOT enforce different names for different types + EXPECT_NO_ERR_IN_LOG(); +} + +TEST_F(SDFLogsTest, DuplicateSiblingDifferentType17) +{ + // 1.7+ SDF does enforce different names for different types + Load("worlds/test_sdf17_err_sibling_different_type.world"); + EXPECT_SDF_ERR_IN_LOG(); +} + +///////////////////////////////////////////////// +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/models/camera_barrel/model.config b/test/models/camera_barrel/model.config new file mode 100644 index 0000000000..41ab9e76c6 --- /dev/null +++ b/test/models/camera_barrel/model.config @@ -0,0 +1,16 @@ + + + + Camera with Barrel Distortion + 1.0 + model.sdf + + + Nate Koenig + nate@osrfoundation.org + + + + A simple camera with barrel distortion. + + diff --git a/test/models/camera_barrel/model.sdf b/test/models/camera_barrel/model.sdf new file mode 100644 index 0000000000..23e7c2f2d3 --- /dev/null +++ b/test/models/camera_barrel/model.sdf @@ -0,0 +1,54 @@ + + + + true + + + 0.1 + + 0.000166667 + 0.000166667 + 0.000166667 + + + + + + 0.1 0.1 0.1 + + + + + + + 0.1 0.1 0.1 + + + + + 30 + + 0.927295218 + + 640 + 480 + R8G8B8 + + + 0.1 + 100 + + + -0.5 + 0 + 0 + 0 + 0 +
0.5 0.5
+
+
+ 1 +
+ +
+
diff --git a/test/models/camera_pincushion/model.config b/test/models/camera_pincushion/model.config new file mode 100644 index 0000000000..dc2ecf0620 --- /dev/null +++ b/test/models/camera_pincushion/model.config @@ -0,0 +1,16 @@ + + + + Camera with Pincushion Distortion + 1.0 + model.sdf + + + Nate Koenig + nate@osrfoundation.org + + + + A simple camera with pincushion distortion. + + diff --git a/test/models/camera_pincushion/model.sdf b/test/models/camera_pincushion/model.sdf new file mode 100644 index 0000000000..4cdc5505e2 --- /dev/null +++ b/test/models/camera_pincushion/model.sdf @@ -0,0 +1,54 @@ + + + + true + + + 0.1 + + 0.000166667 + 0.000166667 + 0.000166667 + + + + + + 0.1 0.1 0.1 + + + + + + + 0.1 0.1 0.1 + + + + + 30 + + 0.927295218 + + 640 + 480 + R8G8B8 + + + 0.1 + 100 + + + 0.5 + 0 + 0 + 0 + 0 +
0.5 0.5
+
+
+ 1 +
+ +
+
diff --git a/test/models/cameras_with_distortion/model.config b/test/models/cameras_with_distortion/model.config new file mode 100644 index 0000000000..1e4b9afb8d --- /dev/null +++ b/test/models/cameras_with_distortion/model.config @@ -0,0 +1,16 @@ + + + + Cameras with Barrel and Pincushion Distortion + 1.0 + model.sdf + + + Nate Koenig + nate@osrfoundation.org + + + + A model with two cameras with barrel and pincushion distortion. + + diff --git a/test/models/cameras_with_distortion/model.sdf b/test/models/cameras_with_distortion/model.sdf new file mode 100644 index 0000000000..eb7211fc40 --- /dev/null +++ b/test/models/cameras_with_distortion/model.sdf @@ -0,0 +1,78 @@ + + + + true + + + 0.1 + + 0.000166667 + 0.000166667 + 0.000166667 + + + + + + 0.1 0.1 0.1 + + + + + + + 0.1 0.1 0.1 + + + + + 30 + + 0.927295218 + + 640 + 480 + R8G8B8 + + + 0.1 + 100 + + + -0.5 + 0 + 0 + 0 + 0 +
0.5 0.5
+
+
+ 1 +
+ + 60 + + 0.927295218 + + 640 + 480 + R8G8B8 + + + 0.1 + 100 + + + 0.5 + 0 + 0 + 0 + 0 +
0.5 0.5
+
+
+ 1 +
+ +
+
diff --git a/test/plugins/CMakeLists.txt b/test/plugins/CMakeLists.txt index 0762ea3d68..56070cd736 100644 --- a/test/plugins/CMakeLists.txt +++ b/test/plugins/CMakeLists.txt @@ -31,7 +31,7 @@ set (plugins ) foreach (src ${plugins}) - add_library(${src} STATIC ${src}.cc) + add_library(${src} MODULE ${src}.cc) target_link_libraries(${src} libgazebo ${ogre_libraries}) add_dependencies(tests ${src}) endforeach (src ${plugins}) diff --git a/test/regression/2875_connect_pub_to_sub_crash.cc b/test/regression/2875_connect_pub_to_sub_crash.cc new file mode 100644 index 0000000000..96a73df010 --- /dev/null +++ b/test/regression/2875_connect_pub_to_sub_crash.cc @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +#include "gazebo/test/ServerFixture.hh" + +#include "gazebo/transport/Connection.hh" +#include "gazebo/transport/SubscriptionTransport.hh" +#include "gazebo/transport/TopicManager.hh" + +using namespace gazebo; + +class Issue2875Test : public ServerFixture +{ +}; + +///////////////////////////////////////////////// +TEST_F(Issue2875Test, ConnectPubToSubDoesNotCrashForMissingPublication) +{ + this->Load("worlds/empty.world"); + const std::string topic = "/chatter"; + // Add a topic to the advertised topics list so that the search in FindPublication isn't + // against an empty container. + auto Publisher = transport::TopicManager::Instance()->Advertise("/other", "some_type", 1, 1); + + transport::ConnectionPtr conn(new transport::Connection()); + transport::SubscriptionTransportPtr subLink(new transport::SubscriptionTransport()); + subLink->Init(conn, false); + // Expect that this doesn't die + transport::TopicManager::Instance()->ConnectPubToSub(topic, subLink); + // The topic does not exist - but the above call should not have crashed anyways. + ASSERT_EQ(transport::TopicManager::Instance()->FindPublication(topic), nullptr); +} + +///////////////////////////////////////////////// +// Main +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/regression/CMakeLists.txt b/test/regression/CMakeLists.txt index 3d54d94ab4..b50a0ca1cc 100644 --- a/test/regression/CMakeLists.txt +++ b/test/regression/CMakeLists.txt @@ -44,6 +44,7 @@ set(tests 2430_revolute_joint_SetPosition.cc 2505_revolute_joint_SetAxis.cc 2728_nested_urdf.cc + 2875_connect_pub_to_sub_crash.cc 2896_gazebo_subnamespace.cc 2902_performance_metrics_deadlock.cc ) diff --git a/test/worlds/issue_2527_camera_distortion.world b/test/worlds/issue_2527_camera_distortion.world new file mode 100644 index 0000000000..5cc9790572 --- /dev/null +++ b/test/worlds/issue_2527_camera_distortion.world @@ -0,0 +1,34 @@ + + + + + + model://sun + + + + 1.5 0 0 0 -1.57 0 + model://checkerboard_plane + + + + model://cameras_with_distortion + + + + 0 0.2 0 0 0 0 + model://camera_barrel + + + + 0 -0.2 0 0 0 0 + model://camera_pincushion + + + + + -2 -2 1 0 0.25 0.50 + + + + diff --git a/test/worlds/test_sdf16_err_sibling_different_type.world b/test/worlds/test_sdf16_err_sibling_different_type.world new file mode 100644 index 0000000000..da8182fb94 --- /dev/null +++ b/test/worlds/test_sdf16_err_sibling_different_type.world @@ -0,0 +1,46 @@ + + + + + + + 1 + 0 0 1 0 0 1 + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + + + + diff --git a/test/worlds/test_sdf16_err_sibling_same_type.world b/test/worlds/test_sdf16_err_sibling_same_type.world new file mode 100644 index 0000000000..600a92dce0 --- /dev/null +++ b/test/worlds/test_sdf16_err_sibling_same_type.world @@ -0,0 +1,46 @@ + + + + + + + 1 + 0 0 1 0 0 1 + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + + + + diff --git a/test/worlds/test_sdf17_err_sibling_different_type.world b/test/worlds/test_sdf17_err_sibling_different_type.world new file mode 100644 index 0000000000..1d6a430553 --- /dev/null +++ b/test/worlds/test_sdf17_err_sibling_different_type.world @@ -0,0 +1,46 @@ + + + + + + + 1 + 0 0 1 0 0 1 + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + -2.5 0 0 0 0 0 + + + 5 0.2 2 + + + + + + + + diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 2209d57990..5f2c112105 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -24,14 +24,6 @@ if (HAVE_DART) link_directories(${DART_LIBRARY_DIRS}) endif() -if (CURL_FOUND) - include_directories(${CURL_INCLUDEDIR}) - link_directories(${CURL_LIBDIR}) - if (WIN32) - add_definitions(-DCURL_STATICLIB) - endif() -endif() - if(NOT WIN32) # gz_TEST and gz_log_TEST use fork(), that is not available on Windows set (test_sources diff --git a/worlds/test/issue_3003_distortion_implementation_correction.world b/worlds/test/issue_3003_distortion_implementation_correction.world new file mode 100644 index 0000000000..5c310434ef --- /dev/null +++ b/worlds/test/issue_3003_distortion_implementation_correction.world @@ -0,0 +1,66 @@ + + + + 0 + 0.4 0.4 0.4 1 + 1 1 1 1 + + + 1 + + + + + https://fuel.ignitionrobotics.org/1.0/openrobotics/models/mine cart/4/files/meshes/minecart.dae + + + + 10 + + + + + + + + + + + + + + + + + https://fuel.ignitionrobotics.org/1.0/openrobotics/models/mine cart/4/files/meshes/minecart.dae + + polySurface1278 +
0
+
+
+
+ + 1 1 1 1 + 1 1 1 1 + + + materials/textures/MineCart_Albedo.png + materials/textures/MineCart_Metalness.png + materials/textures/MineCart_Roughness.png + + + + +
+ 0 + 0 + 0 + + 3 1 0 0 -0 0 +
+
+
diff --git a/worlds/test/issue_3005_set_compositor_names.world b/worlds/test/issue_3005_set_compositor_names.world new file mode 100644 index 0000000000..94a1150ab8 --- /dev/null +++ b/worlds/test/issue_3005_set_compositor_names.world @@ -0,0 +1,254 @@ + + + + + 1 + 0 0 0 0 -0 0 + 1 1 1 1 + 0.2 0.2 0.2 1 + -1 0 -0.2 + + 10 + + + 0 + 0 + 0 + + + + 0 + + + + 1 + 0.3 0 0.15 0 0 3.14159265 + + + + + 0.1 0.1 0.1 + + + + + + 1.047 + + 12 + 12 + + + 0.1 + 100 + + + -0.25 + 0 + 0 + 0 + 0 +
0.5 0.5
+
+
+ 1 + 10 +
+ +
+ + + 1 + 0.3 2 0.15 0 0 3.14159265 + + + + + 0.1 0.1 0.1 + + + + + + 1.047 + + 12 + 12 + + + 0.1 + 100 + + + -0.25 + 0 + 0 + 0 + 0 +
0.5 0.5
+ CameraDistortionMap/PF_FLOAT32_R +
+
+ 1 + 10 +
+ +
+ + + 1 + 0.3 4 0.15 0 0 3.14159265 + + + + + 0.1 0.1 0.1 + + + + + + 1.047 + + 12 + 12 + + + 0.1 + 100 + + + 1 + 10 + + + + + + + + 1 + 0.3 6 0.15 0 0 3.14159265 + + + + + 0.1 0.1 0.1 + + + + + + 1.047 + + 12 + 12 + + + 0.1 + 100 + + + 1 + 10 + + CameraLensFlare/PF_FLOAT32_R + + + + + + + 1 + + + + + 10 10 10 + model://construction_cone/meshes/construction_cone.dae + + + 10 + + + + + 10 10 10 + model://construction_cone/meshes/construction_cone.dae + + + + + 0 0 0 0 0 0 + + + 1 + + + + + 10 10 10 + model://construction_cone/meshes/construction_cone.dae + + + 10 + + + + + 10 10 10 + model://construction_cone/meshes/construction_cone.dae + + + + + 0 2 0 0 0 0 + + + 1 + + + + + 10 10 10 + model://construction_cone/meshes/construction_cone.dae + + + 10 + + + + + 10 10 10 + model://construction_cone/meshes/construction_cone.dae + + + + + 0 4 0 0 0 0 + + + 1 + + + + + 10 10 10 + model://construction_cone/meshes/construction_cone.dae + + + 10 + + + + + 10 10 10 + model://construction_cone/meshes/construction_cone.dae + + + + + 0 6 0 0 0 0 + +
+