AirSim Quick Start

Table of contents

环境配置

  • windows11
  • 下载 Epic Games Launcher
  • 安装 Visual Studio 2022 Community
    • 选择 C++桌面开发
    • Windows 10 SDK 10.0.19041
    • 选择“独立组件”板块中最新的.NET Framework SDK
  • 安装 Unreal Engine 4.27
  • 配置虚幻引擎
    • 编辑 —— 编辑器首选项 —— 源代码 —— 源代码编辑器 — Visual Studio 2022
    • 编辑 —— 编辑器首选项 —— 搜索“CPU” —— 关闭“Use Less CPU when in Background”
  • 安装 AirSim
    • 打开 Developer Command Prompt for VS 2022
    • 在 D 盘中 git clone https://github.com/Microsoft/AirSim.git
    • cd AirSim
    • build.cmd
  • 配置 anaconda 中的虚拟环境
    • conda create -n AirSim,注意 python 版本大于 3.6
    • conda activate AirSim
    • pip install msgpack-rpc-python
    • pip install airsim

配置测试

  • 虚幻地图
  • 激活 python 环境conda activate AirSim
  • 运行 test.py 文件
"""
 test python environment
 """
import airsim
# connect to the AirSim simulator
client = airsim.MultirotorClient()
client.confirmConnection()

# get control
client.enableApiControl(True)

# unlock
client.armDisarm(True)

# Async methods returns Future. Call join() to wait for task to complete.
client.takeoffAsync().join()
client.landAsync().join()

# lock
client.armDisarm(False)

# release control
client.enableApiControl(False)