WPI-AIM / ambf

Asynchronous Multi-Body Framework
163 stars 65 forks source link

AMBF simulator window shuts down upon boot (ambf-2.0 branch) #187

Closed melodysu83 closed 2 years ago

melodysu83 commented 2 years ago

Hi Adnan,

Sorry for opening another issue so quickly, but I have a quick question. I have not made modifications to any file after a fresh pull from the ambf-2.0 branch. Upon successfully building the code and sourcing the setup.bash file, I ran into the "JOINT NOT IMPLEMENTED YET" error message whenever I import a multibody object (that contains joints) to the ambf_simulator.

The following is the output I get when typing the bare minimum command: ./ambf_simulator (similar errors show up when I try importing raven or dvrk using the -l flag)

GLFW VERSION: 3.2.1 X11 GLX EGL clock_gettime /dev/js
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/launch.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./world/world.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./input_devices/input_devices.yaml", ADF version not defined thus assuming VERSION_1_0
INFO! INITIALIZING ROS NODE HANDLE
INFO! Thread Joined: Plane
INFO! Thread Joined: light1
INFO! Thread Joined: light2
INFO! Thread Joined: default_camera
INFO! Thread Joined: World
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./multi-bodies/robots/blender-toy-car2.yaml", ADF version not defined thus assuming VERSION_1_0
INFO! Thread Joined: Chassis
INFO! Thread Joined: ShockBL
INFO! Thread Joined: WheelBR
INFO! Thread Joined: ShockBR
INFO! Thread Joined: WheelBL
INFO! Thread Joined: ShockFL
INFO! Thread Joined: WheelFR
INFO! Thread Joined: ShockFR
INFO! Thread Joined: WheelFL
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockBL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockBL-WheelBR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockBR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockBR-WheelBL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockFL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockFL-WheelFR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockFR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockFR-WheelFL OF TYPE: JOINT NOT IMPLEMENTED YET
Segmentation fault (core dumped)

I feel like I must have missed something. Do you have any suggestions? Thanks a lot!

PS1: There were similar error messages as posed in prior Issues #155 and #159, but the solutions didn't seem to apply in my case.

PS2: I also noticed the warning messages that says "ADF version not defined thus assuming VERSION_1_0". Is that anticipated? Or, should I specify the ADF version in the yaml files somehow. Thanks!

adnanmunawar commented 2 years ago

Hi Melody,

Please don't apologize for creating new issues, as a matter of fact, thank you for contributing this way.

The message "ERROR! COMMUNICATION TYPE FOR OBJECT NAMED <name> OF TYPE: JOINT NOT IMPLEMENTED YET" is really a warning, so don't worry about it. I shall change the word "ERROR" to "WARNING" to put people's minds at ease.

The second warning "ADF version not defined thus assuming VERSION_1_0" is also a warning that you can ignore.

The core infrastructure of AMBF-2.0 is entirely different (better) than AMBF-1.0 and these warnings (/ errors) are part of that.

For this comment:

PS1: There were similar error messages as posed in prior Issues https://github.com/WPI-AIM/ambf/issues/155 and https://github.com/WPI-AIM/ambf/issues/159, but the solutions didn't seem to apply in my case.

Can you elaborate on what exactly is the issue as these two issues seem to be unrelated? Please feel free to open a new issue, or reopen the existing issues.

melodysu83 commented 2 years ago

Thanks for the quick reply! It’s great knowing we can ignore the joint type error message and ADF version warning. In this case, I think the main problem I’m encountering is that after I type in the command: ./ambf_simulator the program and simulator window shuts itself down right after booting up.

The two previous issues #155 and #159 were ones that I found to have mentioned the same error message, but I see now that those messages are probably not the cause of the simulator shutting down immediately upon starting.

Thanks again! Let me know if there’s anything you suggest that I try.

adnanmunawar commented 2 years ago

No problem. Are you running the ambf_simulator with any arguments? Also, can you please provide the output of running ./ambf_simulator in the terminal?

melodysu83 commented 2 years ago

I am not running it with any arguments. Here are the outputs I get on the terminal:

____________________________________________________________

