zang09 / ORB_SLAM3_ROS2

ROS2 wrapping package for orbslam3 library
183 stars 65 forks source link

colcon build failed undefined reference to `DUtils::Random::SeedRandOnce()' #15

Open spectra543 opened 11 months ago

spectra543 commented 11 months ago

Hi guy i try to colcon build ORB_SLAM3_ROS2 after i run this line "colcon build --symlink-install --packages-select orbslam3" this error happens.

dtuil

i use ros2 foxy opencv 4.2.0 ubuntu 20.04 anyone know how to fix thankyou!

mjunsen123 commented 2 months ago
  1. Go to ORB_SLAM3/Thirdparty/DBoW2/CMakeLists.txt
  2. Change line add_library(DBoW2 SHARED ${SRCS_DBOW2} ${SRCS_DUTILS}) to add_library(DBoW2 STATIC ${SRCS_DBOW2} ${SRCS_DUTILS}) and,
  3. add line set_property(TARGET DBoW2 PROPERTY POSITION_INDEPENDENT_CODE ON)
  4. Go to ORB_SLAM3/CMakeLists.txt
  5. Replace ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so with ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.a
  6. Rebuild

Hope this help!

1melek commented 1 month ago

i have the same issue , i tried doing your method and it still didn't work

mjunsen123 commented 1 month ago

i have the same issue , i tried doing your method and it still didn't work

Have you rebuild ORBSLAM3 as well? Do you have .a file in Thirdparty/DBoW2/lib/libDBoW2.a after rebuild?

1melek commented 1 month ago

well no i will try to rebuild it now

1melek commented 1 month ago

okay that worked ! but now the build failed again..

Screenshot from 2024-05-14 12-20-23

can you help?

mjunsen123 commented 1 month ago

okay that worked ! but now the build failed again..

Screenshot from 2024-05-14 12-20-23

can you help?

Your OpenCV version in ROS is different with the one in your machine. I assume you have build cvbridge, edit the file CMakeList.txt in CVBridge to force it to use OpenCV 4.9.

1melek commented 1 month ago

no i haven't build CVBbridge .. should i? i don't even know what and where it is .

mjunsen123 commented 1 month ago

Okay if it is the case i suggest you downgrade your opencv in your ubuntu to 4.2. I belive that would be the most straightforward solution

1melek commented 1 month ago

the thing is , i have opencv 4.2 and i have no idea where 4.9 is coming from 11

mjunsen123 commented 1 month ago

Have you build with source before?

1melek commented 1 month ago

I figured that and it build successfully but now when i run it i can't see anything in the camera and I don’t know from where it get camera input , like it always says “1 camera in the atlas” even when i deactivated the laptop camera and no usb cam

andremaurell commented 6 days ago

@mjunsen123 Good tutorial my friend, but, can you help-me? after the changes at CMake and generate .a file, I received that error:

image

mjunsen123 commented 6 days ago

Never see this error before. Can you please confirm you have CVBridge (vision_opencv) installed?

andremaurell commented 6 days ago

I think yes:

image

mjunsen123 commented 6 days ago

And can you confirm that you have same version of OpenCV in both your ROS and Ubuntu?

andremaurell commented 6 days ago

i don't know how I can see on ROS, but on ubuntu is 4.5.4

mjunsen123 commented 6 days ago

I am not sure but I think it may due to different version of openCV in Ros and Ubuntu. I am aware of this but I am not sure if this is your case. What I did is I build opencv and cvbridge from source, so I can specific the version used in ORBSLAM3

andremaurell commented 5 days ago

Yeah, I think is the same version, but I'm not sure about that. Do you have same tutorial showing how I can make this build?