ia-dev / opensimQt

CPP GUI for OpenSim
Apache License 2.0
5 stars 6 forks source link

MS0103: open a .osim file and load its elements to the visualizer. #3

Closed idhamari closed 4 years ago

idhamari commented 4 years ago

This is one of the main tasks and it may take a longer time.

idhamari commented 4 years ago

Note:

I suggest doing this in two phases but feel free to use vtk directly if this is easier.

  1. using the current OpenSim visualizer (it is openGL based).
    • this provides more understanding to the current gui pipeline.
    • this helps to keep back compatibility.
    • this also makes it easier to get new updates when needed.
  2. using vtk.
yasseerr commented 4 years ago
yasseerr commented 4 years ago

@idhamari after some reserch we extracted 3 points :

how do you think we should procced , and here is a screenshot of OpenSimQt using the server of openSim-gui using QtWebEngine 2020-02-16_18-47-48

idhamari commented 4 years ago

The default visualizer is a seperate program by it own and it does not offer a library to include it in OpenGL Surface so we can not use it inside Qt the link for the program opensim_dependencies_install\simbody\bin\simbody-visualizer.exe

the source code is available, so probably we can either:

For now, I suggest to use the QtWebEngine solution if the above solutions take time, I will try to test it tomorrow and provide feedback. I have some students who may work on the

idhamari commented 4 years ago

@yasseerr You may start working on the next tasks as they are independent and they should not take time.

yasseerr commented 4 years ago

@idhamari totaly agree building a visualizer using Qt3D opengl will be inspired from the default visualiser by going over SimTK documentation https://stanford.edu/~dembia/simbody_taskspace/html/classSimTK_1_1Visualizer.html i will try and finish the QtWebEngin integration and the other tasks

idhamari commented 4 years ago

@yasseerr

