Create ROS workspace:
mkdir -p ~/oakd_ws/src
Include following lines in ~/.bashrc:
source /opt/ros/noetic/setup.bash
source ~/cartographer_ws/install_isolated/setup.bash
source ~/oakd_ws/devel/setup.bash
cd ~/oakd_ws/src
git clone --recursive https://github.com/DaniGarciaLopez/oakd_mapper.git
Install Google Cartographer from source
In order to build Cartographer ROS, we recommend using wstool
and rosdep
. For faster builds, we also recommend using Ninja
.
On Ubuntu Focal with ROS Noetic use these commands to install the above tools:
sudo apt-get update
sudo apt-get install -y python3-wstool python3-rosdep ninja-build stow
After the tools are installed, create a new cartographer_ros workspace in 'cartographer_ws'.
cd ~
mkdir cartographer_ws
cd cartographer_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
Now you need to install cartographer_ros
dependencies.
First, we use rosdep
to install the required packages.
The command 'sudo rosdep init' will print an error if you have already executed it since installing ROS. This error can be ignored.
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
Cartographer uses the abseil-cpp
_ library that needs to be manually installed using this script:
src/cartographer/scripts/install_abseil.sh
Due to conflicting versions you might need to uninstall the ROS abseil-cpp using
sudo apt-get remove ros-${ROS_DISTRO}-abseil-cpp
Build and install.
catkin_make_isolated --install --use-ninja
sudo apt-get install ros-noetic-pointcloud-to-laserscan
The following script will install depthai-core and update usb rules and install depthai devices:
sudo wget -qO- https://raw.githubusercontent.com/luxonis/depthai-ros/noetic-devel/install_dependencis.sh | bash
If you don't have rosdep installed and not initialized please execute the following steps:
sudo apt install python3-rosdep
orsudo apt install python-rosdep2
(melodic)sudo rosdep init
rosdep update
Install the following vcstool:
sudo apt install python3-vcstool
The following setup procedure assumes you have cmake version >= 3.10.2 and OpenCV version >= 4.0.0
cd ~
git clone --recursive https://github.com/luxonis/depthai-core.git --branch develop
cd ~/depthai-core
mkdir build
cd build
cmake .. -D BUILD_SHARED_LIBS=ON
cmake --build . --parallel --config Release --target install
cd ~/oakd_ws
catkin_make --cmake-args -D depthai_DIR=~/depthai-core/build/install/lib/cmake/depthai
rosbag play rgb.bag -r 0.5
rosrun rviz rviz -d ~/oakd_ws/src/oakd_mapper/oakd_mapper/rviz/camera_rgb.rviz
rosbag play --loop stereo.bag --rate 0.5
rosrun rviz rviz -d ~/oakd_ws/src/oakd_mapper/oakd_mapper/rviz/camera_stereo.rviz
rosbag play stereo.bag --loop stereo.bag --rate 0.5 --topics /stereo_publisher/left/image /stereo_publisher/right/image /stereo_publisher/left/camera_info /stereo_publisher/right/camera_info /stereo_publisher/stereo/camera_info /stereo_publisher/stereo/depth
roslaunch oakd_mapper stereo_nodelet_rosbag.launch
roslaunch oakd_mapper stereo_rgb_nodelet.launch
roslaunch depthai_examples rgb_stereo_node.launch
roslaunch depthai_examples stereo_node.launch
rosbag record -e "(.*)stereo_publisher(.*)" "(.*)tf_static" "(.*)nodelet_manager/bond"
roslaunch rtabmap_ros rtabmap.launch \
rtabmap_args:="--delete_db_on_start" \
rgb_topic:=/stereo_publisher/color/image \
depth_topic:=/stereo_publisher/stereo/depth \
camera_info_topic:=/stereo_publisher/stereo/camera_info \
frame_id:=/base_link \
approx_sync:=false