diff --git a/.github/ci/after_make.sh b/.github/ci/after_make.sh new file mode 100644 index 000000000..89971a370 --- /dev/null +++ b/.github/ci/after_make.sh @@ -0,0 +1,10 @@ +#!/bin/sh -l + +set -x + +make install + +Xvfb :1 -screen 0 1280x1024x24 & +export DISPLAY=:1.0 +export RENDER_ENGINE_VALUES=ogre2 +export MESA_GL_VERSION_OVERRIDE=3.3 diff --git a/.github/ci/packages.apt b/.github/ci/packages.apt new file mode 100644 index 000000000..8464ef631 --- /dev/null +++ b/.github/ci/packages.apt @@ -0,0 +1,13 @@ +freeglut3-dev +libfreeimage-dev +libglew-dev +libignition-cmake2-dev +libignition-common3-dev +libignition-math6-dev +libignition-plugin-dev +libogre-1.9-dev +libogre-2.1-dev +libxi-dev +libxmu-dev +uuid-dev +xvfb diff --git a/.github/workflows/ci-bionic.yml b/.github/workflows/ci-bionic.yml deleted file mode 100644 index 962e19ca9..000000000 --- a/.github/workflows/ci-bionic.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Ubuntu Bionic CI - -on: [push, pull_request] - -jobs: - bionic-ci: - runs-on: ubuntu-latest - name: Ubuntu Bionic CI - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Bionic CI - id: ci - uses: ignition-tooling/ubuntu-bionic-ci-action@master - with: - apt-dependencies: 'libogre-1.9-dev libogre-2.1-dev libglew-dev libfreeimage-dev freeglut3-dev libxmu-dev libxi-dev uuid-dev xvfb libignition-cmake2-dev libignition-math6-dev libignition-plugin-dev libignition-common3-dev' - codecov-token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..5d9be4dd1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: Ubuntu CI + +on: [push] + +jobs: + bionic-ci: + runs-on: ubuntu-latest + name: Ubuntu Bionic CI + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Compile and test + id: ci + uses: ignition-tooling/action-ignition-ci@master + with: + codecov-token: ${{ secrets.CODECOV_TOKEN }} + focal-ci: + runs-on: ubuntu-latest + name: Ubuntu Focal CI + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Compile and test + id: ci + uses: ignition-tooling/action-ignition-ci@focal + with: + codecov-token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Changelog.md b/Changelog.md index 042ad0b6f..c2b90a9d8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -44,6 +44,9 @@ ### Ignition Rendering 3.X.X +1. Update test configuration to use ogre2 + * [Pull request 83](https://github.com/ignitionrobotics/ign-rendering/pull/83) + 1. Ogre2 GPU Ray: Cleanup all resources on destruction * [BitBucket pull request 258](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-rendering/pull-requests/258) @@ -113,6 +116,12 @@ ### Ignition Rendering 2.X.X (20XX-XX-XX) + +### Ignition Rendering 2.4.0 (2020-04-17) + +1. Fix flaky VisualAt test + * [BitBucket pull request 248](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-rendering/pull-requests/248) + 1. Port windows fixes * [BitBucket pull request 253](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-rendering/pull-requests/253) @@ -122,6 +131,8 @@ 1. Backport transparency setting based on diffuse alpha * [BitBucket pull request 247](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-rendering/pull-requests/247) +### Ignition Rendering 2.3.0 (2020-02-19) + 1. Add API to check which engines are loaded * [BitBucket pull request 233](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-rendering/pull-requests/233) diff --git a/README.md b/README.md index 143cebff6..21a656ccd 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Install dependencies: Clone source code - # This checks out the `default` branch. You can append `-b ign-rendering#` (replace # with a number) to checkout a specific version + # This checks out the `master` branch. You can append `-b ign-rendering#` (replace # with a number) to checkout a specific version git clone http://github.com/ignitionrobotics/ign-rendering #### Version 0 (Legacy version for Ubuntu Xenial 16.04 or above) diff --git a/ogre/src/OgreGrid.cc b/ogre/src/OgreGrid.cc index 0ca4b6caa..168ab96ea 100644 --- a/ogre/src/OgreGrid.cc +++ b/ogre/src/OgreGrid.cc @@ -77,7 +77,8 @@ void OgreGrid::Create() this->dataPtr->manualObject->clear(); - double extent = (this->cellLength * static_cast(this->cellCount))/2; + double baseExtent = (this->cellLength * + static_cast(this->cellCount - this->cellCount % 2))/2; this->dataPtr->manualObject->setCastShadows(false); this->dataPtr->manualObject->estimateVertexCount( @@ -91,20 +92,30 @@ void OgreGrid::Create() for (unsigned int h = 0; h <= this->verticalCellCount; ++h) { double hReal = this->heightOffset + - (this->verticalCellCount / 2.0f - static_cast(h)) + (this->verticalCellCount / 2 - static_cast(h)) * this->cellLength; + + // If there are odd vertical cells, shift cell planes up + if (this->verticalCellCount % 2) + hReal += this->cellLength; + for (unsigned int i = 0; i <= this->cellCount; i++) { - double inc = extent - (i * this->cellLength); + double extent = baseExtent; + + // If there is an odd cell count, extend a row and column along + // the positive x and y axes + if (this->cellCount % 2) + extent += this->cellLength; - Ogre::Vector3 p1(inc, -extent, hReal); + double inc = extent - (i * this->cellLength); + Ogre::Vector3 p1(inc, -baseExtent, hReal); Ogre::Vector3 p2(inc, extent , hReal); - Ogre::Vector3 p3(-extent, inc, hReal); + Ogre::Vector3 p3(-baseExtent, inc, hReal); Ogre::Vector3 p4(extent, inc, hReal); this->dataPtr->manualObject->position(p1); this->dataPtr->manualObject->position(p2); - this->dataPtr->manualObject->position(p3); this->dataPtr->manualObject->position(p4); } @@ -116,14 +127,30 @@ void OgreGrid::Create() { for (unsigned int y = 0; y <= this->cellCount; ++y) { - double xReal = extent - x * this->cellLength; - double yReal = extent - y * this->cellLength; + double xReal = baseExtent - x * this->cellLength; + double yReal = baseExtent - y * this->cellLength; double zTop = (this->verticalCellCount / 2.0f) * this->cellLength; double zBottom = -zTop; + // If odd vertical cell count, add cell length offset to adjust + // z min and max + if (this->verticalCellCount % 2) + { + zTop += this->cellLength / 2.0f; + zBottom += this->cellLength / 2.0f; + } + + // If odd horizontal cell count, shift vertical lines + // towards positive x, y axes + if (this->cellCount % 2) + { + xReal += this->cellLength; + yReal += this->cellLength; + } + this->dataPtr->manualObject->position(xReal, yReal, zBottom); - this->dataPtr->manualObject->position(xReal, yReal, zBottom); + this->dataPtr->manualObject->position(xReal, yReal, zTop); } } } diff --git a/ogre2/include/ignition/rendering/ogre2/Ogre2Camera.hh b/ogre2/include/ignition/rendering/ogre2/Ogre2Camera.hh index 99f244ca0..d88512ded 100644 --- a/ogre2/include/ignition/rendering/ogre2/Ogre2Camera.hh +++ b/ogre2/include/ignition/rendering/ogre2/Ogre2Camera.hh @@ -97,6 +97,8 @@ namespace ignition // Documentation inherited. public: virtual void Destroy() override; + public: Ogre::Camera *OgreCamera() const; + // Documentation inherited. public: virtual void SetVisibilityMask(uint32_t _mask) override; diff --git a/ogre2/src/Ogre2Camera.cc b/ogre2/src/Ogre2Camera.cc index bfc84983f..130ad446d 100644 --- a/ogre2/src/Ogre2Camera.cc +++ b/ogre2/src/Ogre2Camera.cc @@ -264,6 +264,12 @@ void Ogre2Camera::SetFarClipPlane(const double _far) this->ogreCamera->setFarClipDistance(_far); } +////////////////////////////////////////////////// +Ogre::Camera *Ogre2Camera::OgreCamera() const +{ + return ogreCamera; +} + ////////////////////////////////////////////////// void Ogre2Camera::SetVisibilityMask(uint32_t _mask) { diff --git a/ogre2/src/Ogre2DepthCamera.cc b/ogre2/src/Ogre2DepthCamera.cc index ac0039adb..0cff8792d 100644 --- a/ogre2/src/Ogre2DepthCamera.cc +++ b/ogre2/src/Ogre2DepthCamera.cc @@ -319,6 +319,7 @@ void Ogre2DepthCamera::CreateDepthTexture() // { // material DepthCamera // Use copy instead of original // input 0 depthTexture + // input 1 colorTexture // quad_normals camera_far_corners_view_space // } // } diff --git a/ogre2/src/Ogre2Grid.cc b/ogre2/src/Ogre2Grid.cc index edc9235e6..08493253a 100644 --- a/ogre2/src/Ogre2Grid.cc +++ b/ogre2/src/Ogre2Grid.cc @@ -80,19 +80,31 @@ void Ogre2Grid::Create() this->dataPtr->grid->Update(); this->dataPtr->grid->SetOperationType(MarkerType::MT_LINE_LIST); - double extent = (this->cellLength * static_cast(this->cellCount))/2; + double baseExtent = (this->cellLength * + static_cast(this->cellCount - this->cellCount % 2))/2; for (unsigned int h = 0; h <= this->verticalCellCount; ++h) { double hReal = this->heightOffset + - (this->verticalCellCount / 2.0f - static_cast(h)) + (this->verticalCellCount / 2 - static_cast(h)) * this->cellLength; + + // If there are odd vertical cells, shift cell planes up + if (this->verticalCellCount % 2) + hReal += this->cellLength; + for (unsigned int i = 0; i <= this->cellCount; i++) { - double inc = extent - (i * this->cellLength); + double extent = baseExtent; + + // If there is an odd cell count, extend a row and column along + // the positive x and y axes + if (this->cellCount % 2) + extent += this->cellLength; - math::Vector3d p1{inc, -extent, hReal}; + double inc = extent - (i * this->cellLength); + math::Vector3d p1{inc, -baseExtent, hReal}; math::Vector3d p2{inc, extent , hReal}; - math::Vector3d p3{-extent, inc, hReal}; + math::Vector3d p3{-baseExtent, inc, hReal}; math::Vector3d p4{extent, inc, hReal}; this->dataPtr->grid->AddPoint(p1); @@ -101,20 +113,36 @@ void Ogre2Grid::Create() this->dataPtr->grid->AddPoint(p4); } } - if (this->verticalCellCount > 0) { for (unsigned int x = 0; x <= this->cellCount; ++x) { for (unsigned int y = 0; y <= this->cellCount; ++y) { - double xReal = extent - x * this->cellLength; - double yReal = extent - y * this->cellLength; + double xReal = baseExtent - x * this->cellLength; + double yReal = baseExtent - y * this->cellLength; double zTop = (this->verticalCellCount / 2.0f) * this->cellLength; double zBottom = -zTop; + // If odd vertical cell count, add cell length offset to adjust + // z min and max + if (this->verticalCellCount % 2) + { + zTop += this->cellLength / 2.0f; + zBottom += this->cellLength / 2.0f; + } + + // If odd horizontal cell count, shift vertical lines + // towards positive x, y axes + if (this->cellCount % 2) + { + xReal += this->cellLength; + yReal += this->cellLength; + } + this->dataPtr->grid->AddPoint(xReal, yReal, zBottom); + this->dataPtr->grid->AddPoint(xReal, yReal, zTop); } } } diff --git a/test/integration/depth_camera.cc b/test/integration/depth_camera.cc index 9368bc4ba..851713a0e 100644 --- a/test/integration/depth_camera.cc +++ b/test/integration/depth_camera.cc @@ -384,7 +384,7 @@ void DepthCameraTest::DepthCameraBoxes( // Verify Depth { - // box not detected so all should return max val + // all points should have the same depth value EXPECT_FLOAT_EQ(expectedRange, scan[mid]); EXPECT_FLOAT_EQ(expectedRange, scan[left]); EXPECT_FLOAT_EQ(expectedRange, scan[right]); @@ -398,7 +398,7 @@ void DepthCameraTest::DepthCameraBoxes( for (unsigned int j = 0; j < depthCamera->ImageWidth(); ++j) { float x = pointCloudData[step + j*pointCloudChannelCount]; - EXPECT_FLOAT_EQ(expectedRange, x); + EXPECT_NEAR(expectedRange, x, DOUBLE_TOL); } } @@ -434,7 +434,11 @@ void DepthCameraTest::DepthCameraBoxes( ignition::rendering::unloadEngine(engine->Name()); } +#ifdef __APPLE__ +TEST_P(DepthCameraTest, DISABLED_DepthCameraBoxes) +#else TEST_P(DepthCameraTest, DepthCameraBoxes) +#endif { DepthCameraBoxes(GetParam()); } diff --git a/test/test_config.h.in b/test/test_config.h.in index 53b0405bb..b78b67897 100644 --- a/test/test_config.h.in +++ b/test/test_config.h.in @@ -9,7 +9,7 @@ #define RENDER_ENGINE_VALUES ::testing::ValuesIn(\ ignition::rendering::TestValues()) -static const std::vector kRenderEngineTestValues{"ogre", "optix"}; +static const std::vector kRenderEngineTestValues{"ogre2", "optix"}; #include #include