LoginSignup
5
2

More than 1 year has passed since last update.

ROS Noeticにcartographer_rosをインストールするメモ

Last updated at Posted at 2022-09-16

はじめに

ROS Noeticに公式ドキュメント通りにcartographerをインストールしようとしたらエラーが出たのでインストール方法のメモ

インストール

sudo apt-get update
sudo apt-get install -y python3-wstool python3-rosdep ninja-build stow
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
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y

ここで以下のようなエラーが出る

ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
cartographer: [libabsl-dev] defined as "not available" for OS version [focal]

解決方法

vim ./src/cartographer/package.xml 

/src/cartographer/package.xml を編集して46行目の libabsl-dev の行をコメントアウトまたは削除する

/src/cartographer/package.xml
  <depend>libboost-iostreams-dev</depend>
  <depend>eigen</depend>
  <!--depend>libabsl-dev</depend-->
  <depend>libcairo2-dev</depend>

再度実行
あとはドキュメント通りビルドするだけ

rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
src/cartographer/scripts/install_abseil.sh
catkin_make_isolated --install --use-ninja

おわりに

Melodicだとapt install でcartographer_rosがインストールできるらしい(ROS2も同様)

またcatkin buildでbuildしたい方はこちらを参照

おまけ

Dockerfile内でcartographerをインストールするコマンド
sedコマンドでファイルを編集して46行目を削除

Dockerfile
# Install Cartographer
RUN mkdir -p /root/cartographer_ws/src
RUN apt-get update && apt-get install -y python3-wstool python3-rosdep ninja-build stow
RUN cd /root/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 
RUN rosdep init && rosdep update 
RUN cd /root/cartographer_ws && sed -i '46d' /root/cartographer_ws/src/cartographer/package.xml && rosdep install --from-paths src --ignore-src --rosdistro=noetic -y
RUN cd /root/cartographer_ws && src/cartographer/scripts/install_abseil.sh 
RUN /bin/bash -c "cd /root/cartographer_ws &&  source /opt/ros/noetic/setup.bash &&  catkin_make_isolated --install --use-ninja -DPYTHON_EXECUTABLE=/usr/bin/python3"

参考

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2