geturin / OAFD_Monocular

Master Thesis
MIT License
49 stars 8 forks source link

Encountered an error while executing 'catkin build' in orb_slam3_ros_wrapper #14

Open ZhangZhangZhangzzz opened 4 months ago

ZhangZhangZhangzzz commented 4 months ago

Hello author, I encountered an error while executing the catkin build. The error is as follows:

2024-07-04 13-09-53屏幕截图

This is the overall result. Below, I will take some screenshots of the main error messages, as follows:

  1. /usr/local/include/sophus/types.hpp:237:8: error: redefinition of default argument for ‘class’ 237 | struct IsFixedSizeVector : std::true_type {}; | ^~~~~
2./usr/local/include/sophus/rotation_matrix.hpp:16:18: error: redefinition of ‘template bool Sophus::isOrthogonal(const Eigen::MatrixBase&)’ 16 SOPHUS_FUNC bool isOrthogonal(Eigen::MatrixBase const& R) {

3.usr/local/include/sophus/rotation_matrix.hpp:32:18: error: redefinition of ‘template bool Sophus::isScaledOrthogonalAndPositive(const Eigen::MatrixBase&)’ 32 | SOPHUS_FUNC bool isScaledOrthogonalAndPositive(Eigen::MatrixBase const& sR) { | ^~~~~~~~~

4./usr/local/include/sophus/rotation_matrix.hpp:61:1: error: redefinition of ‘template Sophus::enable_if_t<std::is_floating_point::value, Eigen::Matrix<typename D::Scalar, D::RowsAtCompileTime, D::RowsAtCompileTime, (Eigen::AutoAlign | (((D::RowsAtCompileTime == 1) && (D::RowsAtCompileTime != 1)) ? Eigen::RowMajor : (((D::RowsAtCompileTime == 1) && (D::RowsAtCompileTime != 1)) ? Eigen::ColMajor : Eigen::ColMajor))), D::RowsAtCompileTime, D::RowsAtCompileTime> > Sophus::makeRotationMatrix(const Eigen::MatrixBase&)’ 61 | makeRotationMatrix(Eigen::MatrixBase const& R) { | ^~~~~~

5./usr/local/include/sophus/so2.hpp:17:7: error: redefinition of default argument for ‘int Options’ 17 | class SO2;

6./usr/local/include/sophus/so2.hpp:26:8: error: redefinition of ‘struct Eigen::internal::traits<Sophus::SO2<Scalar, Options> >’ 26 | struct traits<Sophus::SO2<Scalar, Options>> { | ^~~~~~~~~~

The above are some specific error messages that I have selected, but I have not finished selecting them yet. I personally think that there was an error in a certain step, but I don't know which step it was. I have already completed the compilation of ORB-SLAM3 before, and libORB-SLAM3.so also appeared. Just as I was continuing to work, this situation occurred. I would greatly appreciate it if you could see it

geturin commented 4 months ago

From the error message, it's hard to pinpoint the exact cause, but common issues with orb_slam3_ros_wrapper include:

1.Ensure your project is located in a catkin build workspace, as this is determined during workspace initialization and cannot be changed. I noticed your path is commonly used with catkin_ws/, so you might be mixing it with a catkin_make workspace.

2.This project uses ORB_SLAM3 V0.4. You need to follow the README, fetch the latest ORB_SLAM3 code from git, roll back to version 0.4, and then compile. Also, use my forked orb_slam3_ros_wrapper repository instead of the original one.

ZhangZhangZhangzzz commented 4 months ago

I'm very happy to receive your reply. I followed your advice and downloaded ORB_SLAM3 according to your "README" again. But contrary to expectations, I have been unable to complete the compilation of ORB_SLAM3.

2024-07-05 19-26-30屏幕截图

I noticed that your fork mentioned improvements about Ubuntu20.04, because I am also an Ubuntu20.04. Following the steps in the fork, I completed the compilation. But I noticed that there is a missing code "git reset --hard a80b4677009e673b9939a7e91e6ea7bcb5090294" for the ORB_SLAM3 structure in the fork. I learned that this code rolls ORB_SLAM3 back to V0.4. Do I need to do this step again in the fork? If it's not needed, then I've successfully completed the compilation. If it is still needed, then I have a problem that is difficult to solve

2024-07-05 19-32-41屏幕截图

geturin commented 4 months ago

You need to roll back the ORB_SLAM3 version to V0.4. The orb_slam3_ros_wrapper repository I forked is also an old version, corresponding to ORB_SLAM3 V0.4, which is why the rollback wasn't specifically mentioned. If you encounter compilation failures after rolling back to ORB_SLAM3 V0.4, it might be due to your OpenCV version being too new. You can find answers to this issue in other discussions.

Finally, if you find compiling the old version too troublesome, you can get the latest version of orb_slam3_ros_wrapper from the original repository to match the latest version of ORB_SLAM3. This is feasible as someone recently successfully reproduced the project using the latest versions. However, you will need to make some modifications to the latest version of orb_slam3_ros_wrapper. You will need to change the publish topic name and add a scaling factor for the coordinate system and point cloud publication, as shown in the commit below. https://github.com/geturin/orb_slam3_ros_wrapper/commit/4f1aaffa1c4eae9ad9680047bd867650f673989e

ZhangZhangZhangzzz commented 4 months ago

Hello, I recently completed the construction of the ORB-SLAM3 V0.4 version, but I encountered an error when executing orb_slam3_ros_wrapper. I checked my opencv version and eigen version, they are opencv4.2.0 and eigen3.3.7 respectively. All seem to meet the requirements. I suspected that my ORBSLAM3 was not installed properly, so I reinstalled it (making sure to roll back to v0.4) but it still didn't work. The orb_slam3_ros_wrapper package I use is this 2024-07-07 23-09-04屏幕截图 2024-07-07 23-10-43屏幕截图 2024-07-07 23-14-38屏幕截图

How should I troubleshoot the error?

geturin commented 4 months ago

here doesn’t seem to be any critical error information in the picture. However, it looks like the dependencies are not found at all, especially if the error occurs at the very beginning of the compilation. If your ORB_SLAM3 installation directory is not ‘~/ORB_SLAM3’, you need to modify the path in the CMakeLists.txt file. Then, ensure your workspace is a catkin build workspace.

If the error persists after confirming these two points, I have no other ideas. You might want to compile the latest versions of ORB_SLAM3 and orb_slam3_ros_wrapper and then modify some parts, as this could be faster.

ZhangZhangZhangzzz commented 4 months ago

I'm sure it's a catkin workspace, and the error doesn't happen in the first place, but starts to report after compiling for about 10 seconds. It seems faster to compile the latest versions of ORB_SLAM3 and orb_slam3_ros_wrapper. Because I have successfully compiled the latest versions of ORB_SLAM3 and orb_slam3_ros_wrapper before. Since I'm just a beginner and don't know what parts to change, you know it's best for newbies to follow the standard process as it is, so I deleted the latest version that had already been compiled and followed your tutorial again, it didn't seem like an easy path. I'm going to run it with the latest version now, and I'll probably have a lot more to ask you later, including how to modify certain files. Thank you for your answer! you help me a lot !

ZhangZhangZhangzzz commented 4 months ago

2024-07-08 20-22-10 的屏幕截图

2024-07-08 20-24-52 的屏幕截图

Hi, I would like to ask whether the downloaded things from this interface need to be placed somewhere for use. In addition, when I compiled MiDas with "./do_catkin_make.sh", the following error was displayed. How should I solve it? 2024-07-08 20-24-23 的屏幕截图

geturin commented 4 months ago

It looks like the issue is that the CUDA dependencies are not found in the environment. You need to install CUDA first, as it is essential for running almost any AI-related project.

ZhangZhangZhangzzz commented 4 months ago

Hi, I want to ask for the version of cuDNN. I notice your "README" in MiDas mentions LibTorch 1.7 and CUDA 11.0. I install cuDNN8.0.5 from the official website. But it failed.I tried to find the answer on the Internet, it seems to be related to the version 2024-07-10 17-13-06 的屏幕截图 2024-07-10 17-12-11 的屏幕截图 2024-07-10 17-13-48 的屏幕截图

ZhangZhangZhangzzz commented 3 months ago

您需要将 ORB_SLAM3 版本回滚到 V0.4。我 fork 的 orb_slam3_ros_wrapper 存储库也是一个旧版本,对应于 ORB_SLAM3 V0.4,这就是为什么没有特别提到回滚的原因。如果您在回滚到 ORB_SLAM3 V0.4 后遇到编译失败,则可能是由于您的 OpenCV 版本太新。您可以在其他讨论中找到有关此问题的答案。

最后,如果你觉得编译旧版本太麻烦,你可以从原始存储库获取最新版本的 orb_slam3_ros_wrapper,以匹配最新版本的 ORB_SLAM3。这是可行的,因为最近有人使用最新版本成功复现了该项目。但是,你需要对最新版本的 orb_slam3_ros_wrapper 进行一些修改。你需要更改发布主题名称,并为坐标系和点云发布添加缩放因子,如下面的提交所示。geturin /orb_slam3_ros_wrapper@ 4f1aaff

Hello, I have a few points of confusion about what you said "You can get the latest version of orb_slam3_ros_wrapper from the original repository and change the publish theme name and add a scaling factor for the coordinate system below and the point cloud publish". I found "forked from thien94/orb_slam3_ros_wrapper" in your fork repository. After clicking in, it is the ORB-SLAM3 corresponding to the V1.0 version. I don’t know if this is the latest version of orb_slam3_ros_wrapper you are talking about. I tried to modify common.cc according to the tips you gave, but found that the contents were almost inconsistent and difficult to modify. Not sure if I downloaded the wrong orb_slam3_ros_wrapper. Not sure if this is the latest version of orb_slam3_ros_wrapper. (However, when I made no changes, orb_slam3_ros_wrapper compiled normally. Does this mean I can continue without making any changes you mentioned?) common.zip 2024-08-09 15-45-05 的屏幕截图

geturin commented 3 months ago

It's normal for the code to look different since the original author, thien94, almost completely restructured the codebase in the v1.0 version. My previous commit was provided just as a reference.

To add a scaling factor, you need to define a factor (ideally retrieved from a topic or a launch file, though I didn't do this at the time). Apply this factor to the x, y, and z axes when publishing the coordinate frame, PoseStamped, and point clouds to ROS. This modification is crucial for the system's functionality but doesn't affect the compilation.

If you're uncomfortable modifying C++ files, you can write Python scripts to adjust the xyz values after they've been published to ROS, and then republish them to a different topic.