2
$\begingroup$

I installed this framework and followed the instructions, but when I run it, I get the following error:

ros melodic ubuntu 18.04

... logging to /home/mobiiin/.ros/log/5a6f3b96-10a2-11ec-b5bc-1002b5cd5c12/roslaunch mobiiin-ubu-22317.log

Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://mobiiin-ubu:40883/

SUMMARY
========

PARAMETERS
 * /dxslam/config: realsense_d435.yaml
 * /dxslam/depth_topic: /camera/depth/image
 * /dxslam/feature_topic: camera/color/feat...
 * /dxslam/image_topic: /camera/rgb/image...
 * /dxslam/pub_tf_child_frame: 
 * /dxslam/pub_tf_parent_frame: map
 * /dxslam/reference_frame: vslam_origin
 * /dxslam/vocabulary: DXSLAM.fbow
 * /rosdistro: melodic
 * /rosversion: 1.14.11

NODES
  /
    dxslam (dxslam_ros/dxslam)
    map_vslam_tf (tf/static_transform_publisher)

auto-starting new master
process[master]: started with pid [22334]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 5a6f3b96-10a2-11ec-b5bc-1002b5cd5c12
process[rosout-1]: started with pid [22354]
started core service [/rosout]
process[map_vslam_tf-2]: started with pid [22365]
process[dxslam-3]: started with pid [22382]
File does not exist: DXSLAM.fbow
File does not exist: realsense_d435.yaml
Vocabulary: /home/mobiiin/git/dxslam/Vocabulary/DXSLAM.fbow
Config: /home/mobiiin/catkin_ws/src/dxslam_ros/config/realsense_d435.yaml
[dxslam-3] process has died [pid 22382, exit code -11, cmd /home/mobiiin/catkin_ws/devel/lib/dxslam_ros/dxslam __name:=dxslam __log:=/home/mobiiin/.ros/log/5a6f3b96-10a2-11ec-b5bc-1002b5cd5c12/dxslam-3.log].
log file: /home/mobiiin/.ros/log/5a6f3b96-10a2-11ec-b5bc-1002b5cd5c12/dxslam-3*.log

this is the file that fails while running. it doesn't go further than line 218.

and it has the correct path to vocabulary and yaml file

any help is appreciated

p.s.: there isn't any log file whatsoever, I don't know why it mentions the log file at the end

heres a part of the code where it reports it cant find the files then it goes forward: I think there's a possibility that this is not actually the issue

auto exist = [](std::string filename) {
    std::ifstream fs(filename);
    if (!fs.good()) std::cerr << "File does not exist: " << filename << std::endl;
    return fs.good();
};

auto directory = [](std::string path) {
    size_t pos = path.find_last_of("\\/");
    return (std::string::npos == pos) ? "" : path.substr(0, pos);
};

// find the specified filenames in the same folder of the default vocabulary/config
if (!exist(p_vocabulary_)) {
    p_vocabulary_ = directory(default_vocabulary) + "/" + p_vocabulary_;
    if (!exist(p_vocabulary_)) return false;
}
if (!exist(p_config_)) {
    p_config_ = directory(default_config) + '/' + p_config_;
    if (!exist(p_config_)) return false;
}

std::cout << "Vocabulary: " << p_vocabulary_ << "\n";
std::cout << "Config: " << p_config_ << "\n";

P.S: I've found that this line is the one causing the problem: could it be an opencv issue?

cv::FileStorage config_fs(p_config_.c_str(), cv::FileStorage::READ);
$\endgroup$
9
  • $\begingroup$ Welcome to Robotics, mobiiin. Did you catkin_make in the ~/catkin_ws directory? Did you source ~/catkin_ws/devel/setup.bash? There are two errors in there - File does not exist: DXSLAM.fbow and File does not exist: realsense_d435.yaml - have you checked that those files exist? $\endgroup$
    – Chuck
    Sep 8, 2021 at 14:01
  • $\begingroup$ thanks Chuck, yes I've catkin build and source the setup file. also yes the files exist in the exact directory mentioned with the same names. $\endgroup$
    – mobiiin
    Sep 8, 2021 at 17:28
  • $\begingroup$ @mobiiin The goal of this forum us to help you solve your problem. If you can provide enough information to reproduce your problem we can likely help you otherwise, we are just going to be guessing at what is going wrong. We can't see what's happening on your system and can only see the content that you have posted here. The more information that you can provide the more likely you are to get a useful answer. It's unlikely that the file doesn't exist if it's reporting that it doesn't exist. For example, it may have a different search path than you expect. $\endgroup$
    – Tully
    Sep 9, 2021 at 5:22
  • 1
    $\begingroup$ Since the error is deterministic and happens right on start, it should be simple enough to find out what's causing it by commenting out large sections of the code, recompiling, and re-running. GDB is very useful when dealing with segfaults, because as long as the code is built with debug info, you can get the precise line of the segfault. e.g if you think that line you mentioned is a problem, you can build the code with a hardcoded path (and nothing else) and see if it still segfaults. $\endgroup$
    – Alex
    Sep 9, 2021 at 8:20
  • 1
    $\begingroup$ Yes that would work. I would also make sure that is definitely the offending line. See wiki.ros.org/roslaunch/Tutorials/… for how to start the node using GDB (e.g. the second bullet point). Then once the segfault hits, you can type "bt" in gdb to see the backtrace. (sudo apt install gdb if you don't already have it). $\endgroup$
    – Alex
    Sep 9, 2021 at 8:41

1 Answer 1

2
$\begingroup$

turns out the problem was my opencv 4.2 interfering with opencv 3.2 which is installed by default through ros melodic.

After taking Alex's seggestion and installing GDB. I ran the launch file with GDB and it was in fact a segmentation fault. While tracing back the issue I saw couple of lines pointing to opencv3.2.so and others pointing to opencv4.2.so. after uninstalling the opencv and rebuilding the framework and ros package the issue got resolved. Thanks again to @Alex

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.