ASYNCHRONOUS MULTI-BODY FRAMEWORK SIMULATOR (AMBF Simulator)

        (http://practicepoint.wpi.edu)
          (Copyright 2019-2021)
____________________________________________________________

STARTUP COMMAND LINE OPTIONS: 

ambf_simulator Command Line Options:
  -h [ --help ]                        Show help
  -n [ --ndevs ] arg (=0)              Number of Haptic Devices to Load
  -i [ --load_devices ] arg            Index number of devices to load which is
                                       specified in input_device.yaml
  -e [ --enableforces ] arg (=0)       Enable Force Feedback on Haptic Devices
  -p [ --phx_frequency ] arg (=1000)   Physics Update Frequency (default: 1000 
                                       Hz)
  -d [ --htx_frequency ] arg (=1000)   Haptics Update Frequency (default: 1000 
                                       Hz)
  -t [ --fixed_phx_timestep ] arg (=0) Use Fixed Time-Step for Physics 
                                       (default: False)
  -f [ --fixed_htx_timestep ] arg (=0) Use Fixed Time-Step for Haptics 
                                       (default: False)
  --override_max_comm_freq arg         Override the maximum publishing 
                                       frequency for all afObjects (default: 
                                       1000 Hz)
  --override_min_comm_freq arg         Override the minimum publishing 
                                       frequency for all afObjects (default: 50
                                       Hz)
  -g [ --show_gui ] arg (=1)           Show GUI
  --ns arg                             Global namespace prefix for ROS 
                                       Communication
  -s [ --sim_speed_factor ] arg (=1)   Override the speed of "NON REAL-TIME" 
                                       simulation by a specified factor 
                                       (Default 1.0)
  - [ --plugins ] arg                  Simulator plugins to load, .e.g. 
                                       --plugins <plugin1_filepath>, 
                                       <plugin2_filepath> loads plugin1 and 
                                       plugin2 simualtor plugin
  --launch_file arg                    Launch file path to load (default: 
                                       <ROOT_PATH>/ambf_models/descriptions/lau
                                       nch.yaml
  -a [ --load_multibody_files ] arg    Description Filenames of Multi-Body(ies)
                                       to Launch, .e.g. -a <path>/test.yaml, 
                                       <another_path>/test2.yaml will load 
                                       multibodies test.yaml and test2.yaml if 
                                       they are valid files
  -l [ --load_multibodies ] arg        Index of Multi-Body(ies) to Launch, 
                                       .e.g. -l 1,2,3 will load multibodies at 
                                       indexes 1,2,3. See launch.yaml file

------------------------------------------------------------

GLFW VERSION: 3.2.1 X11 GLX EGL clock_gettime /dev/js
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/launch.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./world/world.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./input_devices/input_devices.yaml", ADF version not defined thus assuming VERSION_1_0
INFO! INITIALIZING ROS NODE HANDLE
INFO! Thread Joined: Plane
INFO! Thread Joined: light1
INFO! Thread Joined: light2
INFO! Thread Joined: default_camera
INFO! Thread Joined: World
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./multi-bodies/robots/blender-toy-car2.yaml", ADF version not defined thus assuming VERSION_1_0
INFO! Thread Joined: Chassis
INFO! Thread Joined: ShockBL
INFO! Thread Joined: WheelBR
INFO! Thread Joined: ShockBR
INFO! Thread Joined: WheelBL
INFO! Thread Joined: ShockFL
INFO! Thread Joined: WheelFR
INFO! Thread Joined: ShockFR
INFO! Thread Joined: WheelFL
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockBL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockBL-WheelBR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockBR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockBR-WheelBL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockFL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockFL-WheelFR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockFR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockFR-WheelFL OF TYPE: JOINT NOT IMPLEMENTED YET
Segmentation fault (core dumped)

Also here is a quick video showing what I'm seeing (with the simulator window shutting down upon boot). In the video, I also tried loading specific robots with the -l flag, and a similar problem occurred. https://youtu.be/D1mwX_Uw-3s Thank you!

adnanmunawar commented 2 years ago

Thanks for the video, and I can see that it's a segfault. We shall need to compile AMBF in debug mode and run it via debugger. Can you please try the following steps.

Install gdb(GNU Debugger) if not already installed. You would probably need sudo permissions

sudo apt install gdb

Then build AMBF in debug mode. Assuming that AMBF is located in the home ~/ folder.

cd ~/ambf
mkdir build-debug && cd build-debug
cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j4

After a successful build, head over to the bin-debug folder in AMBF. This folder is created when AMBF is built in Debug mode.

cd ~/ambf/bin-debug/lin-x86_64
gdb ./ambf_simulator

This would launch the gdb console with ambf_simulator. You can then enter different commands to step through the code. We shall be just running it by entering run and pressing ENTER. It should crash and when it does, could you please copy the output and paste it here.

We might also want to try checking the stack trace with valgrind. You can install that by

sudo apt install valgrind

And then run ambf_simulator as

cd ~/ambf/bin-debug/lin-x86_64
valgrind ./ambf_simulator

Valgrind may produce a lot of output but I would be interested in the last part where AMBF crashes.

melodysu83 commented 2 years ago

Hi Adnan, Thanks for the tips! I tried what you suggested and here is the output I get from gdb. Specifically, when I typed "r" to run the program, the simulator window popped up; there were nothing displayed on it, but it also didn't shut off on its own. Then to proceed with the program, I typed "c", that's when it shows the last three lines of outputs and shuts down the simulator window.

imero@IMeRo-1:~/Simulator/ambf/bin-debug/lin-x86_64$ gdb ./ambf_simulator
GNU gdb (Ubuntu 8.2-0ubuntu1~16.04.1) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./ambf_simulator...done.
(gdb) r
Starting program: /home/imero/Simulator/ambf/bin-debug/lin-x86_64/ambf_simulator 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

____________________________________________________________

ASYNCHRONOUS MULTI-BODY FRAMEWORK SIMULATOR (AMBF Simulator)

        (http://practicepoint.wpi.edu)
          (Copyright 2019-2021)
____________________________________________________________

STARTUP COMMAND LINE OPTIONS: 

ambf_simulator Command Line Options:
  -h [ --help ]                        Show help
  -n [ --ndevs ] arg (=0)              Number of Haptic Devices to Load
  -i [ --load_devices ] arg            Index number of devices to load which is
                                       specified in input_device.yaml
  -e [ --enableforces ] arg (=0)       Enable Force Feedback on Haptic Devices
  -p [ --phx_frequency ] arg (=1000)   Physics Update Frequency (default: 1000 
                                       Hz)
  -d [ --htx_frequency ] arg (=1000)   Haptics Update Frequency (default: 1000 
                                       Hz)
  -t [ --fixed_phx_timestep ] arg (=0) Use Fixed Time-Step for Physics 
                                       (default: False)
  -f [ --fixed_htx_timestep ] arg (=0) Use Fixed Time-Step for Haptics 
                                       (default: False)
  --override_max_comm_freq arg         Override the maximum publishing 
                                       frequency for all afObjects (default: 
                                       1000 Hz)
  --override_min_comm_freq arg         Override the minimum publishing 
                                       frequency for all afObjects (default: 50
                                       Hz)
  -g [ --show_gui ] arg (=1)           Show GUI
  --ns arg                             Global namespace prefix for ROS 
                                       Communication
  -s [ --sim_speed_factor ] arg (=1)   Override the speed of "NON REAL-TIME" 
                                       simulation by a specified factor 
                                       (Default 1.0)
  - [ --plugins ] arg                  Simulator plugins to load, .e.g. 
                                       --plugins <plugin1_filepath>, 
                                       <plugin2_filepath> loads plugin1 and 
                                       plugin2 simualtor plugin
  --launch_file arg                    Launch file path to load (default: 
                                       <ROOT_PATH>/ambf_models/descriptions/lau
                                       nch.yaml
  -a [ --load_multibody_files ] arg    Description Filenames of Multi-Body(ies)
                                       to Launch, .e.g. -a <path>/test.yaml, 
                                       <another_path>/test2.yaml will load 
                                       multibodies test.yaml and test2.yaml if 
                                       they are valid files
  -l [ --load_multibodies ] arg        Index of Multi-Body(ies) to Launch, 
                                       .e.g. -l 1,2,3 will load multibodies at 
                                       indexes 1,2,3. See launch.yaml file

------------------------------------------------------------

GLFW VERSION: 3.2.1 X11 GLX EGL clock_gettime /dev/js
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/launch.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./world/world.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./input_devices/input_devices.yaml", ADF version not defined thus assuming VERSION_1_0
[New Thread 0x7fffe4377700 (LWP 28277)]
[New Thread 0x7fffdbb76700 (LWP 28278)]
[New Thread 0x7fffe3b76700 (LWP 28279)]
[New Thread 0x7fffe3375700 (LWP 28284)]
INFO! INITIALIZING ROS NODE HANDLE
[New Thread 0x7fffe2b74700 (LWP 28292)]
INFO! Thread Joined: Plane
[New Thread 0x7fffe2373700 (LWP 28300)]
INFO! Thread Joined: light1
[New Thread 0x7fffe1b72700 (LWP 28308)]
INFO! Thread Joined: light2
[New Thread 0x7fffda8df700 (LWP 28309)]
[New Thread 0x7fffda0de700 (LWP 28310)]
[New Thread 0x7fffd98dd700 (LWP 28311)]
[New Thread 0x7fffd90dc700 (LWP 28312)]
[New Thread 0x7fffd88db700 (LWP 28313)]
[New Thread 0x7fffc7fff700 (LWP 28314)]
[New Thread 0x7fffc77fe700 (LWP 28315)]
[New Thread 0x7fffc6ffd700 (LWP 28316)]
[New Thread 0x7fffc67fc700 (LWP 28324)]
INFO! Thread Joined: default_camera
[New Thread 0x7fffc5ffb700 (LWP 28344)]
INFO! Thread Joined: World
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./multi-bodies/robots/blender-toy-car2.yaml", ADF version not defined thus assuming VERSION_1_0
[New Thread 0x7fffc57fa700 (LWP 28352)]
INFO! Thread Joined: Chassis
[New Thread 0x7fffc4ff9700 (LWP 28360)]
INFO! Thread Joined: ShockBL
[New Thread 0x7fffbffff700 (LWP 28368)]
INFO! Thread Joined: WheelBR
[New Thread 0x7fffbf7fe700 (LWP 28376)]
INFO! Thread Joined: ShockBR
[New Thread 0x7fffbeffd700 (LWP 28384)]
INFO! Thread Joined: WheelBL
[New Thread 0x7fffbe7fc700 (LWP 28392)]
INFO! Thread Joined: ShockFL
[New Thread 0x7fffbdffb700 (LWP 28400)]
INFO! Thread Joined: WheelFR
[New Thread 0x7fffbd7fa700 (LWP 28408)]
INFO! Thread Joined: ShockFR
[New Thread 0x7fffbcff9700 (LWP 28416)]
INFO! Thread Joined: WheelFL
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockBL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockBL-WheelBR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockBR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockBR-WheelBL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockFL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockFL-WheelFR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockFR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockFR-WheelFL OF TYPE: JOINT NOT IMPLEMENTED YET
[New Thread 0x7fffbc7f8700 (LWP 28417)]

Thread 1 "ambf_simulator" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) c
Continuing.

[2]+  Stopped                 gdb ./ambf_simulator

And these are outputs from valgrind:

imero@IMeRo-1:~/Simulator/ambf/bin-debug/lin-x86_64$ valgrind ./ambf_simulator
==28499== Memcheck, a memory error detector
==28499== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==28499== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==28499== Command: ./ambf_simulator
==28499== 

____________________________________________________________

ASYNCHRONOUS MULTI-BODY FRAMEWORK SIMULATOR (AMBF Simulator)

        (http://practicepoint.wpi.edu)
          (Copyright 2019-2021)
____________________________________________________________

STARTUP COMMAND LINE OPTIONS: 

ambf_simulator Command Line Options:
  -h [ --help ]                        Show help
  -n [ --ndevs ] arg (=0)              Number of Haptic Devices to Load
  -i [ --load_devices ] arg            Index number of devices to load which is
                                       specified in input_device.yaml
  -e [ --enableforces ] arg (=0)       Enable Force Feedback on Haptic Devices
  -p [ --phx_frequency ] arg (=1000)   Physics Update Frequency (default: 1000 
                                       Hz)
  -d [ --htx_frequency ] arg (=1000)   Haptics Update Frequency (default: 1000 
                                       Hz)
  -t [ --fixed_phx_timestep ] arg (=0) Use Fixed Time-Step for Physics 
                                       (default: False)
  -f [ --fixed_htx_timestep ] arg (=0) Use Fixed Time-Step for Haptics 
                                       (default: False)
  --override_max_comm_freq arg         Override the maximum publishing 
                                       frequency for all afObjects (default: 
                                       1000 Hz)
  --override_min_comm_freq arg         Override the minimum publishing 
                                       frequency for all afObjects (default: 50
                                       Hz)
  -g [ --show_gui ] arg (=1)           Show GUI
  --ns arg                             Global namespace prefix for ROS 
                                       Communication
  -s [ --sim_speed_factor ] arg (=1)   Override the speed of "NON REAL-TIME" 
                                       simulation by a specified factor 
                                       (Default 1.0)
  - [ --plugins ] arg                  Simulator plugins to load, .e.g. 
                                       --plugins <plugin1_filepath>, 
                                       <plugin2_filepath> loads plugin1 and 
                                       plugin2 simualtor plugin
  --launch_file arg                    Launch file path to load (default: 
                                       <ROOT_PATH>/ambf_models/descriptions/lau
                                       nch.yaml
  -a [ --load_multibody_files ] arg    Description Filenames of Multi-Body(ies)
                                       to Launch, .e.g. -a <path>/test.yaml, 
                                       <another_path>/test2.yaml will load 
                                       multibodies test.yaml and test2.yaml if 
                                       they are valid files
  -l [ --load_multibodies ] arg        Index of Multi-Body(ies) to Launch, 
                                       .e.g. -l 1,2,3 will load multibodies at 
                                       indexes 1,2,3. See launch.yaml file

------------------------------------------------------------

GLFW VERSION: 3.2.1 X11 GLX EGL clock_gettime /dev/js
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/launch.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./world/world.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./input_devices/input_devices.yaml", ADF version not defined thus assuming VERSION_1_0
==28499== Conditional jump or move depends on uninitialised value(s)
==28499==    at 0x4C3548F: strstr (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28499==    by 0x7F16A0: chai3d::cOBJModel::parseFaceString(char*, chai3d::cFace*, chai3d::cVector3d const*, chai3d::cVector3d const*, chai3d::cVector3d const*, unsigned int, int) (CFileModelOBJ.cpp:1138)
==28499==    by 0x7F0F30: chai3d::cOBJModel::LoadModel(char const*) (CFileModelOBJ.cpp:888)
==28499==    by 0x7EB3D6: chai3d::cLoadFileOBJ(chai3d::cMultiMesh*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CFileModelOBJ.cpp:89)
==28499==    by 0x7E2D35: chai3d::cMultiMesh::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (CMultiMesh.cpp:1650)
==28499==    by 0x6E7DC4: ambf::afVisualUtils::createFromAttribs(ambf::afVisualAttributes*, chai3d::cMultiMesh*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (afFramework.cpp:510)
==28499==    by 0x6F082F: ambf::afRigidBody::createFromAttribs(ambf::afRigidBodyAttributes*) (afFramework.cpp:2463)
==28499==    by 0x710387: ambf::afModel::createFromAttribs(ambf::afModelAttributes*) (afFramework.cpp:7967)
==28499==    by 0x705D4A: ambf::afWorld::createFromAttribs(ambf::afWorldAttributes*) (afFramework.cpp:6197)
==28499==    by 0x6A44F4: main (ambf_simulator.cpp:423)
==28499== 
==28499== Conditional jump or move depends on uninitialised value(s)
==28499==    at 0x7EBA9D: chai3d::cLoadFileOBJ(chai3d::cMultiMesh*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (CFileModelOBJ.cpp:179)
==28499==    by 0x7E2D35: chai3d::cMultiMesh::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (CMultiMesh.cpp:1650)
==28499==    by 0x6E7DC4: ambf::afVisualUtils::createFromAttribs(ambf::afVisualAttributes*, chai3d::cMultiMesh*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (afFramework.cpp:510)
==28499==    by 0x6F082F: ambf::afRigidBody::createFromAttribs(ambf::afRigidBodyAttributes*) (afFramework.cpp:2463)
==28499==    by 0x710387: ambf::afModel::createFromAttribs(ambf::afModelAttributes*) (afFramework.cpp:7967)
==28499==    by 0x705D4A: ambf::afWorld::createFromAttribs(ambf::afWorldAttributes*) (afFramework.cpp:6197)
==28499==    by 0x6A44F4: main (ambf_simulator.cpp:423)
==28499== 
INFO! INITIALIZING ROS NODE HANDLE
INFO! Thread Joined: Plane
INFO! Thread Joined: light1
INFO! Thread Joined: light2
INFO! Thread Joined: default_camera
INFO! Thread Joined: World
WARNING! For File "/home/imero/Simulator/ambf/ambf_models/descriptions/./multi-bodies/robots/blender-toy-car2.yaml", ADF version not defined thus assuming VERSION_1_0
==28499== Conditional jump or move depends on uninitialised value(s)
==28499==    at 0x966A07: void btSetMax<double>(double&, double const&) (btMinMax.h:50)
==28499==    by 0x9668E2: btVector3::setMax(btVector3 const&) (btVector3.h:619)
==28499==    by 0x96BA7B: bt_quantize_clamp(unsigned short*, btVector3 const&, btVector3 const&, btVector3 const&, btVector3 const&) (btQuantization.h:56)
==28499==    by 0x96BDC8: btQuantizedBvhTree::setNodeBound(int, btAABB const&) (btGImpactQuantizedBvh.h:114)
==28499==    by 0x969690: btQuantizedBvhTree::_build_sub_tree(GIM_BVH_DATA_ARRAY&, int, int) (btGImpactQuantizedBvh.cpp:204)
==28499==    by 0x9697B1: btQuantizedBvhTree::build_tree(GIM_BVH_DATA_ARRAY&) (btGImpactQuantizedBvh.cpp:225)
==28499==    by 0x969B45: btGImpactQuantizedBvh::buildSet() (btGImpactQuantizedBvh.cpp:282)
==28499==    by 0x725438: btGImpactShapeInterface::calcLocalAABB() (btGImpactShape.h:88)
==28499==    by 0x725635: btGImpactShapeInterface::updateBound() (btGImpactShape.h:118)
==28499==    by 0x975E44: btGImpactMeshShape::calcLocalAABB() (btGImpactShape.h:864)
==28499==    by 0x725635: btGImpactShapeInterface::updateBound() (btGImpactShape.h:118)
==28499==    by 0x6E6D19: ambf::afShapeUtils::createCollisionShape(chai3d::cMultiMesh const*, double, ambf::afTransform, afCollisionMeshShapeType) (afFramework.cpp:360)
==28499== 
==28499== Conditional jump or move depends on uninitialised value(s)
==28499==    at 0x966A3E: void btSetMin<double>(double&, double const&) (btMinMax.h:41)
==28499==    by 0x966960: btVector3::setMin(btVector3 const&) (btVector3.h:636)
==28499==    by 0x96BA91: bt_quantize_clamp(unsigned short*, btVector3 const&, btVector3 const&, btVector3 const&, btVector3 const&) (btQuantization.h:57)
==28499==    by 0x96BDC8: btQuantizedBvhTree::setNodeBound(int, btAABB const&) (btGImpactQuantizedBvh.h:114)
==28499==    by 0x969690: btQuantizedBvhTree::_build_sub_tree(GIM_BVH_DATA_ARRAY&, int, int) (btGImpactQuantizedBvh.cpp:204)
==28499==    by 0x9697B1: btQuantizedBvhTree::build_tree(GIM_BVH_DATA_ARRAY&) (btGImpactQuantizedBvh.cpp:225)
==28499==    by 0x969B45: btGImpactQuantizedBvh::buildSet() (btGImpactQuantizedBvh.cpp:282)
==28499==    by 0x725438: btGImpactShapeInterface::calcLocalAABB() (btGImpactShape.h:88)
==28499==    by 0x725635: btGImpactShapeInterface::updateBound() (btGImpactShape.h:118)
==28499==    by 0x975E44: btGImpactMeshShape::calcLocalAABB() (btGImpactShape.h:864)
==28499==    by 0x725635: btGImpactShapeInterface::updateBound() (btGImpactShape.h:118)
==28499==    by 0x6E6D19: ambf::afShapeUtils::createCollisionShape(chai3d::cMultiMesh const*, double, ambf::afTransform, afCollisionMeshShapeType) (afFramework.cpp:360)
==28499== 
==28499== Conditional jump or move depends on uninitialised value(s)
==28499==    at 0x966A07: void btSetMax<double>(double&, double const&) (btMinMax.h:50)
==28499==    by 0x9668E2: btVector3::setMax(btVector3 const&) (btVector3.h:619)
==28499==    by 0x96BA7B: bt_quantize_clamp(unsigned short*, btVector3 const&, btVector3 const&, btVector3 const&, btVector3 const&) (btQuantization.h:56)
==28499==    by 0x96BE15: btQuantizedBvhTree::setNodeBound(int, btAABB const&) (btGImpactQuantizedBvh.h:120)
==28499==    by 0x969690: btQuantizedBvhTree::_build_sub_tree(GIM_BVH_DATA_ARRAY&, int, int) (btGImpactQuantizedBvh.cpp:204)
==28499==    by 0x9697B1: btQuantizedBvhTree::build_tree(GIM_BVH_DATA_ARRAY&) (btGImpactQuantizedBvh.cpp:225)
==28499==    by 0x969B45: btGImpactQuantizedBvh::buildSet() (btGImpactQuantizedBvh.cpp:282)
==28499==    by 0x725438: btGImpactShapeInterface::calcLocalAABB() (btGImpactShape.h:88)
==28499==    by 0x725635: btGImpactShapeInterface::updateBound() (btGImpactShape.h:118)
==28499==    by 0x975E44: btGImpactMeshShape::calcLocalAABB() (btGImpactShape.h:864)
==28499==    by 0x725635: btGImpactShapeInterface::updateBound() (btGImpactShape.h:118)
==28499==    by 0x6E6D19: ambf::afShapeUtils::createCollisionShape(chai3d::cMultiMesh const*, double, ambf::afTransform, afCollisionMeshShapeType) (afFramework.cpp:360)
==28499== 
==28499== Conditional jump or move depends on uninitialised value(s)
==28499==    at 0x966A3E: void btSetMin<double>(double&, double const&) (btMinMax.h:41)
==28499==    by 0x966960: btVector3::setMin(btVector3 const&) (btVector3.h:636)
==28499==    by 0x96BA91: bt_quantize_clamp(unsigned short*, btVector3 const&, btVector3 const&, btVector3 const&, btVector3 const&) (btQuantization.h:57)
==28499==    by 0x96BE15: btQuantizedBvhTree::setNodeBound(int, btAABB const&) (btGImpactQuantizedBvh.h:120)
==28499==    by 0x969690: btQuantizedBvhTree::_build_sub_tree(GIM_BVH_DATA_ARRAY&, int, int) (btGImpactQuantizedBvh.cpp:204)
==28499==    by 0x9697B1: btQuantizedBvhTree::build_tree(GIM_BVH_DATA_ARRAY&) (btGImpactQuantizedBvh.cpp:225)
==28499==    by 0x969B45: btGImpactQuantizedBvh::buildSet() (btGImpactQuantizedBvh.cpp:282)
==28499==    by 0x725438: btGImpactShapeInterface::calcLocalAABB() (btGImpactShape.h:88)
==28499==    by 0x725635: btGImpactShapeInterface::updateBound() (btGImpactShape.h:118)
==28499==    by 0x975E44: btGImpactMeshShape::calcLocalAABB() (btGImpactShape.h:864)
==28499==    by 0x725635: btGImpactShapeInterface::updateBound() (btGImpactShape.h:118)
==28499==    by 0x6E6D19: ambf::afShapeUtils::createCollisionShape(chai3d::cMultiMesh const*, double, ambf::afTransform, afCollisionMeshShapeType) (afFramework.cpp:360)
==28499== 
INFO! Thread Joined: Chassis
INFO! Thread Joined: ShockBL
INFO! Thread Joined: WheelBR
INFO! Thread Joined: ShockBR
INFO! Thread Joined: WheelBL
INFO! Thread Joined: ShockFL
INFO! Thread Joined: WheelFR
INFO! Thread Joined: ShockFR
INFO! Thread Joined: WheelFL
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockBL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockBL-WheelBR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockBR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockBR-WheelBL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockFL OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockFL-WheelFR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Chassis-ShockFR OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED ShockFR-WheelFL OF TYPE: JOINT NOT IMPLEMENTED YET
==28499== Jump to the invalid address stated on the next line
==28499==    at 0x0: ???
==28499==    by 0x833CA3: chai3d::cLabel::render(chai3d::cRenderOptions&) (CLabel.cpp:123)
==28499==    by 0x7B5CB4: chai3d::cGenericObject::renderSceneGraph(chai3d::cRenderOptions&) (CGenericObject.cpp:2380)
==28499==    by 0x7B5EC3: chai3d::cGenericObject::renderSceneGraph(chai3d::cRenderOptions&) (CGenericObject.cpp:2465)
==28499==    by 0x812D20: chai3d::cCamera::renderLayer(chai3d::cGenericObject*, int, int) (CCamera.cpp:1870)
==28499==    by 0x8128B0: chai3d::cCamera::renderView(int, int, chai3d::cEyeMode, bool) (CCamera.cpp:1691)
==28499==    by 0x70D45D: ambf::afCamera::render(ambf::afRenderOptions&) (afFramework.cpp:7433)
==28499==    by 0x7066C8: ambf::afWorld::render(ambf::afRenderOptions&) (afFramework.cpp:6288)
==28499==    by 0x6A5AAF: updateGraphics() (ambf_simulator.cpp:582)
==28499==    by 0x6A5043: main (ambf_simulator.cpp:543)
==28499==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==28499== 
==28499== 
==28499== Process terminating with default action of signal 11 (SIGSEGV)
==28499==  Bad permissions for mapped region at address 0x0
==28499==    at 0x0: ???
==28499==    by 0x833CA3: chai3d::cLabel::render(chai3d::cRenderOptions&) (CLabel.cpp:123)
==28499==    by 0x7B5CB4: chai3d::cGenericObject::renderSceneGraph(chai3d::cRenderOptions&) (CGenericObject.cpp:2380)
==28499==    by 0x7B5EC3: chai3d::cGenericObject::renderSceneGraph(chai3d::cRenderOptions&) (CGenericObject.cpp:2465)
==28499==    by 0x812D20: chai3d::cCamera::renderLayer(chai3d::cGenericObject*, int, int) (CCamera.cpp:1870)
==28499==    by 0x8128B0: chai3d::cCamera::renderView(int, int, chai3d::cEyeMode, bool) (CCamera.cpp:1691)
==28499==    by 0x70D45D: ambf::afCamera::render(ambf::afRenderOptions&) (afFramework.cpp:7433)
==28499==    by 0x7066C8: ambf::afWorld::render(ambf::afRenderOptions&) (afFramework.cpp:6288)
==28499==    by 0x6A5AAF: updateGraphics() (ambf_simulator.cpp:582)
==28499==    by 0x6A5043: main (ambf_simulator.cpp:543)
==28499== 
==28499== HEAP SUMMARY:
==28499==     in use at exit: 150,709,097 bytes in 8,160 blocks
==28499==   total heap usage: 246,566 allocs, 238,406 frees, 231,460,817 bytes allocated
==28499== 
==28499== LEAK SUMMARY:
==28499==    definitely lost: 1,404 bytes in 8 blocks
==28499==    indirectly lost: 221 bytes in 5 blocks
==28499==      possibly lost: 7,849,892 bytes in 1,170 blocks
==28499==    still reachable: 142,857,580 bytes in 6,977 blocks
==28499==                       of which reachable via heuristic:
==28499==                         stdstring          : 20,568 bytes in 397 blocks
==28499==         suppressed: 0 bytes in 0 blocks
==28499== Rerun with --leak-check=full to see details of leaked memory
==28499== 
==28499== For counts of detected and suppressed errors, rerun with: -v
==28499== Use --track-origins=yes to see where uninitialised values come from
==28499== ERROR SUMMARY: 3559 errors from 7 contexts (suppressed: 0 from 0)
Killed

Finally, the following link shows a quick video demo: in case it helps :) https://youtu.be/OwgHHtEviBw Thanks for helping!!

adnanmunawar commented 2 years ago

Awesome, great to have the valgrind output. Can you test something, if you modify this line https://github.com/WPI-AIM/ambf/blob/ambf-2.0/ambf_simulator/src/ambf_simulator.cpp#L343 and change:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);

to

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);

and then recompile AMBF. Does it still crash?

melodysu83 commented 2 years ago

Wow that fixed it! Thank you so much. Is it because of my laptop having an older version of OpenGL?

adnanmunawar commented 2 years ago

Happy to hear that. It is probably not an issue with the OpenGL version itself as version 3.3 and greater have be supported on machines from many years ago.While reading the output from valgrind from your comment, I quickly realized that I accidentally pushed the line glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3) to remote. The rendering methods need to be fixed/updated to work with the newer version of GLFW on all systems. I have not seen it crash on 20.04 but I suppose you are using 18.04, is that correct?

melodysu83 commented 2 years ago

Ah, I see! Yes, the computers in my lab are all 18.04, but I'm currently using my ancient 16.04 laptop. I've renamed the issue title so it's not misleading and will close the comment now. Thanks again for all your help.