Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail building ROS2 nodes for ORB_SLAM2 #7

Open
zoldaten opened this issue Dec 25, 2022 · 8 comments
Open

fail building ROS2 nodes for ORB_SLAM2 #7

zoldaten opened this issue Dec 25, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@zoldaten
Copy link

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
Copy link
Author

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

@tentone
Copy link
Owner

tentone commented Dec 27, 2022

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 tentone added the enhancement New feature or request label Dec 27, 2022
@zoldaten
Copy link
Author

i`ll try to sum up changes.

@zoldaten
Copy link
Author

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
    *raulmur/ORB_SLAM2@379c763

*ducha-aiki/pymagsac#4
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

@tentone
Copy link
Owner

tentone commented Dec 29, 2022

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

Thanks a lot!

@MizzouRobotics
Copy link

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
Copy link

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

@tentone
Copy link
Owner

tentone commented Jan 18, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants