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

Add new imagepanel, but it doesn't display correctly. #1605

Closed
jeffryHo opened this issue Apr 1, 2021 · 10 comments
Closed

Add new imagepanel, but it doesn't display correctly. #1605

jeffryHo opened this issue Apr 1, 2021 · 10 comments

Comments

@jeffryHo
Copy link
Contributor

jeffryHo commented Apr 1, 2021

When I add imagepanel, there is always a display error. I tried many ways, but I couldn't fix the problem. Can you fix it?

display_not_correctly

@jeffryHo jeffryHo closed this as completed Apr 1, 2021
@jeffryHo
Copy link
Contributor Author

jeffryHo commented Apr 1, 2021

redo

@rhaschke
Copy link
Contributor

rhaschke commented Apr 1, 2021

This works without problems on my side. Did you configure an image topic to read from?
image

This question should be better asked at https://answers.ros.org. Please, post real issues and bug reports here.

@jeffryHo
Copy link
Contributor Author

jeffryHo commented Apr 2, 2021

It's a problem that's probabilistically recurring. You can try to add imagepanel few more times, and the problem will recur, and you don't need to select any topics.

@rhaschke
Copy link
Contributor

rhaschke commented Apr 2, 2021

Obviously, I missed the actual problem. Could you please more explicitly explain your problem?

@jeffryHo jeffryHo reopened this Apr 6, 2021
@jeffryHo
Copy link
Contributor Author

jeffryHo commented Apr 6, 2021

Environment:

  • OS Version: Ubuntu 18.04
  • ROS Distro: [Melodic]
  • RViz, Qt, OGRE, OpenGl version as printed by rviz:
    [ INFO] [1617672134.333878300]: rviz version 1.13.16
    [ INFO] [1617672134.333933900]: compiled against Qt version 5.9.5
    [ INFO] [1617672134.333944200]: compiled against OGRE version 1.9.0 (Ghadamon)
    [ INFO] [1617672134.339914900]: Forcing OpenGl version 0.
    [ INFO] [1617672134.545871700]: Stereo is NOT SUPPORTED
    [ INFO] [1617672134.546045100]: OpenGL device: llvmpipe (LLVM 10.0.0, 256 bits)
    [ INFO] [1617672134.546104200]: OpenGl version: 3.1 (GLSL 1.4).

Operation procedure:
1.open rviz
2.add imagepanel from displays panel
3. add imagepanel multiple times

Expect result:
imagepanel show defalut texture image correctly

Actual results:
some imagepanel is no show it correctly

Location Information
setContentWidget and addDocWidget will reset objects parent, and that cause resize event unnecessary sended.
render widget responded resize events twices, one of which was wrong. and floating value must set false, otherwise
dockwiget will floating above the main window.

VisualizationFrame::addPane(const QString& name, QWidget* panel, Qt::DockWidgetArea area, bool floating)
{
PanelDockWidget* dock;
dock = new PanelDockWidget(name);
dock->setContentWidget(panel);
dock->setFloating(floating);
dock->setObjectName(name); // QMainWindow::saveState() needs objectName to be set.
addDockWidget(area, dock);
// we want to know when that panel becomes visible
connect(dock, SIGNAL(visibilityChanged(bool)), this, SLOT(onDockPanelVisibilityChange(bool)));
connect(this, SIGNAL(fullScreenChange(bool)), dock, SLOT(overrideVisibility(bool)));
QAction* toggle_action = dock->toggleViewAction();
view_menu_->addAction(toggle_action);
connect(toggle_action, SIGNAL(triggered(bool)), this, SLOT(setDisplayConfigModified()));
connect(dock, SIGNAL(closed()), this, SLOT(setDisplayConfigModified()));
dock->installEventFilter(geom_change_detector_);
// repair/update visibility status
hideLeftDock(area == Qt::LeftDockWidgetArea ? false : hide_left_dock_button_->isChecked());
hideRightDock(area == Qt::RightDockWidgetArea ? false : hide_right_dock_button_->isChecked());
return dock;
}

