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

Map Display jumps due to Qt::QueuedConnection #1826

Closed
MichaelGrupp opened this issue May 13, 2024 · 7 comments · Fixed by #1828
Closed

Map Display jumps due to Qt::QueuedConnection #1826

MichaelGrupp opened this issue May 13, 2024 · 7 comments · Fixed by #1828

Comments

@MichaelGrupp
Copy link

After the recent upgrade from 1.14.20 to 1.14.23, we observed glitches when rendering dynamic maps such as costmaps.

I tracked the problem down to this commit: 93ac44b (PR #1793)

This "hack" seems to cause a delay in map rendering that leads to a broken map display.

With QueuedConnection

Using an unmodified 1.14.23 from the ROS noetic package distro. The costmap is jumping while moving. Note that the costmap frame_id is in a fixed frame.

broken.mp4

Without QueuedConnection

I cloned RViz from source at 1.14.23, removed that Qt::QueuedConnection flag, and built it. Using this patched RViz, the costmap is rendered at the correct spot again without jumping:

patched.mp4

Your environment

  • OS Version: e.g. Ubuntu 20.04
  • ROS Distro: Noetic
  • RViz, Qt, OGRE, OpenGl version as printed by rviz:
[${node} INFO 1715596133.955965167]: rviz version 1.14.23
[${node} INFO 1715596133.956069614]: compiled against Qt version 5.12.8
[${node} INFO 1715596133.956126962]: compiled against OGRE version 1.9.0 (Ghadamon)
[/rviz_1715596402254328779 INFO 1715596402.270469085]: Forcing OpenGl version 0.
[/rviz_1715596402254328779 INFO 1715596402.742861634, 1715596391.783960104]: Stereo is NOT SUPPORTED
[/rviz_1715596402254328779 INFO 1715596402.743000877, 1715596391.783960104]: OpenGL device: AMD RENOIR (DRM 3.44.0, 5.16.15-051615-generic, LLVM 12.0.0)
[/rviz_1715596402254328779 INFO 1715596402.743048266, 1715596391.783960104]: OpenGl version: 4.6 (GLSL 4.6) limited to GLSL 1.4 on Mesa system.
  • If source build, which git commit? -
  • System locale, i.e. the output of echo "$LANG $LC_NUMERIC": en_US.utf8 (LANG=C rviz doesn't change anything here)
    Before reporting a rendering issue, try running RViz with LANG=C rviz!
@MichaelGrupp MichaelGrupp changed the title Map Display lags behind due to Qt::QueuedConnection Map Display jumps due to Qt::QueuedConnection May 13, 2024
@MichaelGrupp
Copy link
Author

MichaelGrupp commented May 13, 2024

PR with code changes for my workaround: #1827

@StefanFabian: for your information

@ros-discourse
Copy link

This issue has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/preparing-for-noetic-sync-2024-05-09/37602/9

@rhaschke
Copy link
Contributor

Thanks for reporting this issue. Could you please provide a bagfile with your map data to experiment with the issue?

@MichaelGrupp
Copy link
Author

Thanks for the quick response. Here's a minimal example bag with only an occupancy grid topic /navigation/move_base_flex/local_costmap/costmap (zipped because of GitHub upload constraints).

example_costmap.zip

The effect should be visible when you set the RViz fixed frame to "map" and enable the grid. For reference, here's how a replay of that bag looks like on my computer:

example_bag.mp4

and without the queued connection:

example_bag_patched.mp4

@rhaschke
Copy link
Contributor

Thanks for providing the bag file. I can reproduce the glitches with that file. However, a simple test example (map_test.py) doesn't exhibit the issue. Thus I don't yet understand, where your particular issue comes from.
What version of the map is shown for the fraction of a second?
Could you please experiment with this test map and try to reproduce your issue with it?

MichaelGrupp added a commit to magazino/rviz that referenced this issue May 14, 2024
MichaelGrupp added a commit to magazino/rviz that referenced this issue May 14, 2024
MichaelGrupp added a commit to magazino/rviz that referenced this issue May 14, 2024
@MichaelGrupp
Copy link
Author

The issue seems to be visible with the following conditions:

  • grid is moved
  • content of grid changes

With the queued connection enabled, the previous grid gets first moved to the new position. Then the content gets updated with a short delay. It's not the grid moving to the wrong position, this is easier to see when replaying the videos with slower playback speed.

Here's a modified version of your script that makes it a bit better visible, it uses the RViz logo image from this repository:
magazino@0bc8926

It looks like in the video below in RViz 1.14.23. Also here I'd recommend to reduce playback speed, but it's also visible in normal speed.

screencap-2024-05-14_13.42.46.mp4

With the modified source without queued connection:

screencap-2024-05-14_13.48.22.mp4

rhaschke added a commit to rhaschke/rviz that referenced this issue May 15, 2024
The queued connection update introduced in ros-visualization#1793 caused the map display
to first update the pose of the map and then the map itself (in the next update cycle).
This can be perfectly seen when throttling the rviz frame rate.

Updates to the visualization should be handled in update() only.
Thus, now, if a map update is received, a flag is set to perform the costly map update.
If that flag is not set, only the transform is updated.
@rhaschke
Copy link
Contributor

I filed a PR to fix this issue: #1828. Could you please review?

rhaschke added a commit that referenced this issue May 15, 2024
The queued connection update introduced in #1793 caused the map display
to first update the pose of the map and then the map itself (in the next update cycle).
The resulting jittering can be perfectly seen when throttling the rviz frame rate.

Updates to the visualization should be handled in update() only.
Thus, now, if a map update is received, a flag is set to perform the costly map update.
If that flag is not set, only the transform is updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants