cgre-aachen / open_AR_Sandbox

open-AR-Sandbox is a project to enable haptic interaction with geoscientific content in AR-Sandboxes.
GNU Lesser General Public License v3.0
63 stars 39 forks source link

Problems starting server #33

Closed erikx50 closed 3 years ago

erikx50 commented 3 years ago

Hi! I am trying to run open_AR_Sandbox on ubuntu with Kinect v1. I have calibrated the projector and sensor but when I start the sandbox_server it only shows two white pages. This is the output the console shows while trying to run the server:

2021-02-01 17:45:43,553 Starting Bokeh server version 2.2.3 (running on Tornado 6.0.4) 
2021-02-01 17:45:43,554 User authentication hooks NOT provided (default user enabled)
2021-02-01 17:45:43,556 Bokeh app running at: http://localhost:5006/sandbox_server
2021-02-01 17:45:43,556 Starting Bokeh server with process id: 2101
dependencies not found for KinectV2 to work. Check installation and try again
JSON configuration loaded for projector.
2021-02-01 17:45:44,401 Starting Bokeh server version 2.2.3 (running on Tornado 6.0.4)
2021-02-01 17:45:44,401 User authentication hooks NOT provided (default user enabled)
Launching server at http://localhost:35671
Projector initialized and server started.
Please position the browser window accordingly and enter fullscreen!
JSON configuration loaded for sensor.
/home/sandy/Desktop/ARSandbox/open_AR_Sandbox/sandbox/sensor/kinectV1.py:24: UserWarning: Two kernels cannot access the Kinect at the same time. This will lead to a sudden death of the kernel. Be sure no other kernel is running before you initialize a KinectV1 object.
  warn('Two kernels cannot access the Kinect at the same time. This will lead to a sudden death of the kernel. '
looking for kinect...
0
KinectV1 initialized.
/home/sandy/Desktop/ARSandbox/open_AR_Sandbox/sandbox/markers/aruco.py:48: UserWarning: Kinect version not supported
  warn("Kinect version not supported")
2021-02-01 17:45:44,904 Error running application handler <bokeh.application.handlers.script.ScriptHandler object at 0x7f31218ddd30>: 'ArucoMarkers' object has no attribute 'kinect'
File "aruco.py", line 103, in set_xy_correction:
if self.kinect == "dummy": Traceback (most recent call last):
  File "/home/sandy/anaconda3/lib/python3.8/site-packages/bokeh/application/handlers/code_runner.py", line 197, in run
    exec(self._code, module.__dict__)
  File "/home/sandy/Desktop/ARSandbox/open_AR_Sandbox/sandbox_server.py", line 14, in <module>
    aruco = MarkerDetection(sensor=sensor)
  File "/home/sandy/Desktop/ARSandbox/open_AR_Sandbox/sandbox/markers/markers_plotting.py", line 11, in __init__
    self.Aruco = ArucoMarkers(sensor=sensor, **kwargs)
  File "/home/sandy/Desktop/ARSandbox/open_AR_Sandbox/sandbox/markers/aruco.py", line 98, in __init__
    self.set_xy_correction(init_correction_x, init_correction_y)
  File "/home/sandy/Desktop/ARSandbox/open_AR_Sandbox/sandbox/markers/aruco.py", line 103, in set_xy_correction
    if self.kinect == "dummy":
AttributeError: 'ArucoMarkers' object has no attribute 'kinect'

What should i try to do to get the program up and running?

danielsk78 commented 3 years ago

Hi @erikx50, The problem comes from loading the Aruco markers with the kinect_v1. For the moment, Kinect V1 does not support the markers. Use Kinect V2 or use a dummy sensor to start a dummy Aruco class. I recommend you to see the tutorial 00_calib_arucos.ipynb for the Aruco use and skip until the section titled: Use ArUco dummy Class - For KinectV1 and DummySensor.

On the other hand, the script "sandbox_server.py", starts a sandbox server that is not entirely stable. We are working on this. For the moment, use the Jupyter notebooks and go through the tutorials. Finally, you may run all the modules using the notebook Run_Sandbox_allFunctionalitie.ipynb

I hope these general recommendations can get you started. Please let me know if this helps you.

erikx50 commented 3 years ago

Thank you for the quick answer @danielsk78. Fixed the aruco problem using a dummy sensor and managed to run the modules with Run_Sandbox_allFunctionalitie.ipynb.

I currently have a problem projecting the countour lines where the lines are not at the correct spot. When calibrating the sensor the margin patches only cover 1/4 of the sandbox. Also with the vertical calibration i cant seem to get the bottom of my sandbox colored red. The projector i am using also flickers alot when projecting the contour lines into the sandbox.

Lastly, should i start Jupyter notebook in the Anaconda enviroment?

danielsk78 commented 3 years ago

Hi @erikx50 We do recommend using an Anaconda environment with only the sandbox dependencies to avoid interference. Is the most comfortable option. Other ways have not been tested.

When is this flickering happening? Which module is loaded?

Is the sensor field-of-view covering the sandbox and extra margins? With the calibration notebook, the idea is to crop the margins of the depth image, so the frame is only getting the information from the sandbox surface. If this is not the case, try setting the sensor farther from the sandbox, so the image covers a broader range.

Remember to run the projector calibration notebook first, since this file is needed to calibrate the sensor.

erikx50 commented 3 years ago

Hi @danielsk78! The flickering happens when the contour module is loaded.

I will try to troubleshoot a little bit on monday. Will update you then.

danielsk78 commented 3 years ago

Hi @erikx50,

Is the flickering appearing when a warning rises: AttributeError: 'NoneType' object has no attribute 'dpi' ? (issue #3) Please check in the Jupyter Notebook or in the Command Line if this error appears every time the projector flickers.

erikx50 commented 3 years ago

Thats correct! Everytime it flickers that warning appears in the console.

danielsk78 commented 3 years ago

Hi @erikx50,

When you load another module (e.g. GempyModule, or TopoModule) this warning should disappear. But, until now, there is no ultimate solution for this [BUG].

So you have two options:

  1. Deactivate the contour labels. This should stop the warning to keep appearing and the flickering with it. You can use the widgets of the main thread to deactivate this, or the arguments when initializing the module.
  2. In the Projector class, there is a pause between each trigger of the frame to let matplotlib draw the figure (check issue #3 for a complete description). You could increase this waiting time by changing the variable self._target_time to a higher waiting (Default is 0.01 ms). Be careful with this because it may take too much time to plot the contour lines when the value is too high. My recommendation is to increase the variable by 0.005 until the flickering stops.

Example:

from sandbox.projector import Projector
from sandbox import _calibration_dir
_calibprojector = _calibration_dir + "my_projector_calibration.json"

projector = Projector(calibprojector=_calibprojector)

projector._target_time=0.015
...

Please let me know if this is useful. Or if you have some ideas that help solving this issue #3

erikx50 commented 3 years ago

Hi @danielsk78! Look like the flickering only happens when using the CmapModule.

I just received a kinect v2 and will try to set up the sandbox in windows.

erikx50 commented 3 years ago

No problems using kinect v2.