LCSR-SICKKIDS / volumetric_drilling

Virtual reality for synergistic surgical training and data generation. (MICCAI 2021 AE-CAI Best Paper)
21 stars 18 forks source link

ERROR! FAILED TO INITIALIZE GLFW LIBRARY #10

Open Lionhk11 opened 2 years ago

Lionhk11 commented 2 years ago

Hi, I'm new to everything here, but I am trying to get the drilling simulator working. I am working with Ubuntu 18.04.5 with a WSL on windows 10. At first I cloned and built AMBF 2.0 as suggested in step 1.1. Then I downloaded ROS melodic. I added ros setup.bash to my bash profile. I then installed cv-bridge and image-transport. I installed libasound2-dev from the provided link. Then I cloned and built the simulator as suggested in step 1.2. Then I launched the program with the following code:

$ cd ambf/bin/lin-x86_64/  
$ ./ambf_simulator --launch_file ~/volumetric_drilling/launch.yaml -l 0,3,4 

And I got the following error:

ERROR! FAILED TO INITIALIZE GLFW LIBRARY

I tried looking for a solution for the error but nothing I did worked. I hope you can help me with this!

mli0603 commented 2 years ago

Hi @Lionhk11

The installation README for AMBF missed sudo apt install libgl1-mesa-dev xorg-dev. Have you tried this?

Lionhk11 commented 2 years ago

Hi, I just tried it, but I'm still getting the same error message.

adnanmunawar commented 2 years ago

Hello, I would suggest using a docker container with visualization tools installed in it. Luckily, we have one for AMBF here (https://github.com/collaborative-robotics/docker-ambf). Once you have the base container set up and can visualize the Linux desktop using VNC, you can just skip to step 1.2 from this ReadMe. -Adnan

Lionhk11 commented 2 years ago

Hello, Thank you for your response. I did get the simulation to work using the method you suggested. I am still getting some warnings and errors though. When I launch the simulation, this is what I see: https://imgur.com/a/3kukJPX

WARNING! For File "/home/ubuntu/volumetric_drilling/launch.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/ubuntu/volumetric_drilling/ADF/world/world.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/ubuntu/volumetric_drilling/ADF/input_devices/input_devices.yaml", ADF version not defined thus assuming VERSION_1_0
INFO! INITIALIZING ROS NODE HANDLE
INFO! Thread Joined: light1
INFO! Thread Joined: light2
INFO! Thread Joined: main_camera
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY CameraFrame" FOUND. PLEASE SPECIFY FURTHER
INFO! Thread Joined: World
WARNING! For File "/home/ubuntu/volumetric_drilling/ADF/drill.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/ubuntu/volumetric_drilling/ADF/volume_512.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/ubuntu/volumetric_drilling/ADF/segmentation_camera.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/ubuntu/volumetric_drilling/ADF/stereo_cameras.yaml", ADF version not defined thus assuming VERSION_1_0
INFO! FOR OBJECT: mastoidectomy_drill, LOADING SHADER TYPE OBJECT_SHADERS FROM FILES: 
     VERTEX: /home/ubuntu/volumetric_drilling/ADF/./shaders/matcap/shader.vs
     FRAGMENT: /home/ubuntu/volumetric_drilling/ADF/./shaders/matcap/shader.fs
INFO! Thread Joined: mastoidectomy_drill
shader compilation failed:
0:129(7): error: illegal use of reserved word `half'
0:129(7): error: syntax error, unexpected ERROR_TOK, expecting ',' or ';'

shader compilation failed:
0:129(7): error: illegal use of reserved word `half'
0:129(7): error: syntax error, unexpected ERROR_TOK, expecting ',' or ';'
INFO! FOR OBJECT: mastoidectomy_volume_high, LOADING SHADER TYPE VOLUME FROM FILES: 
     VERTEX: /home/ubuntu/volumetric_drilling/ADF/./shaders/volume/shader.vs
     FRAGMENT: /home/ubuntu/volumetric_drilling/ADF/./shaders/volume/shader.fs
INFO! CAMERA "segmentation_camera" SET TO INVISIBLE. THEREFORE IT IS ONLY VIEWABLE VIA ITS IMAGE / DEPTH TOPICS IF THOSE ARE SET TO TRUE
INFO! FOR OBJECT: /ambf/env/cameras/segmentation_camera, LOADING SHADER TYPE FRAMEBUFFER_PREPROCESSING FROM FILES: 
     VERTEX: /home/ubuntu/volumetric_drilling/ADF/./shaders/preprocessing/shader.vs
     FRAGMENT: /home/ubuntu/volumetric_drilling/ADF/./shaders/preprocessing/shader.fs
INFO! USING INTERNALLY DEFINED DEPTH_COMPUTE SHADERS
INFO! Thread Joined: segmentation_camera
INFO! CAMERA "stereoR" SET TO INVISIBLE. THEREFORE IT IS ONLY VIEWABLE VIA ITS IMAGE / DEPTH TOPICS IF THOSE ARE SET TO TRUE
INFO! Thread Joined: stereoR
INFO! CAMERA "stereoL" SET TO INVISIBLE. THEREFORE IT IS ONLY VIEWABLE VIA ITS IMAGE / DEPTH TOPICS IF THOSE ARE SET TO TRUE
INFO! Thread Joined: stereoL
INFO! GOT CAMERA: main_camera
WARNING! CAN'T FIND ANY OBJECTS NAMED: "cameraL" IN GLOBAL MAP 
Existing OBJECTS in Map: 4
/ambf/env/cameras/main_camera
/ambf/env/cameras/segmentation_camera
/ambf/env/cameras/stereoL
/ambf/env/cameras/stereoR
WARNING! CAN'T FIND ANY OBJECTS NAMED: "cameraR" IN GLOBAL MAP 
Existing OBJECTS in Map: 4
/ambf/env/cameras/main_camera
/ambf/env/cameras/segmentation_camera
/ambf/env/cameras/stereoL
/ambf/env/cameras/stereoR
Found Lib: libdvrk_arm.so
No of dVRK Masters detected: 0
SUCCESFULLY LOADED MATCAP TEXTURE
SUCCESFULLY LOADED MATCAP2 TEXTURE
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
FAILED TO LOAD DRILL AUDIO FROM /home/ubuntu/volumetric_drilling/resources/sounds/drill.wav
Gripper Rotation w.r.t World Frame:
Gripper Rotation w.r.t World Frame:
Toggling visibility of Sensors:
Toggling visibility of Actuators:
INFO! ENABLE VOLUME SMOOTHING: 1

Also, I didn't plugin the VR headset or the Haptic Touch device yet when testing the simulation. I also see that the compilation of the shaders failed. Could that be part of the problem why I'm getting the picture I attached instead of a 3d model?

adnanmunawar commented 2 years ago

Hmm, thanks for sharing the image. I would expect the volume to be completed blackened out since its shader failed to compile. Can you try changing the name of the variable 'half' and all its references to something else in this file and see if that changes anything.

Lionhk11 commented 2 years ago

Thank you for your help! I changed the variable 'half' and it worked! I am running against another problem though this time with getting the phantom omni haptic device to work. When I run the simulator I get the following:

WARNING! For File "/home/murab/volumetric_drilling/launch.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/murab/volumetric_drilling/ADF/world/world.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/murab/volumetric_drilling/ADF/input_devices/input_devices.yaml", ADF version not defined thus assuming VERSION_1_0
INFO! INITIALIZING ROS NODE HANDLE
INFO! Thread Joined: light1
INFO! Thread Joined: light2
INFO! Thread Joined: main_camera
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY CameraFrame" FOUND. PLEASE SPECIFY FURTHER
INFO! Thread Joined: World
WARNING! For File "/home/murab/volumetric_drilling/ADF/drill.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/murab/volumetric_drilling/ADF/volume_512.yaml", ADF version not defined thus assuming VERSION_1_0
INFO! FOR OBJECT: mastoidectomy_drill, LOADING SHADER TYPE OBJECT_SHADERS FROM FILES: 
     VERTEX: /home/murab/volumetric_drilling/ADF/./shaders/matcap/shader.vs
     FRAGMENT: /home/murab/volumetric_drilling/ADF/./shaders/matcap/shader.fs
INFO! Thread Joined: mastoidectomy_drill
INFO! FOR OBJECT: mastoidectomy_volume_high, LOADING SHADER TYPE VOLUME FROM FILES: 
     VERTEX: /home/murab/volumetric_drilling/ADF/./shaders/volume/shader.vs
     FRAGMENT: /home/murab/volumetric_drilling/ADF/./shaders/volume/shader.fs
INFO! GOT CAMERA: main_camera
WARNING! CAN'T FIND ANY OBJECTS NAMED: "cameraL" IN GLOBAL MAP 
Existing OBJECTS in Map: 1
/ambf/env/cameras/main_camera
WARNING! CAN'T FIND ANY OBJECTS NAMED: "cameraR" IN GLOBAL MAP 
Existing OBJECTS in Map: 1
/ambf/env/cameras/main_camera
*** CPhantomDevices: libhdPhantom.so: cannot open shared object file: No such file or directory
Found Lib: libdvrk_arm.so
No of dVRK Masters detected: 0
SUCCESFULLY LOADED MATCAP TEXTURE
SUCCESFULLY LOADED MATCAP2 TEXTURE

I see the following error above with trying to connect the haptic device:

*** CPhantomDevices: libhdPhantom.so: cannot open shared object file: No such file or directory

I tried changing 'libhdPhantom.so' to 'libPhantomIOLib42.so' in the CPhantomDevices.cpp file (that's what the .so file was called in the driver installation file and I saw somewhere that this solved the problem for someone else) , but it still gave me the same message. I hope you can help me with this.

adnanmunawar commented 2 years ago

Are you using the Phantom Omni or Geomagic Touch? If Phantom Omni and you can ensure that you can run it separately on your system, then please do the following.

Remove your local changes to the src files.

Then

cd ambf/external/chai3d/extras/hdPhantom/
sudo linux-installation.sh

then please rebuild AMBF.

Lionhk11 commented 2 years ago

Thank you for your help. I am using the Touch Phantom Omni. I was able to run it separately on my system. I also got it to connect to the simulation now, but I ran against the problem that it's only registering rotation of the stylus but not the translation. It didn't give me any errors so I'm not entirely sure why it's not registering translation. Here is a video of how it looks like: https://vimeo.com/715247208

adnanmunawar commented 2 years ago

Hello, just getting back to this after a busy few weeks. Can you try pressing (and holding down) one of the buttons while moving the device and checking if it allows the simulated drill to move?

Lionhk11 commented 2 years ago

Hello, I have tried pressing and holding the buttons. That did not do anything unforutnately.