LoginSignup
3

More than 5 years have passed since last update.

GoogleのCartographerをシミュレーターで使いたいだけの人生だった[失敗談]

Posted at

地図の生成が出来ないでござる...

結論から申しますと出来ませんでした。とはいえセンサーを買わないびんぼ..節約家の方(私を含め)が対処法を持ってくださっていると信じて、あるいは二の舞にならないよう失敗談をここに書き記します。

かなり素人考えの対処をしようとしてますがそこはご容赦ください。

もし、こうすれば出来るよ、出来たよとかあればコメントをください。

Cartographerとは?

Cartographerとはgoogleが公開したSLAM(Simultaneous Localization and Mapping)のライブラリであり、ROS(Robot Operating System)のサポートをしているとのことでこのようなビデオが公開されました。

IMAGE ALT TEXT HERE

人が通ったりしても惑わされることなく地図を生成し続けているなど多々高性能な点が見られますが、せっかくのオープンソースなので今回はこれをいじってみようというお話です。

インストール

以下のgithubそのまま

https://github.com/googlecartographer/cartographer_turtlebot/blob/master/docs/source/index.rst
rosdep initがいらないぐらいで特に問題は発生しませんでした。

# 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_turtlebot.rosinstall file and fetch code for dependencies.
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_turtlebot/master/cartographer_turtlebot.rosinstall
wstool update -t src

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

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

起動

デモの方は特に問題はなかったのでおそらく、depth camera(kinect)から地図を生成する処理をするであろうcartographer_turtlebotパッケージ内の turtlebot_depth_camera_2d.launchを使用してみました。

roslaunch cartographer_turtlebot turtlebot_depth_camera_2d.launch

まず、シミュレーター立ち上がらねえし!!launchファイル内を見れば一目瞭然ですが、gazebo_rosの起動処理は当然行われていません。

さて、以下から失敗談を書き記します。以下のことをしても 成功しません

対策の墓場

1.「そうだ、とりあえずシミュレーターをとりあえず立ち上げよう」

roslaunch cartographer_turtlebot turtlebot_depth_camera_2d.launch
roslaunch turtlebot_gazebo turtlebot_world.launch

cartographer側でnodeletが死にます。

ついでに

[ INFO] [1477885907.671105009]: No matching device found.... waiting for devices. Reason: std::__cxx11::string openni2_wrapper::OpenNI2Driver::resolveDeviceURI(const string&) @ /tmp/binarydeb/ros-kinetic-openni2-camera-0.2.7/src/openni2_driver.cpp @ 631 : Invalid device number 1, there are 0 devices connected.
[ WARN] [1477885907.801915093]: W1031 12:51:47.000000 11915 ordered_multi_queue.h:171] Queues waiting for data: (0, imu), (0, scan)

このエラー(?)が出続けます。
どうやらkinectのデバイスが認識できていないようです。
ちなみにこのエラーはopenni2.launchでも出たので、cartographer自体の問題ではなさそう。

2.「nodeletが死ぬのはまずい。cartographer側でGazeboを立ち上げよう。」

というわけで、turtoebot_depth_camera_2d.launchを以下のように変えました。

<!--
  Copyright 2016 The Cartographer Authors

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<launch>
  <include file="$(find turtlebot_bringup)/launch/3dsensor.launch" />
  <!-- We override the parameter here to remove the leading slash which should
       not be there according to tf2 naming rules. -->
  <param name="/depthimage_to_laserscan/output_frame_id"
      value="camera_depth_frame" />

  <include file="$(find cartographer_turtlebot)/launch/turtlebot.launch">
    <arg name="configuration_basename" value="turtlebot_depth_camera_2d.lua" />
  </include>

  <!-- change start -->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="use_sim_time" value="true"/>
    <arg name="debug" value="false"/>
    <arg name="gui" value="true" />
    <arg name="world_name" value="empty.world"/>
  </include>

  <node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model"
        args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -model turtlebot"/>

   <!-- change end-->
</launch>

roslaunch cartographer_turtlebot turtlebot_depth_camera_2d.launch

1と同じエラーを吐きづつけました。

1,2共通ですが、rvizを立ち上げて

Screenshot from 2016-10-31 13-12-13.png

Submapsを選択すると、

[ WARN] [1477887210.837024174, 269.122000000]: Could not compute submap fading: "map" passed to lookupTransform argument target_frame does not exist.

こんな感じの警告を吐きづつけます。

おそらくGlobal Statusの部分がエラー状態なので出てしまうと思われます。

Screenshot from 2016-10-31 13-19-31.png

Fixed Frame [map] does not existの部分です。

考察

警告からまず、cartographer側がセンサーを読み取れていない可能性が大であることと、全体のmapを生成ができていない感じです。

かなり基礎的なことですが、mapの生成の方法がわからず、mapの生成をとりあえず頑張ろうかと思いましたが時間が足りなくなったため、今後時間ができればやってみます。

そもそもの話、cartographerが実機を想定している感じでした。実機があればできるのでしょうか...?

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
3