Skip to content

Commit

Permalink
Azure development environment and documentation (#2816)
Browse files Browse the repository at this point in the history
* add azure doc to index

* initial move from external repo to airsim

* updated doc to new repo

* fixed paths for new repo and .vscode info

* added missing .vscode dir

* fixed link

* wording

* message after starting

* feedback
  • Loading branch information
airsimcloud authored Jun 30, 2020
1 parent 827f1f5 commit 23cb81a
Show file tree
Hide file tree
Showing 14 changed files with 568 additions and 0 deletions.
1 change: 1 addition & 0 deletions azure/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!.vscode
7 changes: 7 additions & 0 deletions azure/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-python.python",
"ms-azuretools.vscode-docker",
"ms-vscode.powershell"
]
}
15 changes: 15 additions & 0 deletions azure/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
14 changes: 14 additions & 0 deletions azure/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Start AirSim",
"type": "shell",
"options": {"shell": {"executable": "powershell.exe"}},
"command": ".\\start-airsim.ps1"

}
]
}
42 changes: 42 additions & 0 deletions azure/app/multirotor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import airsim
import pprint

def print_state(client):
state = client.getMultirotorState()
s = pprint.pformat(state)
print("state: %s" % s)

imu_data = client.getImuData()
s = pprint.pformat(imu_data)
print("imu_data: %s" % s)

barometer_data = client.getBarometerData()
s = pprint.pformat(barometer_data)
print("barometer_data: %s" % s)

magnetometer_data = client.getMagnetometerData()
s = pprint.pformat(magnetometer_data)
print("magnetometer_data: %s" % s)

gps_data = client.getGpsData()
s = pprint.pformat(gps_data)
print("gps_data: %s" % s)

# connect to the AirSim simulator
client = airsim.MultirotorClient()
client.confirmConnection()
client.enableApiControl(True)
client.armDisarm(True)

print_state(client)
print('Takeoff')
client.takeoffAsync().join()

while True:
print_state(client)
print('Go to (-10, 10, -10) at 5 m/s')
client.moveToPositionAsync(-10, 10, -10, 5).join()
client.hoverAsync().join()
print_state(client)
print('Go to (0, 10, 0) at 5 m/s')
client.moveToPositionAsync(0, 10, 0, 5).join()
1 change: 1 addition & 0 deletions azure/app/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
airsim
19 changes: 19 additions & 0 deletions azure/app/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings_json.md",
"SettingsVersion": 1.2,
"SimMode": "Multirotor",
"ClockSpeed": 1.0,
"Vehicles": {
"SimpleFlight": {
"VehicleType": "SimpleFlight",
"DefaultVehicleState": "Armed",
"EnableCollisionPassthrogh": false,
"EnableCollisions": true,
"AllowAPIAlways": true,
"RC": {
"RemoteControlID": 0,
"AllowAPIWhenDisconnected": false
}
}
}
}
37 changes: 37 additions & 0 deletions azure/azure-env-creation/configure-vm.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
$airSimInstallPath = "C:\AirSim\"
$airSimBinaryZipUrl = "https://github.com/microsoft/AirSim/releases/download/v1.3.1-windows/Blocks.zip"
$airSimBinaryZipFilename = "Blocks.zip"
$airSimBinaryPath = $airSimInstallPath + "blocks\blocks\binaries\win64\blocks.exe"
$airSimBinaryName = "Blocks"

$webClient = new-object System.Net.WebClient

# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Enable service
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'

#Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# Bypass confirmation in scripts.
choco feature enable --name="'allowGlobalConfirmation'"
choco install python --version=3.8.2
choco install git
# Run time c++
choco install vcredist-all
choco install directx

#Create new folder & set as default directory
New-Item -ItemType directory -Path $airSimInstallPath
cd $airSimInstallPath

# Get AirSim
$webClient.DownloadFile($airSimBinaryZipUrl, $airSimInstallPath + $airSimBinaryZipFilename)
# Unzip AirSim
Expand-Archive $airSimBinaryZipFilename

# Firewall rule for AirSim
New-NetFirewallRule -DisplayName $airSimBinaryName -Direction Inbound -Program $airSimBinaryPath -Action Allow
Loading

0 comments on commit 23cb81a

Please sign in to comment.