LoginSignup
4
4

More than 3 years have passed since last update.

AirSimをはじめてみる(Joystick操作、Python操作)

Last updated at Posted at 2020-03-25

はじめに

Microsft製OSSのフライトシミュレータAirSimを試してみる。環境は下記のとおり。

項目 バージョン
OS Windows10
Python 3.7
AirSim 1.2.2Windows

インストール

  • マップ毎にビルドされたバイナリ版があるのでそちらを使用する。
  • 下記リンク先のAssetから任意のzipをダウンロード。今回はBlocks.zipAfrica.zipを入手。
    https://github.com/Microsoft/AirSim/releases
  • zipを展開して中にあるrun.batを実行。
  • 初回は必要なランタイム(UnrealEngine, VisualStudio)のインストールを促されるので従えばOK。
  • GPUなしPCでは表示がかなり厳しい。下記を参考にrun.batを編集してクオリティを抑える必要あり。
    https://microsoft.github.io/AirSim/docs/use_precompiled/
  • run.bat修正例。
run.bat
start Blocks  -ResX=640 -ResY=480 -windowed

実機プロポで操作

Pythonから操作

$ git clone https://github.com/microsoft/AirSim
$ cd ./AirSim/PythonClient/multirotor
$ pip install opencv-python
$ pip install msgpack-rpc-python  
$ python hello_drone.py  
  • 飛行するところ。
  • hello_drone.pyを見ると離着陸、移動など参考になるコードがある。
用途 コード例
機体接続 client = airsim.MultirotorClient()
機体状態取得 state = client.getMultirotorState()
離陸 client.takeoffAsync().join()
移動 client.moveToPositionAsync(-10, 10, -10, 5).join()

まとめ

AirSimを使うことでプロポによるマニュアル操作、Pythonをつかったプログラミング操作のシミュレーションができることがわかった。

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