Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)

文章目录

  • Unity
    • Build
    • Windridge City
  • 示例项目
    • Usage
    • Operation
    • 事实上,在源码里,我没找到怎么控制无人机,这里暂时留个坑不填,需要准备一下毕业开题的事情,最近会主要看神经网络...

Unity


Build Unity Project

Go inside the AirSim\Unity directory: cd Unity.

Build the unity project: build.cmd.

Additionally, there is a free environment Windridge City which you can download from Unity Asset Store. And, of course, you can always create your own environment.


Build

Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第1张图片
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第2张图片
出错,应该是VS2017缺少组件 Windows SDK 10.0.16299.0,这个版本的组件有四个,我只安装了如下两个
在这里插入图片描述
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第3张图片
这个warning不用管,至此就build完成了,生成了AirLibWrapper插件。

Windridge City

在Unity Asset Store中购买(免费)该资源后,用unity打开,开始下载。
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第4张图片
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第5张图片
下载完成后,导入即可
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第6张图片
第一次使用,当然是全部导入啦
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第7张图片
导入完成后,场景是这样的,很棒

但是好像有编译错误,不能直接运行
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第8张图片
在源码中有如下解释

 // NOTE: If you are getting errors of the sort that say something like:
 //     "The type or namespace name `PostProcessing' does not exist in the namespace"
 // it is because the Post Processing Stack V2 module has not been installed in your project.
 //
 // To make the errors go away, you can either:
 //   1 - Download PostProcessing V2 and install it into your project
 // or
 //   2 - Delete the CinemachinePostProcessingV2 folder from your project

postprocessing的wiki-install说明文档如下

First, make sure you don't already have the Postprocessing package installed or it will conflict 
with a source installation. If you do, you can remove it using the package manager (Window -> Package Manager).

Then you can use your Git client to clone the post-processing repository into your Assets folder. 

If you don't want to use a Git client you can also download a zip archive by clicking the green 
button that says "Clone or download" at the top of the repository and extract it into your project. 

在window->package manager里,也有安装的方法
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第9张图片
将下载好的postprocessing解压缩到project-asset目录下,等待unity加载完新资源,此时error就没了。
运行当前场景,移动鼠标可以环视四周,安装postprocessing之后,就能看到视觉特效啦。

示例项目

Usage


Start Unity and click Open project.
Select the folder AirSim\Unity\UnityDemo, and then hit the button Select Folder.
In the bottom pane, Click on Projects->Assets->Scenes. Then, Double-click on SimModeSelector, DroneDemo, or CarDemo.
Hit the play button to start the simulation (and hit play again to stop the simulation. .
Alternatively, you can change the SimMode in your Settings.json file. (you can read more about it here)


打开项目,双击打开SimModeSelector场景。(如果直接打开另外两个场景去运行,编辑器会崩溃)
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第10张图片直接play,会读取Settings.json
在这里插入图片描述
我这里没有这个路径,所以生成失败,到"C:\Users\name\Documents"目录下创建"AirSIM"文件夹,再次点击play,即成功运行场景。
如未在Settings.json中设置仿真模式,会首先弹出提示框,用于选择仿真模式。
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第11张图片
选择Car进入CarDemo场景,仿真模拟无人车
选择Multirotor进入DroneDemo场景,仿真模拟无人机
Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第12张图片
示例项目启动完成

Operation


Controlling the car:
Use WASD or the Arrow keys or the AirSim client.
Controlling the drone:
Use the PageUP/PageDown with WASD/Arrow keys.
Changing camera views:
Keys 0, 1, 2, 3 are used to toggle windows of different camera views.
Recording simulation data:
Press Record button(Red button) located at the right bottom corner of the screen, to toggle recording of the simulation data. The recorded data can be found at Documents\AirSim(Date of recording)


以下为操作方式的翻译

  • WASD或方向键控制Car移动
  • Page UP/Page Down控制Drone上升/下落,WASD或方向键控制移动
  • 0,1,2,3控制摄像机
  • 从左到右分别为1,2,3控制摄像机开关,0可为反选摄像机状态
  • 按下右下角的录像按钮,打开录制功能,录制的数据会保存在用户路径(C:\Users\用户名\Documents\AirSIM)Windows下AirSIM的环境搭建(三、Build Unity示例项目及资源)_第13张图片
  • 红色按钮“RE”为recording,录制短片,录制实验结果等用途。

事实上,在源码里,我没找到怎么控制无人机,这里暂时留个坑不填,需要准备一下毕业开题的事情,最近会主要看神经网络…

你可能感兴趣的:(Unity3D)