LoginSignup
7
13

More than 5 years have passed since last update.

Google Cartographer+Gazeboで地図をつくる

Last updated at Posted at 2017-05-02

目的

 googleがリリースした、ROSに対応している。SLAMライブラリCartographerをつかって、地図を作成する。
 ロボットなしでも動かすために、ROSのシミュレーション環境Gazeboを使用する。
 Fetchには、シミュレーション用のgazeboモデルと、Cartographerの設定ファイルが準備されていることから、Fetchのモデルを使用する。

1.シミュレーション環境の構築

 gazeboでの移動ロボットのシミュレーション環境を構築する。
 FetchのシミュレーションモデルにはSLAMに必要なセンサー:Lidarを含んでいる。

<参考>Fetch & Freight Manual:
http://docs.fetchrobotics.com/index.html
 
下記コマンドでインストールする。

$ sudo apt-get update
$ sudo apt-get install ros-indigo-fetch-gazebo-demo

下記コマンドでGazeboをたちあげて、ロボットが走行できることを確認する。
teleopのコンソールで、U/I/Oキーなどで走行させることができる。
gazeboは初回起動時にかなり時間がかかる。起動するまで、しばらく放っておく。(固まっているように見えるが起動中である。)

$ roslaunch fetch_gazebo simulation.launch
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py

2.cartographerのインストール

ここで、Fetch用のcartographerを、ドキュメントにしたがって、インストールする。
https://github.com/googlecartographer/cartographer_fetch/blob/master/docs/source/index.rst

# Install wstool and rosdep.
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build

# Create a new workspace in 'catkin_ws'.
mkdir catkin_ws
cd catkin_ws
wstool init src

# Merge the cartographer_fetch code for dependencies.
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_fetch/master/cartographer_fetch.rosinstall
wstool update -t src

# Install deb dependencies.
rosdep update
rosdep install --from-paths src --ignore-src -r --rosdistro=${ROS_DISTRO} -y

# Build and install.
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash

<参考>Cartographer ROS Integration:https://google-cartographer-ros.readthedocs.io/en/latest/

サンプルのROSBAGを実行して、動作することを確認する。

# Download the 2D example bag.
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/fetch/cartographer_freight_simulation_demo.bag

# Launch the 2D demo.
roslaunch cartographer_fetch demo.launch bag_filename:=${HOME}/Downloads/cartographer_freight_simulation_demo.bag

3.Gazeboでのシミュレーション

gazeboを起動

$ roslaunch fetch_gazebo simulation.launch

適当に、障害物をおいていく。障害物がないと、SLAMを実行することができない。
Screenshot from 2017-05-02 16:57:32.png

fetch用のCartographerを起動する。

$ roslaunch cartographer_fetch freight.launch

teleopとrvizを起動、U/I/Oキーなどで走行させながら地図ができていく様子を観察する。

$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
$ rosrun rviz rviz

Screenshot from 2017-05-02 16:55:27.png

参考

Real-Time Loop Closure in 2D LIDAR SLAM
https://research.google.com/pubs/pub45466.html

Ros wiki
http://wiki.ros.org/cartographer

7
13
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
7
13