MATLAB Answers

Lidar Labeler Rosbag Loading Error (Ubuntu 20.04): Could not locate the base directory for ros.

6 views (last 30 days)
Daniel He
Daniel He on 6 Apr 2021
Commented: Daniel He on 9 Apr 2021
Hello everyone,
I try to make use of the Rosbag loading feature (https://de.mathworks.com/help/lidar/ref/lidar.labeler.loading.rosbagsource-class.html). I selected Import > Add Point Cloud and then switched to Rosbag and the loading error appeared.
I have installed the Matlab ROS Toolbox and I have installed ROS noetic
env | grep ROS
ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/opt/ros/noetic/share
ROSLISP_PACKAGE_DIRECTORIES=
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_MASTER_URI=http://localhost:11311
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic
and I have sourced ROS
source /opt/ros/noetic/setup.bash
Why does this loading error still appear?
Thanks in advance

Accepted Answer

Cam Salzberger
Cam Salzberger on 6 Apr 2021
Hello Daniel,
Does the error occur if you try to load the rosbag data outside of the Lidar Labeler?
bag = rosbag(filePath);
msgs = readMessages(bag, 1); % Testing with just the first message to start, try more if it works
If the error occurs, my suspicion is that you are seeing a library conflict between the ROS MATLAB libraries and the installed ROS libraries and their dependencies. MATLAB uses ROS Melodic, while you have ROS Noetic installed, so there will be a fair number of different library versions.
Try starting MATLAB without having sourced ROS Noetic and without pointing towards the installed Noetic folders. You may have to double-check your PATH and LD_LIBRARY_PATH environment variables to make sure that no "noetic" folders are still present before starting MATLAB.
It would be helpful to see exact error messages too, at least to make it easier for other users to find this post.
-Cam
  1 Comment
Daniel He
Daniel He on 9 Apr 2021
Hello Cam,
This is really embarassing, but it turns out that I just didn't have my ROS Toolbox installed (even I though I very sure I checked the Box to install the it)
Your answer would have been still helpful, because I figured my mistake out through testing with a similar script from a friend
Thank you for you answer
Daniel

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!