RaspberryPi 3B+ (UbuntuMate16.04LTS, ROS kinetic) でintel Realsense D435を使いYolo v3 を動かそうと思いましたが動かせませんでした

# 目的
RaspberryPi 3B+ (UbuntuMate16.04LTS, ROS kinetic) でintel Realsense D435を使いYolo v3 を動かそうと思いましたが動かせませんでした。備忘録です。

※ Jetson nano + intel Realsense D435を使いYolo v3を動かす予定。
※ RaspberryPi 3B+はUSB3.0ポートがないため後述の手順では動かせなかったようにみえます。
※ USB2.0でも使う方法はあるようですが調べきれませんでした。

# 準備

[RaspberryPi 3B+](https://www.amazon.co.jp/dp/B07R7M7N3P/ref=cm_sw_r_tw_dp_U_x_UUXmDbDMTYSA8)

RaspberryPi 3B+には UbuntuMate16.04LTS をインストールします。
> [Raspberry Pi 3B+(Ubuntu Mate 16.04LTS)にROS kinetic をインストールしてturtlesimを動かす](https://qiita.com/seigot/items/ce88174c1123400fc2a4)

[intel Realsense D435](https://www.amazon.co.jp/dp/B07BLS5477/ref=cm_sw_r_tw_dp_U_x_STXmDb8PW4CAJ)

# Realsense-ros Package インストール手順

```
wget https://github.com/IntelRealSense/realsense-ros/archive/2.2.7.zip
unzip 2.2.7.zip 
mv realsense-ros-2.2.7 ~/catkin_ws/src/.
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
```

# テスト

下記の通りlaunchを試みましたがエラーが出て動かすところまで辿り着けませんでした。

```
roslaunch darknet_ros darknet_ros.launch 
```

```
[ WARN] [1563639319.428796012]: Frame metadata isn't available! (frame_timestamp_domain = RS2_TIMESTAMP_DOMAIN_SYSTEM_TIME)
[ WARN] [1563639319.727051747]: Hardware Notification:USB SCP overflow,1.56364e+12,Error,Hardware Error
 21/07 01:15:19,767 WARNING [1742353440] (ds5-timestamp.cpp:64) UVC metadata payloads not available. Please refer to the installation chapter for details.
```

→解決できず断念

# Error対策

```
[ERROR] [1563543871.508190780]: Failed to load nodelet [/camera/realsense2_camera] of type [realsense2_camera/RealSenseNodeFactory] even after refreshing the cache: Could not find library corresponding to plugin realsense2_camera/RealSenseNodeFactory. Make sure the plugin description XML file has the correct name of the library and that the library actually exists.
```

→下記の通りcloneして解決
git clone https://github.com/icarpis/realsense.git

--

```
[darknet_ros.launch] is neither a launch file in package [darknet_ros] nor is [darknet_ros] a launch file name
The traceback for the exception was written to the log file
```

→下記の通りdarknet_rosをcloneして解決
git clone --recursive https://github.com/leggedrobotics/darknet_ros.git
https://github.com/icarpis/realsense/tree/reset_dev
https://answers.ros.org/question/308293/problem-launching-intel-realsense-d435-camera/
 https://github.com/leggedrobotics/darknet_ros.git

--

```
Make Warning at realsense-ros/realsense2_camera/CMakeLists.txt:37 (find_package):
  Could not find a configuration file for package "realsense2" that is
  compatible with requested version "2.24.0".

  The following configuration files were considered but not accepted:

    /usr/local/lib/cmake/realsense2/realsense2Config.cmake, version: 2.17.0
```

→エラーメッセージ記載の通り、version: 2.24.0 へバージョン更新して解決

--

```
$ cmake ../ -DBUILD_WITH_TM2=false
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "librealsense" with
  any of the following names:
    librealsenseConfig.cmake
    librealsense-config.cmake
  Add the installation prefix of "librealsense" to CMAKE_PREFIX_PATH or set
  "librealsense_DIR" to a directory containing one of the above files.  If
  "librealsense" provides a separate development package or SDK, be sure it
  has been installed.
```

→エラーメッセージ記載の通り、CMAKE_PREFIX_PATH にlibrealsenseを追加して解決

# 参考
[YOLO v3による一般物体認識をROS上で試してみた](http://ogimotokin.hatenablog.com/entry/2019/07/01/230701)
[RealSense D435(距離計測カメラ) & T265(自己位置認識カメラ) をROS上で動かした](http://ogimotokin.hatenablog.com/entry/2019/06/05/222039)
[ROS Wrapper 2.0 for Intel® RealSense™ Devices (build 2.2.7)](https://github.com/IntelRealSense/realsense-ros/releases)
[ROSでdarknetを動かしてみた。](https://qiita.com/nnn112358/items/d696681d5b0577d633b6)
[librealsense](https://github.com/IntelRealSense/librealsense)
[librealsense - install](https://github.com/IntelRealSense/librealsense/blob/development/doc/installation.md)
[ROS Wrapper for Intel](https://github.com/IntelRealSense/realsense-ros)
[ddynamic_reconfigure](https://github.com/pal-robotics/ddynamic_reconfigure/tree/kinetic-devel)
[No framed received in ubuntu 16.04, 18.04 #2611](https://github.com/IntelRealSense/librealsense/issues/2611)

---