tello-ros2 icon indicating copy to clipboard operation
tello-ros2 copied to clipboard

fail building ROS2 nodes for ORB_SLAM2

Open zoldaten opened this issue 2 years ago • 8 comments

hi! cant build nodes for ROS2 Foxy to use with ORB_SLAM2. did you build them from scratch or use docker image from https://github.com/alsora/ros2-ORB_SLAM2/tree/f890df18983ead8cd2ae36676036d535ee52951b ?

zoldaten avatar Dec 25 '22 10:12 zoldaten

ok. got it working - https://youtu.be/MaZRohrtnrQ built nodes from scratch using repo above and issues to it that means EXPORT...

zoldaten avatar Dec 25 '22 16:12 zoldaten

Hello

Sorry for my late reponse, Glad that you were able to figure it out.

Could you please provided updated intructions that could be integrated into the project readme?

Thanks a lot!

tentone avatar Dec 27 '22 16:12 tentone

i`ll try to sum up changes.

zoldaten avatar Dec 28 '22 11:12 zoldaten

i did almost everything from your README and a bit more ) ros2: sudo apt update && sudo apt install curl gnupg2 lsb-release 12 sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg 13 echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null 14 mkdir -p ~/ros2_galactic 15 cd ros2_galactic/ 16 wget https://github.com/ros2/ros2/releases/download/release-galactic-20221209/ros2-galactic-20221209-linux-focal-amd64.tar.bz2 17 ls 18 tar xf ros2-galactic-20221209-linux-focal-amd64.tar.bz2 19 mc 20 cd .. 21 sudo apt install ros-foxy-desktop python3-argcomplete 22 sudo rm /var/lib/apt/lists/lock 23 sudo rm /var/cache/apt/archives/lock 24 sudo rm /var/lib/dpkg/lock* 25 sudo dpkg --configure -a 26 sudo apt update 27 echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null 28 sudo apt install ros-foxy-desktop python3-argcomplete 29 sudo apt install ros-foxy-ros-base python3-argcomplete 30 sudo apt install ros-dev-tools 31 source /opt/ros/foxy/setup.bash 32 ros2 run demo_nodes_cpp talker 33 echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc 34 printenv | grep -i ROS 35 sudo rm -r ros2_galactic/ 36 printenv | grep -i ROS 37 mkdir -p ~/ros2_ws/src 38 cd ~/ros2_ws 39 cd src/ 40 cd .. 41 git clone https://github.com/ros2/examples src/examples -b foxy 42 colcon build --symlink-install 43 colcon test 44 . install/setup.bash

tello: git clone https://github.com/tentone/tello-ros2.git put part of ROS to ros2_ws/src 59 cd ros2_ws/ 60 colcon build --symlink-install 61 . install/setup.bash 62 cd src/ 63 ls 64 ros2 launch launch.py 65 pip3 install av 66 sudo apt install python3-pip 67 pip3 install av 68 ros2 launch launch.py 69 pip3 install djitellopy

the hard part was about ORB_SLAM2 as i use opencv4.2 installed trought apt (not build from source). git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2 271 cd ORB_SLAM2/ 272 chmod +x build.sh 273 ./build.sh 275 sed -i 's/++11/++14/g' CMakeLists.txt 1. need to add: #include <unistd.h> #include <stdio.h> #include <stdlib.h> to nano /home/al/ORB_SLAM2/src/LoopClosing.cc nano /home/al/ORB_SLAM2/src/Viewer.cc nano /home/al/ORB_SLAM2/src/System.cc nano /home/al/ORB_SLAM2/src/Tracking.cc nano /home/al/ORB_SLAM2/src/System.cc nano /home/al/ORB_SLAM2/src/LocalMapping.cc nano /home/al/ORB_SLAM2/Examples/Monocular/mono_kitti.cc nano /home/al/ORB_SLAM2/Examples/Stereo/stereo_kitti.cc nano /home/al/ORB_SLAM2/Examples/Monocular/mono_tum.cc nano /home/al/ORB_SLAM2/Examples/RGB-D/rgbd_tum.cc nano /home/al/ORB_SLAM2/Examples/Monocular/mono_euroc.cc nano /home/al/ORB_SLAM2/Examples/Stereo/stereo_euroc.cc 2. nano include/LoopClosing.h from Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose; to Eigen::aligned_allocator<std::pair<KeyFrame* const, g2o::Sim3> > > KeyFrameAndPose;

  1. changes concern opencv *https://github.com/raulmur/ORB_SLAM2/pull/790/commits/379c7633191b178b19a7c635b9df0fe370b05b6d

*https://github.com/ducha-aiki/pymagsac/issues/4?ysclid=lc343uv3gb984258163 sed -i 's/++11/++14/g' CMakeLists.txt and nano CMakeLists.txt

Then replace find_package(Eigen3 REQUIRED) to list(APPEND CMAKE_INCLUDE_PATH "/usr/local/include") find_package (Eigen3 3.3 REQUIRED NO_MODULE)

and find_package(OpenCV 4 QUIET)

put file path (ost.yaml) to nano /home/al/ros2_ws/build/tello/tello/node.py path: self.node.declare_parameter('camera_info_file', '') to self.node.declare_parameter('camera_info_file', '/home/al/ros2_ws/src/tello/resource/ost.yaml')

put the same parameters to ~/ORB_SLAM2/Examples/Monocular/TUM1.yaml

zoldaten avatar Dec 29 '22 10:12 zoldaten

I will compile these instructions into a .md file and place them in the repo ;)

Thanks a lot!

tentone avatar Dec 29 '22 18:12 tentone

find_package (Eigen3 3.3 REQUIRED NO_MODULE)

This, but I had to build a custom Eigen 3.3.X from source, then change it to: find_package (Eigen3 3.3.X EXACT REQUIRED NO_MODULE)

I am having difficulty finding the module after the fact for my ros2 node build. I didn't know if either of you had any insight :)

MizzouRobotics avatar Jan 15 '23 07:01 MizzouRobotics

Actually, I copied from the original source, I copied over the FindORB_SLAM2.cmake from the forked repo and it works. You both are saints

MizzouRobotics avatar Jan 16 '23 02:01 MizzouRobotics

Well im a bit late to help, thats great news 👍 thanks!

tentone avatar Jan 18 '23 10:01 tentone