4
3

箱庭ドローンシミュレータでニューヨーク上空を飛べた! (PS5 Controller DualSense使用)

Last updated at Posted at 2024-09-02

元記事はこちら : ニューヨーク上空をPS4コントローラで操縦!PX4連携可能な箱庭ドローンシミュレータの実力
この執筆者である @kanetugu2018 さんに感謝いたします。ど素人にいろいろと教えていただいて本当に感謝です。
下図は今回のお試しの中の一部。
GX-mvEhb0AAKNlr.jpeg

参照資料 : ubuntu22.04_install&operation_PX4編.md 0.5版
格納場所 : TOPPERS Project / hakoniwa-px4sim

個人的に重要 : Unity Asset Store から3Dモデル等をダウンロードする前に設定すべきこと。

・お試し環境は以下の通り。
Core i7 12th / Memory 32G / intel ADL GT2 / Mini-PC
Ubuntu 22.04.5 LTS (Native/Clean install using USB memory/Not Dual boot)
Python 3.10 ( Ubuntu 22.04.5 LTS Pre install )
DualSense Wireless Controller (for PlayStation 5 : PS5)

・諸々インストール後のニューヨーク上空を飛ぶお試し手順はこちら。
元記事ではVisual Studio Codeをお使いですが...
コメントに1.4.xと記述しているのは、ubuntu22.04_install&operation_PX4編.md を参照しています。

# Terminal-1
# 1.4.1. PX4の起動
$ cd ~/work/hakoniwa-px4sim/px4/PX4-Autopilot
$ bash ../sim/simstart.bash
# Terminal-2
# 1.4.2. 箱庭コア機能の起動
$ cd ~/work/hakoniwa-px4sim/hakoniwa
$ bash run.bash
# 1.4.3. Unityアプリの起動ではく Unity Editorを起動 -> STARTボタン
# Terminal-3
# 1.5.3. QGCとPX4の動作確認
$ cd ~/work/qgc
$ ./QGroundControl.AppImage

雑感
仮想で試せるのは、ほんとうに楽しい! いままで、ずっとやりたかったことだし。かつドローンは自身にとって未知の分野。
もちろん実機を動かす楽しみ、動いたときの喜びや嬉しさもあるけれど...

関連記事は、こちら。
「箱庭ドローンシミュレータ PX4利用編」がCore i5 8th/8G、PS5コントローラで動いた!
「箱庭ドローンシミュレータ pythonAPI利用編」がCore i5 8th/8G、PS5コントローラで動いた!


以下、防備録。
PX4をBuildする際にこれらを予め入れておくとエラーメッセージを少なくできるかも。
このお試しには影響ないかもですが... とりあえず。

$ sudo apt install python3-pip -y
$ pip3 install symforce
$ sudo apt install default-jdk

以下、環境変数の設定、コマンドラインから、やってみた。

$ echo 'export LD_LIBRARY_PATH=/usr/local/lib/hakoniwa:$LD_LIBRARY_PATH' >> ~/.bashrc
$ echo 'export PATH=/usr/local/bin/hakoniwa:$PATH' >> ~/.bashrc
$ echo 'export PYTHONPATH=/usr/local/lib/hakoniwa/py:${PYTHONPATH}' >> ~/.bashrc
$ source ~/.bashrc

以下、コマンドラインからインストールしてみる。

$ cd ~/work/hakoniwa-unity-drone-model
$ bash install.bash #for unity editor
$ wget https://github.com/toppers/hakoniwa-unity-drone-model/releases/download/v2.1.0/DroneAppLinux.zip
$ unzip DroneAppLinux.zip

Unity editorでプロジェクトを開く。addをクリック!
Screenshot from 2024-08-20 15-26-19.png

プロジェクトをOpenする。 ~/hakoniwa-unity-drone-model\plugin\plugin-srcs
Screenshot from 2024-08-24 05-41-38.png

バージョンを変更する。Open with 2022.4.43f1(インストールしてあるバージョン)
Screenshot from 2024-08-24 05-44-26.png

確認されているので変更する。
Screenshot from 2024-08-24 05-47-33.png

NonMatching Editorと表示される、そのままcontinue
Screenshot from 2024-08-24 05-49-27.png

safe modeは、ignore
Screenshot from 2024-08-24 05-52-56.png

Unity Editor起動後にconsolを開くとエラーが出てるので、解消する
Screenshot from 2024-08-24 05-58-38.png

#Pakage Manegerを開き、com.unity.nuget.newtonsoft-jsonをAddする。
Unity Editor操作:Window -> Package Manager -> + -> Add pacakge from git URL...
Screenshot from 2024-08-24 06-07-45.png

com.unity.nuget.newtonsoft-jsonをAddする。
Screenshot from 2024-08-24 06-10-31.png

NO_USE_GRPC を Apply
Edit -> Project Settings -> Player -> Other Settings -> Script Compilation
-> + NO_USE_GRPC(inoutする) -> Apply
image.png

一つ残るが?諸々解消
image.png

以下、Unity Editorを使う際の手順、エラー回避等。

Newyorkを組み込むための手順はこちら。を踏まえて。
https://www.docswell.com/s/kanetugu2015/KXYR8Y-2024-05-19-160903#

ApDemoをダブルクリック(Asset -> Scenes)
Screenshot from 2024-08-20 18-05-15.png

Screenshot from 2024-08-20 18-09-23.png

Package Manegerを起動 (window -> Package manager)
Screenshot from 2024-08-20 20-01-19.png

Real Ner York City Vol.1を選び、importする。
Screenshot from 2024-08-20 20-07-38.png

左下のimportをクリック
Screenshot from 2024-08-20 20-11-37.png

途中経過
Screenshot from 2024-08-20 20-14-16.png

import後
image.png

NYBlock01をENY下にDrag and Drop
image.png

x = 600, y = -40, z = -370
image.png

そして、これ. Genarate、手順書を見切れていなかった。反省。
GX_EHsib0AYIFi7.png

以上。

4
3
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
4
3