###### tags: `飛控` `AirSim` `模擬` # AirSim 建立環境(Windows) ## Download UE(4.27) - 下載 Unreal Engine (注意版本是 4.27) 從Epic Games Launcher下載Unreal Engine (4.27!!)  :::info 1.如果你有不只一種版本,需要透過 launch 按鈕旁邊的箭頭確定使用的版本是current 的狀態 2.如果你已經有其他版本的話,可以按 ENGINE VERSIONS 旁邊的 + 號按鈕來新增不同版本的 UE 3.Airsim 要用的 UE 的版本是4.27 !!! ::: ## Download Visual Studio 2019 - 要確定有選到 Desktop Development with C++ 以及 Windows 10 SDK 10.0.19041(這一項通常會在預設中勾選好了) 以及在個別元件選單裡最新版本的 .NET Framework SDK   ## 建立 AirSim - 透過 Visual Studio Installer 打開 VS 2022  - 選取複製存放庫,輸入==https://github.com/Microsoft/AirSim.git== 來下載AirSim (注意在選擇存放地址時,建議是放在C槽外的地方) - 在[Command line](https://www.digitalcitizen.life/command-prompt-how-use-basic-commands/) 上輸入==d:==,移動路徑到D drive,再輸入==CD Airsim== ,進入Airsim directory - 執行==build.cmd==,這會在==Unreal\Plugins==資料夾中產生準備好的plugin bits ,可以丟到任意的Unreal project資料夾中作使用  :::warning 1. 不建議安裝Airsim在C槽,這會導致scripts無法正常使用,也需要使用Admin mode來執行VS2022 2. 要使用vs2019不能是2020或是其他版本,script的版本是vs2019的,用2020去跑會失敗 ( ʘ言ʘ╬ ) 3. 出現Cannot find path 'HKEY_CLASSES_ROOT\Unreal.ProjectFile\shell\rungenproj' because it does not exist.就重新開機再打開Epic launcher連結project即可修復 ::: ## Build Unreal Project - 在初次建立project前重開UE及Epic Games Launcher,在開啟 Epic Games Launcher後,它會問你 associate project file extensions with Unreal Engine,選擇==fix now==。 - 除了自己建立 UE project 也可以使用 Airsim 內建的 Blocks 環境 ### Option 1 - [Blocks Evironment](https://microsoft.github.io/AirSim/unreal_blocks/) 1. 在確定 UE 及 Airsim 已經安裝完成後,進入==AirSim\Unreal\Environments\Blocks==這個資料夾  2. 執行檔案==update_from_git.bat== 應該會是這個畫面  3. 用vs2022打開產生的 Blocks.sln檔 4. 確認startup project是你要的,並設定build config是development Editor及64 5. 按f5開始建置 (會跑蠻久的,可以去睡一下)  6. 建置完會進到 UE Editor 裡面 7. 選擇上面那排有看起來蠻醜的大圖標裡面的==play==按鈕應該會進入這個畫面  6. [How to Use Airsim](https://github.com/Microsoft/AirSim/#how-to-use-it) ### *Option 2 - Custom UE Environment 在Unleal Marketplace裡有多種可用的環境可以選擇 (有的可以直接創建新的專案,有的是當作插件 Plugin 新增到專案裡面) 1. 如果是選擇建立新的專案的話,先打開 Unreal Engine 2. 在他的介面中會顯示幾個選項給你選擇,有 GAME..... 之類的選擇 GAME,然後在下個介面中會出現幾個模板給你選擇,選擇 Blank  3. 專案創建完成後後打開 Unreal Editor 以及 Visual Studio 這兩個視窗 4. 關閉 vs2022 以及 UE Editor 在專案資料夾中打開專案.uproject  並複製 Airsim 中的 Plugins 到現在的專案資料夾中  5. 對 uproject 右鍵開啟,在裡面新增 `"AdditionalDependencies":[ "AirSim" ]` 以及 `"Plugins":[ { "Name":"AirSim", "Enabled":true } ]` 兩項 (記得逗號、大小寫還有儲存) ```c { "FileVersion": 3, "EngineAssociation": "4.27", "Category": "", "Description": "", "Modules": [ { "Name": "MyProject3", "Type": "Runtime", "LoadingPhase": "Default", "AddktionalDependencies":[ "AirSim" ] } ], "Plugins":[ { "Name":"AirSim", "Enabled":true } ] } ``` 6. 確定編輯好後,右鍵點擊 uproject ,選擇 Generate Visual Studio project files  完成後他會在你的 .sln檔裡面儲存你在 uproject 裡的變更 7. 打開 .sln檔,將裡面的方案組態改成 Debug Game Editor 及 x64,f5 開始建置  8. 建置完成後會在 UE Editor裡打開,在按==play==前確定右下角的 Game Mode 是==AirsimGameMode==  9. 應該會是這個畫面  ## Next 上面的步驟完成後,你可以使用 Unreal Editor 來編輯你的無人機模型或是地圖 ### 參考 - [Airsim 無人機模型修改](https://hackmd.io/@ncku-uav/HkCSHs3o9) ## Don't Have Good GPU? 在Airsim binaries中,大部分的地圖需要高效能的GPU,但還是可以在低解析度的狀況下運作,可以參考[https://microsoft.github.io/AirSim/use_precompiled/#dont-have-good-gpu] :::success 跑不出來的請砍掉重來,多試幾次就行了,至少我是這樣成功的 ¯(°_o)/¯ :::
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up