fix way:

 PanelDockWidget* dock;
  
  dock = new PanelDockWidget(name);
  addDockWidget(area, dock);

  dock->setFloating(floating);
  dock->setContentWidget(panel);
  dock->setObjectName(name); // QMainWindow::saveState() needs objectName to be set.

@rhaschke
Copy link
Contributor

rhaschke commented Apr 6, 2021

If I understand correctly, you suggest to change the order of calls: First call addDockWidget() and then setContentWidget(), which will save a call to resize(). Could you please file a PR for this change?
The question remains, why the code cannot handle two resize events in a row. What do you mean by "one of those resize events was wrong"? Just superfluous or badly parameterized?

@jeffryHo
Copy link
Contributor Author

jeffryHo commented Apr 7, 2021

yes , your understanding is right.

I add a imagepanel from displaypanel.
if the imagepanel display correctly, the image is like

interface ok

I add log print in QtOgreRenderWindow ::resizeEvent and it print log is

[ INFO] [1617766276.440939400]: rviz version 1.13.16
[ INFO] [1617766276.440979000]: compiled against Qt version 5.9.5
[ INFO] [1617766276.440985800]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1617766276.445404100]: Forcing OpenGl version 0.
[ INFO] [1617766276.575364100]: Stereo is NOT SUPPORTED
[ INFO] [1617766276.575495500]: OpenGL device: llvmpipe (LLVM 10.0.0, 256 bits)
[ INFO] [1617766276.575552200]: OpenGl version: 3.1 (GLSL 1.4).


OgreRenderWindow resize:543;688
OgreRenderWindow resize time stamp:11:31:16 685685

DisplaysPanel addNew end:11:31:21 055055


OgreRenderWindow resize:342;166
OgreRenderWindow resize time stamp:11:31:21 057057

but if imagepanel display image is not in the right way
it display image like

interface2

and log print is

[ INFO] [1617766201.796327700]: rviz version 1.13.16
[ INFO] [1617766201.796388800]: compiled against Qt version 5.9.5
[ INFO] [1617766201.796400500]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1617766201.802863000]: Forcing OpenGl version 0.
[ INFO] [1617766202.045629400]: Stereo is NOT SUPPORTED
[ INFO] [1617766202.045809000]: OpenGL device: llvmpipe (LLVM 10.0.0, 256 bits)
[ INFO] [1617766202.045882100]: OpenGl version: 3.1 (GLSL 1.4).


OgreRenderWindow resize:543;688
OgreRenderWindow resize time stamp:11:30:02 3131

DisplaysPanel addNew end:11:30:07 507507


OgreRenderWindow resize:342;166
OgreRenderWindow resize time stamp:11:30:07 508508


OgreRenderWindow resize:640;480
OgreRenderWindow resize time stamp:11:30:07 528528

There are one more resize event had happend than the normal one.
I thought that maybe the Qt event loop is no correctly, The sequence of adding widgets may be wrong.

so that I adjusted the order of widgets added. addDockWidget first , and then setContentWidget. Magically , the problem
is fixed. And dock->setFloating(floating) is working too. the imagepanel floating above the mainwindow

imagepic

well , In order to be able to keep the same behavior pattern, dock->setFloating is parameter must be false, the dockwidget will docked in the leftarea.

@rhaschke
Copy link
Contributor

rhaschke commented Apr 7, 2021

Thanks for this clarification. Could you please file a PR with your solution? Thanks.

@rhaschke
Copy link
Contributor

rhaschke commented Apr 8, 2021

Fixed via #1611.

@rhaschke rhaschke closed this as completed Apr 8, 2021
@jeffryHo
Copy link
Contributor Author

jeffryHo commented Apr 9, 2021

Thanks for merged my PR, I found that you changed the setting of floating, but when floating is set to true, the panel cannot be displayed because you did not add the panel to the main window. Have you ever tested it?

if floating is true then rviz show like this
1

When the PanelDockwidget is created, its parent class is not specified.

I don't understand what you mean "floating" mutually excludes "docked"? After addDockWidget you can also make the widow floating.

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

No branches or pull requests

2 participants