From 6ea5ede531133c4686d352c5af52cf000af6e21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Mon, 12 Jun 2023 17:48:30 +0200 Subject: [PATCH 1/9] Fixed light visual in OGRE (#862) (#864) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- ogre/src/OgreLightVisual.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/ogre/src/OgreLightVisual.cc b/ogre/src/OgreLightVisual.cc index cfc5420c8..e8c96ce1f 100644 --- a/ogre/src/OgreLightVisual.cc +++ b/ogre/src/OgreLightVisual.cc @@ -86,7 +86,6 @@ void OgreLightVisual::CreateVisual() this->dataPtr->line->AddPoint(p.X(), p.Y(), p.Z()); } this->dataPtr->line->Update(); - this->ogreNode->setVisible(true); } ////////////////////////////////////////////////// From c2c5fdfb889f449a0c7665dc492ee6b67591cadd Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Fri, 1 Sep 2023 15:43:40 -0500 Subject: [PATCH 2/9] Prepare for 6.6.1 Release (#891) Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 2 +- Changelog.md | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb9ad0b01..a6b6c445a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(ignition-rendering6 VERSION 6.6.0) +project(ignition-rendering6 VERSION 6.6.1) #============================================================================ # Find ignition-cmake diff --git a/Changelog.md b/Changelog.md index 66ad38d68..1a34984b5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,28 @@ ## Ignition Rendering +### Ignition Rendering 6.6.1 (2023-09-01) + +1. Fixed light visual in OGRE + * [Pull request #864](https://github.com/gazebosim/gz-rendering/pull/864) + +1. Lower severity level for ogre2 visibility mask msgs and unavailable render passes + * [Pull request #830](https://github.com/gazebosim/gz-rendering/pull/830) + +1. Infrastructure + * [Pull request #834](https://github.com/gazebosim/gz-rendering/pull/834) + +1. Rename COPYING to LICENSE + * [Pull request #833](https://github.com/gazebosim/gz-rendering/pull/833) + +1. Add message to see troubleshooting page when render engine fails to create dummy window + * [Pull request #829](https://github.com/gazebosim/gz-rendering/pull/829) + +1. Tweak max camera position limit + * [Pull request #827](https://github.com/gazebosim/gz-rendering/pull/827) + +1. Limit max camera position vector length + * [Pull request #824](https://github.com/gazebosim/gz-rendering/pull/824) + ### Ignition Rendering 6.6.0 (2023-02-02) 1. Backport Composite BaseVisual destroy fix to 6 From 938589795431581ad598a14313d1be3091a7d1a1 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 5 Sep 2023 12:00:57 -0700 Subject: [PATCH 3/9] Revert mesh viewer background color back to gray (#894) Signed-off-by: Ian Chen --- examples/mesh_viewer/Main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mesh_viewer/Main.cc b/examples/mesh_viewer/Main.cc index a496ac1f9..6df706243 100644 --- a/examples/mesh_viewer/Main.cc +++ b/examples/mesh_viewer/Main.cc @@ -45,7 +45,7 @@ void buildScene(ScenePtr _scene) { // initialize _scene _scene->SetAmbientLight(0.3, 0.3, 0.3); - _scene->SetBackgroundColor(0.0, 0.0, 0.3); + _scene->SetBackgroundColor(0.3, 0.3, 0.3); VisualPtr root = _scene->RootVisual(); // create directional light From b16a396d64f0c0a31dcb459b3acd6d719d057ea8 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 5 Sep 2023 12:02:54 -0700 Subject: [PATCH 4/9] Fix typo in bounding box camera tutorial (#896) Signed-off-by: Ian Chen --- tutorials/24_boundingbox_camera_tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/24_boundingbox_camera_tutorial.md b/tutorials/24_boundingbox_camera_tutorial.md index 9ce2f3b79..b957ee731 100644 --- a/tutorials/24_boundingbox_camera_tutorial.md +++ b/tutorials/24_boundingbox_camera_tutorial.md @@ -40,7 +40,7 @@ There are 2 other types of boxes: * 2D visible: box around the visible parts of an object. * 2D full: box around the object, including parts that aren't visible to the camera. -Compare the two 2D box types as followS: +Compare the two 2D box types as follows: ```{.sh} ./boundingbox_camera 2D_visible From 6fa1fc184d052b5235fa7ad7b75c9682142df39f Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Wed, 6 Sep 2023 13:02:49 -0700 Subject: [PATCH 5/9] Minor updates to README file in the hello_world_plugin example (#892) --------- Signed-off-by: Ian Chen --- examples/hello_world_plugin/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/hello_world_plugin/README.md b/examples/hello_world_plugin/README.md index adc9fee32..c9bbde486 100644 --- a/examples/hello_world_plugin/README.md +++ b/examples/hello_world_plugin/README.md @@ -36,8 +36,9 @@ Now you can run `gz sim` with the name of the resultant library file (without th or the file extension, i.e., libHelloWorldPlugin.so -> HelloWorldPlugin): ~~~ -gz sim --render-engine HelloWorldPlugin +gz sim --render-engine HelloWorldPlugin empty.sdf ~~~ You should see a blank screen within the Gazebo GUI, as this mocked plugin provides no implementation -for the scene. +for the scene. The Gazebo Component Inspector should show that the Render Engine Gui Plugin and +the Render Engine Server Plugin are now set to use the `HelloWorldPlugin`. From 59417bad192e096b5b3b0a28e28388c66de1252a Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Fri, 8 Sep 2023 11:06:58 -0700 Subject: [PATCH 6/9] Disable setting color range in particle emitter (#903) Signed-off-by: Ian Chen --- ogre2/src/Ogre2ParticleEmitter.cc | 4 ++++ test/common_test/ParticleEmitter_TEST.cc | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ogre2/src/Ogre2ParticleEmitter.cc b/ogre2/src/Ogre2ParticleEmitter.cc index 9a4d2e2b6..d62595408 100644 --- a/ogre2/src/Ogre2ParticleEmitter.cc +++ b/ogre2/src/Ogre2ParticleEmitter.cc @@ -296,6 +296,10 @@ void Ogre2ParticleEmitter::SetColorRange( const gz::math::Color &_colorStart, const gz::math::Color &_colorEnd) { + // see https://github.com/gazebosim/gz-rendering/issues/902 + gzwarn << "ParticleEmitter SetColorRange is currently disabled." << std::endl; + return; + // Color interpolator affector. if (!this->dataPtr->colorInterpolatorAffector) { diff --git a/test/common_test/ParticleEmitter_TEST.cc b/test/common_test/ParticleEmitter_TEST.cc index 909fe44d3..adce32612 100644 --- a/test/common_test/ParticleEmitter_TEST.cc +++ b/test/common_test/ParticleEmitter_TEST.cc @@ -29,7 +29,7 @@ using namespace gz; using namespace rendering; /// \brief The test fixture. -class ParticleEmitterTest : public CommonRenderingTest +class ParticleEmitterTest : public CommonRenderingTest { /// \brief A directory under test/ with some textures. protected: const std::string TEST_MEDIA_PATH = @@ -124,8 +124,10 @@ TEST_F(ParticleEmitterTest, ParticleEmitter) EXPECT_EQ(expectedMaterial, particleEmitter->Material()); EXPECT_DOUBLE_EQ(expectedMinVel, particleEmitter->MinVelocity()); EXPECT_DOUBLE_EQ(expectedMaxVel, particleEmitter->MaxVelocity()); - EXPECT_EQ(expectedColorStart, particleEmitter->ColorStart()); - EXPECT_EQ(expectedColorEnd, particleEmitter->ColorEnd()); + // ColorRange test is currently disabled, see + // https://github.com/gazebosim/gz-rendering/issues/902 + // EXPECT_EQ(expectedColorStart, particleEmitter->ColorStart()); + // EXPECT_EQ(expectedColorEnd, particleEmitter->ColorEnd()); EXPECT_DOUBLE_EQ(expectedScaleRate, particleEmitter->ScaleRate()); EXPECT_EQ(expectedColorRangeImage, particleEmitter->ColorRangeImage()); EXPECT_FLOAT_EQ(expectedScatterRatio, From da675f670d5d86d77771eac295ae96f58b0f3062 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 15 Sep 2023 07:59:44 -0700 Subject: [PATCH 7/9] ogre2: use CMAKE_INSTALL_RPATH (#909) Sets the ogre2 target INSTALL_RPATH to a copy of CMAKE_INSTALL_RPATH with OGRE_LIBRARY_DIRS appended, instead of just the latter path. This helps with packaging on macOS. Signed-off-by: Steve Peters --- ogre2/src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ogre2/src/CMakeLists.txt b/ogre2/src/CMakeLists.txt index ed89988d3..cfd9b220b 100644 --- a/ogre2/src/CMakeLists.txt +++ b/ogre2/src/CMakeLists.txt @@ -27,10 +27,14 @@ set_property( target_compile_definitions(${ogre2_target} PRIVATE OGRE_IGNORE_UNKNOWN_DEBUG) +# Add OGRE2_LIBRARY_DIRS to INSTALL_RPATH +# Append to a copy of CMAKE_INSTALL_RPATH since that is the default +set(ogre2_target_install_rpath ${CMAKE_INSTALL_RPATH}) +list(APPEND ogre2_target_install_rpath ${OGRE2_LIBRARY_DIRS}) set_property( TARGET ${ogre2_target} PROPERTY INSTALL_RPATH - ${OGRE2_LIBRARY_DIRS} + ${ogre2_target_install_rpath} ) target_include_directories(${ogre2_target} From b6f5d22a88ea520433a0ecaed1c9d0f76a709b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Fri, 22 Sep 2023 19:53:24 +0200 Subject: [PATCH 8/9] [backport fortress] Calculate camera intrinsics : Refactor (#905) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Calculate camera intrinsics : Refactor https://github.com/gazebosim/gz-rendering/pull/700 (#755) Signed-off-by: Alejandro Hernández Cordero --------- Signed-off-by: Alejandro Hernández Cordero Co-authored-by: Aditya Pande --- include/gz/rendering/Utils.hh | 14 ++++++ src/Camera_TEST.cc | 86 +++++++++++++++++++++++++++++++++++ src/Utils.cc | 19 ++++++++ 3 files changed, 119 insertions(+) diff --git a/include/gz/rendering/Utils.hh b/include/gz/rendering/Utils.hh index cc552d4d1..82db726fe 100644 --- a/include/gz/rendering/Utils.hh +++ b/include/gz/rendering/Utils.hh @@ -97,6 +97,20 @@ namespace ignition ignition::math::AxisAlignedBox transformAxisAlignedBox( const ignition::math::AxisAlignedBox &_box, const ignition::math::Pose3d &_pose); + + /// \brief Convert a given camera projection matrix + /// to an intrinsics matrix. Intrinsics matrix is different + /// from the matrix returned by Camera::ProjectionMatrix(), + /// which is used by OpenGL internally. + /// The matrix returned contains the camera calibrated values. + /// \param[in] _projectionMatrix Camera's projection matrix. + /// \param[in] _width Camera's image width. + /// \param[in] _height Camera's image height. + /// \return Camera's intrinsic matrix. + IGNITION_RENDERING_VISIBLE + ignition::math::Matrix3d projectionToCameraIntrinsic( + const ignition::math::Matrix4d &_projectionMatrix, + double _width, double _height); } } } diff --git a/src/Camera_TEST.cc b/src/Camera_TEST.cc index ae2190f67..262f41a86 100644 --- a/src/Camera_TEST.cc +++ b/src/Camera_TEST.cc @@ -26,6 +26,7 @@ #include "gz/rendering/RenderingIface.hh" #include "gz/rendering/RenderPassSystem.hh" #include "gz/rendering/Scene.hh" +#include "gz/rendering/Utils.hh" using namespace gz; using namespace rendering; @@ -47,6 +48,9 @@ class CameraTest : public testing::Test, /// \brief Test setting visibility mask public: void VisibilityMask(const std::string &_renderEngine); + + /// \brief Test setting intrinsic matrix + public: void IntrinsicMatrix(const std::string &_renderEngine); }; ///////////////////////////////////////////////// @@ -365,6 +369,82 @@ void CameraTest::VisibilityMask(const std::string &_renderEngine) rendering::unloadEngine(engine->Name()); } +///////////////////////////////////////////////// +void CameraTest::IntrinsicMatrix(const std::string &_renderEngine) +{ + // create and populate scene + RenderEngine *engine = rendering::engine(_renderEngine); + if (!engine) + { + igndbg << "Engine '" << _renderEngine + << "' is not supported" << std::endl; + return; + } + + ScenePtr scene = engine->CreateScene("scene"); + ASSERT_NE(nullptr, scene); + + CameraPtr camera = scene->CreateCamera(); + EXPECT_TRUE(camera != nullptr); + + unsigned int width = 320; + unsigned int height = 240; + double hfov = 1.047; + + camera->SetImageHeight(height); + camera->SetImageWidth(width); + camera->SetHFOV(hfov); + + double error = 1e-1; + EXPECT_EQ(camera->ImageHeight(), height); + EXPECT_EQ(camera->ImageWidth(), width); + EXPECT_NEAR(camera->HFOV().Radian(), hfov, error); + + // Verify focal length and optical center from intrinsics + auto cameraIntrinsics = projectionToCameraIntrinsic( + camera->ProjectionMatrix(), + camera->ImageWidth(), + camera->ImageHeight() + ); + EXPECT_NEAR(cameraIntrinsics(0, 0), 277.1913, error); + EXPECT_NEAR(cameraIntrinsics(1, 1), 277.1913, error); + EXPECT_DOUBLE_EQ(cameraIntrinsics(0, 2), 160); + EXPECT_DOUBLE_EQ(cameraIntrinsics(1, 2), 120); + + // Verify rest of the intrinsics + EXPECT_EQ(cameraIntrinsics(0, 1), 0); + EXPECT_EQ(cameraIntrinsics(1, 0), 0); + EXPECT_EQ(cameraIntrinsics(0, 1), 0); + EXPECT_EQ(cameraIntrinsics(2, 0), 0); + EXPECT_EQ(cameraIntrinsics(2, 1), 0); + EXPECT_EQ(cameraIntrinsics(2, 2), 1); + + // Verify that changing camera size changes intrinsics + height = 1000; + width = 1000; + camera->SetImageHeight(height); + camera->SetImageWidth(width); + camera->SetHFOV(hfov); + + EXPECT_EQ(camera->ImageHeight(), height); + EXPECT_EQ(camera->ImageWidth(), width); + EXPECT_NEAR(camera->HFOV().Radian(), hfov, error); + + // Verify if intrinsics have changed + cameraIntrinsics = projectionToCameraIntrinsic( + camera->ProjectionMatrix(), + camera->ImageWidth(), + camera->ImageHeight() + ); + EXPECT_NEAR(cameraIntrinsics(0, 0), 866.223, error); + EXPECT_NEAR(cameraIntrinsics(1, 1), 866.223, error); + EXPECT_DOUBLE_EQ(cameraIntrinsics(0, 2), 500); + EXPECT_DOUBLE_EQ(cameraIntrinsics(1, 2), 500); + + // Clean up + engine->DestroyScene(scene); +} + ///////////////////////////////////////////////// TEST_P(CameraTest, ViewProjectionMatrix) { @@ -395,6 +475,12 @@ TEST_P(CameraTest, VisibilityMask) VisibilityMask(GetParam()); } +///////////////////////////////////////////////// +TEST_P(CameraTest, IntrinsicMatrix) +{ + IntrinsicMatrix(GetParam()); +} + INSTANTIATE_TEST_CASE_P(Camera, CameraTest, RENDER_ENGINE_VALUES, PrintToStringParam()); diff --git a/src/Utils.cc b/src/Utils.cc index 39154dd29..eabeeb64d 100644 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -163,6 +163,25 @@ float screenScalingFactor() return ratio; } +///////////////////////////////////////////////// +ignition::math::Matrix3d projectionToCameraIntrinsic( + const gz::math::Matrix4d &_projectionMatrix, + double _width, double _height) +{ + // Extracting the intrinsic matrix : + // https://ogrecave.github.io/ogre/api/13/class_ogre_1_1_math.html + double fX = (_projectionMatrix(0, 0) * _width) / 2.0; + double fY = (_projectionMatrix(1, 1) * _height) / 2.0; + double cX = (-1.0 * _width * + (_projectionMatrix(0, 2) - 1.0)) / 2.0; + double cY = _height + (_height * + (_projectionMatrix(1, 2) - 1)) / 2.0; + + return gz::math::Matrix3d(fX, 0, cX, + 0, fY, cY, + 0, 0, 1); +} + ///////////////////////////////////////////////// ignition::math::AxisAlignedBox transformAxisAlignedBox( const ignition::math::AxisAlignedBox &_bbox, From 61bf635a5b6daf4918f37f837d0a5076adc5c879 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Tue, 26 Sep 2023 17:09:14 -0500 Subject: [PATCH 9/9] Prepare for 7.4.2 release (#922) Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 2 +- Changelog.md | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99bbb7820..24b014b70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(gz-rendering7 VERSION 7.4.1) +project(gz-rendering7 VERSION 7.4.2) #============================================================================ # Find gz-cmake diff --git a/Changelog.md b/Changelog.md index d89b95a5a..b78dea8bd 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,21 @@ ### Gazebo Rendering 7.X +### Gazebo Rendering 7.4.2 (2023-09-26) + +1. ogre2: use CMAKE_INSTALL_RPATH + * [Pull request #909](https://github.com/gazebosim/gz-rendering/pull/909) + +1. Disable setting color range in particle emitter + * [Pull request #903](https://github.com/gazebosim/gz-rendering/pull/903) + +1. Documentation updates + * [Pull request #892](https://github.com/gazebosim/gz-rendering/pull/892) + * [Pull request #896](https://github.com/gazebosim/gz-rendering/pull/896) + +1. Revert mesh viewer background color back to gray + * [Pull request #894](https://github.com/gazebosim/gz-rendering/pull/894) + ### Gazebo Rendering 7.4.1 (2023-08-17) 1. Infrastructure