totaly agree building a visualizer using Qt3D opengl will be inspired from the default visualiser by going over [SimTK documentation] (https://stanford.edu/~dembia/simbody_taskspace/html/classSimTK_1_1Visualizer.html)

probably we can build a shared visualizer library by modifying the simbody visualizer CMakeLists.txt , you can also ask about this in the simbody forum, check first if there are related questions.

It seems QtCreator can not recognize QWebEngineView widget, I get this error:

mainwindow.cpp:-1: error: undefined reference to `QWebEngineView::QWebEngineView(QWidget*)'

Screenshot from 2020-02-17 10-10-14

Maybe this is an error related to Qt version, what version of are you using. Mine is Qt5.9.5. I could be able to run the Qt web examples i.e. webengine and webview but they used .pro not CMake, they also uses QML. So Maybe the problem is related to CMake or QML.

yasseerr commented 4 years ago

@idhamari

idhamari commented 4 years ago

WebEngine was already installed. I found that I forgot to update the CMakeLists.txt file so I used the old file which does not contain the WebEngine:

          find_package(Qt5 COMPONENTS Widgets WebEngine WebEngineWidgets  LinguistTools REQUIRED)

It works now but it seems I have to have a server running

Screenshot from 2020-02-17 14-50-05

Screenshot from 2020-02-17 14-48-54

yasseerr commented 4 years ago

Nice! the server is created when you run the netbeans app (just for demonstration)

idhamari commented 4 years ago

Yes, it works now, thanks for the info.

idhamari commented 4 years ago

@yasseerr

As I understood:

Next Todos: Creating vsSimbodyVisualizer alongside the current simebody-visualizer.

idhamari commented 4 years ago

@yasseerr

please use our simbody branch:

https://github.com/VisSimKoblenz/simbody/tree/vsSimbodyVisualizer

You may also change the link in opensim-core dependancy Cmake to point to this link as well.

yasseerr commented 4 years ago

@idhamari understood !

idhamari commented 4 years ago

@yasseerr

Urgent

Before things get out of control as we are getting more and more files, please organize the naming of the current files in a standard way:

This will ensure readability and solve compatibility in Linux.

idhamari commented 4 years ago

A useful VTK book is added.

yasseerr commented 4 years ago

@idhamari thanks for the suggestion! just an update : its appear we can implement our visualizer by inheriting the \Simbody\Visualizer\src\VisualizerGeometry.h and implement it functions to render using vtk wich i had a problem this past days concerning the vtp files not been called in implementMeshFileGeometry however it had been solved, hopfully the geometryimplemetationqt.h will be implemented without any errors and the model will be loaded to the screen in the next 5 days without having to plug anything in the simbody project because we have access to the State variable unlike visualizer-simbody.cpp but first the naming of the files will be changed

idhamari commented 4 years ago

its appear we can implement our visualizer by inheriting

This sound great

i had a problem this past days concerning the vtp files not been called

If in the future you have such a problem please let me know. I could suggest we ignore the vtp file because it is only one format and can be converted to another format when needed e.g. stl

I am looking forward to testing the next working version version.

yasseerr commented 4 years ago

good to know, but the problem was about getting the system to load the meshes from the bodies independent from the mesh format, its about tweaking the params and calling the right functions still next version comming soon 👍

yasseerr commented 4 years ago

@idhamari hi! what are those violet spheres and are they a problem/bug ? 2020-02-29_14-29-23

idhamari commented 4 years ago

@yasseerr Not sure, which model are you using? they look like markers.

idhamari commented 4 years ago

Notice that some model elements are visualized by opengl e.g markers, muscles and sometimes bodies. This means the mesh is generated programmatically not input from a file.

yasseerr commented 4 years ago

yes, so the the spheres where for debugging and they represent ground=>bodySet.. like in the topologie view , they are disabled now! the model is arm26 2020-02-29_18-00-16

yasseerr commented 4 years ago

just some more polishing and the loading part is over. 2020-02-29_18-30-03

idhamari commented 4 years ago

Looks great, well done!

I will test it soon and provide a feedback.

yasseerr commented 4 years ago

thank you, but it is not ready for testing and if you want to test it change the path in vsMainWindow.cpp to your geometry folder OpenSim::ModelVisualizer::addDirToGeometrySearchPaths("F:/FL/3/opensim-gui/opensim-models/Geometry");

idhamari commented 4 years ago

Good to know!

I suggest:

yasseerr commented 4 years ago

ok, that will help to not set the path at each installation

idhamari commented 4 years ago

I also finds a few bugs related to compatibility with Linux. Please check them and consider them in your next commit (you can download the master branch as it is equivalent to this commit.

idhamari commented 4 years ago

@yasseerr there is something important to openGL.

Do you think it is possible to use an older VTK version that supports an older opengl? this will give a big advantage: our interface can run on older computers in addition to virtualbox.

yasseerr commented 4 years ago

what does the linux error say?
and for vtk what old version of vtk that support OpenGL, because we are using QvtkOpenGLWidget that should work and we are using new principles in vtk like smartPointers , so we will test this one on virtual box if it does not work we will try and use the old one if that is possible depending on the version

idhamari commented 4 years ago

what does the linux error say?

It is related to the file and class names you missed. Also sometimes you are using the class name when it is not needed. You can compare your branch with the master branch and check what changed.

For now, no need to worry about this. Please continue using the current version.
Unfortunately, VirtualBox supports only older versions of OpenGL.

yasseerr commented 4 years ago

we will work on it later but maybe you are right they do not use vtk because of backword compatibility that glu32 provide , ifound this on visualizer.h 2020-02-29_20-26-56 for the error try delete the build folder because a changed all the class names to vsNameName format

idhamari commented 4 years ago

Here is an example of the error:

in vsMainwindow.cpp you used vsMainWindow::vsMainWindow(QWidget *parent)

so changing the filename vsMainwindow.cpp to vsMainWindow.cpp fix the problem

There are some other similar problems so please use the fixed code from the master in your branch.

idhamari commented 4 years ago

We will continue using the new openGL for now as the hardware is getting better and the one we use is from last year. I also think virtualbox may updated their tool as well to support new openGL

yasseerr commented 4 years ago

hopefully.

idhamari commented 4 years ago

@yasseerr

I just tested it and it looks very good.

Screenshot from 2020-03-01 11-06-43

I had a problem in my system related to OpenGL but i fixed it. It appears when secure boot is enabled it disable unsigned nvidia driver. This can be solved by disabling secure boot or signing nvidia driver.

For the big joints point, you can change their size in the program so they appear smaller than the others. In the future, we can give them a different shape so they can be recognized easily.

There is still something missing: the two-way selection e.g. when you select something in the visualizer window, it should be selected in the navigator and vice versa. This is not part of the simbody-visualizer so you can find the implementation in the java interface.

yasseerr commented 4 years ago

good to know. for the big spheres. are you using the latest commit from visualizer-features branch because they are dealt with and muscles have been added. and for the features you mentioned it will be implemented as soon as we finish adding wrapObjects and frames ... to the scene 2020-03-01_16-31-11

idhamari commented 4 years ago

for the big spheres. are you using the latest commit from visualizer-features branch

I will wait until you use and test the updating in the master branch as it fixe a few linux bugs.

and for the features you mentioned it will be implemented as soon as we finish adding wrapObjects and frames ... to the scene

Ok. When everything is done we will have a skype meeting to discuss the progress and close this task.

yasseerr commented 4 years ago

@idhamari Hello! i think all the component are loaded in the screen , and the visualizer branch has been merged with the master ,you can check the execution on linux i just noticed that you added a folder for vsWorkSpace to store the geometries but the current solution will clone it directly to the executable_folder/vsWorkSpace

idhamari commented 4 years ago

@yasseerr excellent.

and the visualizer branch has been merged with the master ,you can check the execution on linux

Well done! there are still two errors:

 vsVisualizerVTK.h:24:31: error: extra qualification ‘vsVisualizerVTK::’ on member ‘renderGeometry’ [-fpermissive]      
      vtkSmartPointer<vtkActor> vsVisualizerVTK::renderGeometry(OpenSim::Geometry *geometry);

This can be fixed by using:

      vtkSmartPointer<vtkActor> renderGeometry(OpenSim::Geometry *geometry);

Please consider the same practice in future code.

 Gui/Modeling/vsContactForcesNode.cpp:2:10: fatal error: vsOneContactForceNode.h: No such file or directory  #include "vsOneContactForceNode.h"
      ^~~~~~~~~~~~~~~~~~~~~~~~~

This can be fixed by changing two filenames(notice the first letter in "Force"):

  vsOneContactforceNode.h and vsOneContactforceNode.cpp to 
  vsOneContactForceNode.h and vsOneContactForceNode.cpp
idhamari commented 4 years ago

Then merge with the master branch and close this issue.

yasseerr commented 4 years ago

errors fixed at commit https://github.com/VisSimKoblenz/opensimQt/commit/ffbd6ac4692427ea9f2a11343bbd01147f2dd706