Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI for adjusting FOV #1499

Closed
wants to merge 11 commits into from
Closed

GUI for adjusting FOV #1499

wants to merge 11 commits into from

Conversation

AzulRadio
Copy link
Contributor

New feature

Add a GUI for adjusting FOV

Summary

image

Test it

Change value in horizontal_fov and the FOV of the scene should change as well.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Signed-off-by: youhy <haoyuan2019@outlook.com>
@AzulRadio AzulRadio requested a review from chapulina as a code owner May 18, 2022 17:11
@chapulina chapulina added enhancement New feature or request GUI Gazebo's graphical interface (not pure Ignition GUI) 🏯 fortress Ignition Fortress labels May 18, 2022
@chapulina chapulina requested a review from jennuine May 18, 2022 17:42
@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #1499 (0ce21a7) into ign-gazebo6 (d6e69d0) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head 0ce21a7 differs from pull request most recent head 113f1c7. Consider uploading reports for the commit 113f1c7 to get more accurate results

@@               Coverage Diff               @@
##           ign-gazebo6    #1499      +/-   ##
===============================================
- Coverage        64.02%   64.00%   -0.03%     
===============================================
  Files              317      317              
  Lines            25649    25649              
===============================================
- Hits             16422    16416       -6     
- Misses            9227     9233       +6     
Impacted Files Coverage Δ
src/Util.cc 92.53% <100.00%> (ø)
src/SimulationRunner.cc 90.93% <0.00%> (-0.96%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 44406a9...113f1c7. Read the comment docs.

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

fov_changing


I'm getting crashes sometimes, I think it's related to some combination of the window current size / aspect ratio, and the current FOV. You can try changing the FOV a few times, then resizing the window and changing the FOV again a few times.

The backtrace points to gz-rendering. It would be interesting to find out what conditions cause the crash, to see if we can prevent it from here, or fix it there.

crash backtrace

#15   Object "/home/chapulina/dev_focal/ws_fortress/install/lib/ign-gui-6/plugins/libMinimalScene.so", at 0x7fa34c899905, in ignition::gui::plugins::RenderThread::RenderNext(ignition::gui::plugins::RenderSync*)
#14   Object "/home/chapulina/dev_focal/ws_fortress/install/lib/ign-gui-6/plugins/libMinimalScene.so", at 0x7fa34c897cd3, in ignition::gui::plugins::IgnRenderer::Render(ignition::gui::plugins::RenderSync*)
#13   Object "/home/chapulina/dev_focal/ws_fortress/install/lib/ign-rendering-6/engine-plugins/libignition-rendering-ogre2.so", at 0x7fa333e4654d, in ignition::rendering::v6::BaseCamera<ignition::rendering::v6::Ogre2Sensor>::Update()
#12   Object "/home/chapulina/dev_focal/ws_fortress/install/lib/ign-rendering-6/engine-plugins/libignition-rendering-ogre2.so", at 0x7fa333ec7e65, in ignition::rendering::v6::Ogre2RenderTarget::Render()
#11   Object "/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fa333b157fa, in Ogre::CompositorWorkspace::_update(bool)
#10   Object "/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fa333b15527, in Ogre::CompositorWorkspace::_update(bool)
#9    Object "/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fa333b02bb4, in Ogre::CompositorNode::_update(Ogre::Camera const*, Ogre::SceneManager*)
#8    Object "/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fa333b2ed68, in Ogre::CompositorPassScene::execute(Ogre::Camera const*)
#7    Object "/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fa3339e88c9, in Ogre::SceneManager::updateAllLods(Ogre::Camera const*, float, unsigned char, unsigned char)
#6    Object "/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fa333846dd0, in Ogre::Frustum::getFrustumPlanes() const
#5    Object "/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fa33384381a, in Ogre::Frustum::updateFrustumPlanes() const
#4    Object "/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fa33384373e, in Ogre::Frustum::updateFrustumImpl() const

src/gui/plugins/view_angle/ViewAngle.qml Outdated Show resolved Hide resolved
src/gui/plugins/view_angle/ViewAngle.hh Outdated Show resolved Hide resolved
src/gui/plugins/view_angle/ViewAngle.cc Show resolved Hide resolved
src/gui/plugins/view_angle/ViewAngle.qml Show resolved Hide resolved
AzulRadio added 2 commits May 19, 2022 07:44
Signed-off-by: youhy <haoyuan2019@outlook.com>
Signed-off-by: youhy <haoyuan2019@outlook.com>
@chapulina chapulina requested a review from ahcorde May 23, 2022 18:35
@jennuine
Copy link
Contributor

jennuine commented May 23, 2022

Thanks @ahcorde for taking a look. I was playing around during the sim meeting and in:
https://github.com/gazebosim/gz-rendering/blob/1481bf8e2856a2e29fa2592bd4c32951e09166e9/ogre2/src/Ogre2Camera.cc#L79

If you change this->aspect to this->AspectRatio() the crash no longer happens for me but requires some more testing

Signed-off-by: youhy <haoyuan2019@outlook.com>
@AzulRadio AzulRadio requested a review from chapulina June 9, 2022 21:26
@jennuine jennuine added the needs upstream release Blocked by a release of an upstream library label Jun 9, 2022
@chapulina chapulina mentioned this pull request Jun 15, 2022
7 tasks
Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Louise Poubel <louise@openrobotics.org>
@chapulina chapulina removed the needs upstream release Blocked by a release of an upstream library label Jun 15, 2022
Copy link
Contributor

@jennuine jennuine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code LGTM unfortunately there is another crash that occurs but it also occurs without this PR.

The crash happens when you move the gui camera off of the main scene. With this PR with HFOV left at 90 and without this PR, it takes much longer for it to crash (continually move the camera around) and sometimes it doesn't crash at all but after a few tries (closing and restarting) it will eventually crash. With this PR, if you set HFOV to high then it crashes almost right away:

Peek 2022-06-16 09-58

crash backtrace
libEGL warning: DRI2: failed to create dri screen
libEGL warning: Not allowed to force software rendering when API explicitly selects a hardware device.
libEGL warning: DRI2: failed to create dri screen
ign gazebo gui: /var/lib/jenkins/workspace/ogre-2.2-debbuilder/repo/OgreMain/include/OgreAxisAlignedBox.h:251: void Ogre::AxisAlignedBox::setExtents(const Ogre::Vector3&, const Ogre::Vector3&): Assertion (min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"' failed.
Stack trace (most recent call last) in thread 5410:
#31   Object "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7fd8117278d9, in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
#30   Object "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7fd81178285e, in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
#29   Object "/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0", at 0x7fd80d0d37fb, in g_main_context_iteration
#28   Object "/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0", at 0x7fd80d0d376f, in 
#27   Object "/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0", at 0x7fd80d0d3536, in g_main_context_dispatch
#26   Object "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7fd811783232, in 
#25   Object "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7fd81172c01c, in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)
#24   Object "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7fd8117298a7, in QCoreApplication::notifyInternal2(QObject*, QEvent*)
#23   Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5", at 0x7fd810b14103, in QApplication::notify(QObject*, QEvent*)
#22   Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5", at 0x7fd810b0c83b, in QApplicationPrivate::notify_helper(QObject*, QEvent*)
#21   Object "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7fd811759091, in QObject::event(QEvent*)
#20   Object "/home/tuila/Workspaces/ignFortress/install/lib/ign-gui-6/plugins/libMinimalScene.so", at 0x7fd7cbb86b4f, in ignition::gui::plugins::RenderThread::RenderNext(ignition::gui::plugins::RenderSync*)
#19   Object "/home/tuila/Workspaces/ignFortress/install/lib/ign-gui-6/plugins/libMinimalScene.so", at 0x7fd7cbb8698f, in ignition::gui::plugins::IgnRenderer::Render(ignition::gui::plugins::RenderSync*)
#18   Object "/home/tuila/Workspaces/ignFortress/install/lib/ign-rendering-6/engine-plugins/libignition-rendering-ogre2.so", at 0x7fd7a25c9242, in ignition::rendering::v6::BaseCamera<ignition::rendering::v6::Ogre2Sensor>::Update()
#17   Object "/home/tuila/Workspaces/ignFortress/install/lib/ign-rendering-6/engine-plugins/libignition-rendering-ogre2.so", at 0x7fd7a263f0c1, in ignition::rendering::v6::Ogre2RenderTarget::Render()
#16   Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a204fdf2, in Ogre::CompositorWorkspace::_update(bool)
#15   Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a204fb21, in Ogre::CompositorWorkspace::_update(bool)
#14   Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a203eb35, in Ogre::CompositorNode::_update(Ogre::Camera const*, Ogre::SceneManager*)
#13   Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a20649bc, in Ogre::CompositorPassScene::execute(Ogre::Camera const*)
#12   Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a20491d6, in Ogre::CompositorShadowNode::_update(Ogre::Camera*, Ogre::Camera const*, Ogre::SceneManager*)
#11   Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a203eb35, in Ogre::CompositorNode::_update(Ogre::Camera const*, Ogre::SceneManager*)
#10   Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a2064ac8, in Ogre::CompositorPassScene::execute(Ogre::Camera const*)
#9    Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a1d3e27e, in Ogre::Camera::_cullScenePhase01(Ogre::Camera*, Ogre::Camera const*, Ogre::Viewport*, unsigned char, unsigned char, bool)
#8    Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a1f27d38, in Ogre::SceneManager::_cullPhase01(Ogre::Camera*, Ogre::Camera*, Ogre::Camera const*, unsigned char, unsigned char, bool)
#7    Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a1ee4d89, in Ogre::RenderQueue::renderPassPrepare(bool, bool)
#6    Object "/usr/lib/x86_64-linux-gnu/libOgreHlmsPbs.so.2.2.6", at 0x7fd7a198b217, in Ogre::HlmsPbs::preparePassHash(Ogre::CompositorShadowNode const*, bool, bool, Ogre::SceneManager*)
#5    Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a1d82669, in Ogre::Frustum::getProjectionMatrixWithRSDepth() const
#4    Object "/usr/lib/x86_64-linux-gnu/libOgreMain.so.2.2.6", at 0x7fd7a1d835fe, in Ogre::Frustum::updateFrustumImpl() const
#3    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fd817fa6471, in __assert_fail
#2    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fd817fa63f9, in 
#1    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fd817fb67f0, in abort
#0    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fd817fb4e87, in gsignal

I've seen this issue ign gazebo gui: /var/lib/jenkins/workspace/ogre-2.2-debbuilder/repo/OgreMain/include/OgreAxisAlignedBox.h:251: void Ogre::AxisAlignedBox::setExtents(const Ogre::Vector3&, const Ogre::Vector3&): Assertion (min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"' failed. before in #1072

@chapulina
Copy link
Contributor

unfortunately there is another crash that occurs but it also occurs without this PR

I'm not able to reproduce the crash, I'm on Focal. But I got several error messages saying I was trying to set NaN node poses. I added more guards against NaNs in the following PR, maybe it helps with your crash?

@jennuine
Copy link
Contributor

I added more guards against NaNs in the following PR, maybe it helps with your crash?
gazebosim/gz-rendering#655

Unfortunately, I'm still getting the crash on Focal and Bionic 😕

@chapulina
Copy link
Contributor

I'm still getting the crash on Focal and Bionic

I was able to reproduce the crash on Bionic. Then I built https://github.com/gazebo-forks/ogre-2.2-release from source into my workspace to debug further, and with the source build it doesn't crash anymore. Instead, I see lots of errors and warnings printed:

[GUI] [Err] [OrbitViewController.cc:140] Camera world position isn't finite [-nan -nan -nan]
...
[GUI] [Wrn] [Ogre2RayQuery.cc:89] Attempted to set non-finite origin from camera [scene::Camera(65527)]
[GUI] [Wrn] [Ogre2RayQuery.cc:100] Attempted to set non-finite direction from camera [scene::Camera(65527)]
...

So with that setup, I was able to fix the warnings with the following PR:

I'd appreciate it if someone could check if that solves the crashes for them.

@jennuine
Copy link
Contributor

I'd appreciate it if someone could check if that solves the crashes for them.

Thanks for the attempt but unfortunately I'm still getting crashes :(

@jennuine
Copy link
Contributor

Closing until gazebosim/gz-rendering#710 is resolved

@jennuine jennuine closed this Aug 22, 2022
@jennuine jennuine deleted the azulradio/FOV-gui branch August 22, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🏯 fortress Ignition Fortress GUI Gazebo's graphical interface (not pure Ignition GUI) OOBE 📦✨ Out-of-box experience
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants