forked from microsoft/AirSim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
clovett
committed
May 25, 2017
1 parent
f78f117
commit 6aa1a2e
Showing
4 changed files
with
149 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,33 @@ | ||
from PythonClient import * | ||
import sys | ||
import time | ||
import msgpackrpc | ||
import math | ||
|
||
client = AirSimClient('127.0.0.1') | ||
|
||
print("Waiting for home GPS location to be set...") | ||
home = client.getHomePoint() | ||
while ((home[0] == 0 and home[1] == 0 and home[2] == 0) or | ||
math.isnan(home[0]) or math.isnan(home[1]) or math.isnan(home[2])): | ||
time.sleep(1) | ||
home = client.getHomePoint() | ||
|
||
print("Home lat=%g, lon=%g, alt=%g" % tuple(home)) | ||
|
||
if (not client.arm()): | ||
print("failed to arm the drone") | ||
sys.exit(1); | ||
|
||
if (client.getLandedState() == LandedState.Landed): | ||
print("Taking off...") | ||
if (not client.takeoff(60)): | ||
print("failed to reach takeoff altitude after 60 seconds") | ||
sys.exit(1); | ||
print("Should now be flying...") | ||
else: | ||
print("it appears the drone is already flying") | ||
|
||
client.hover(); | ||
time.sleep(5) | ||
|
||
print("Landing...") | ||
if (not client.land(60)): | ||
print("failed to land after 60 seconds") | ||
sys.exit(1); | ||
|
||
print("Landed.") | ||
|
||
# now we are safely back on the ground we can disarm the drone | ||
if (not client.disarm()): | ||
print("failed to disarm the drone") | ||
sys.exit(1); | ||
from PythonClient import * | ||
import sys | ||
import time | ||
import msgpackrpc | ||
import math | ||
|
||
client = AirSimClient('127.0.0.1') | ||
|
||
print("Waiting for home GPS location to be set...") | ||
home = client.getHomePoint() | ||
while ((home[0] == 0 and home[1] == 0 and home[2] == 0) or | ||
math.isnan(home[0]) or math.isnan(home[1]) or math.isnan(home[2])): | ||
time.sleep(1) | ||
home = client.getHomePoint() | ||
|
||
print("Home lat=%g, lon=%g, alt=%g" % tuple(home)) | ||
|
||
if (not client.arm()): | ||
print("failed to arm the drone") | ||
sys.exit(1); | ||
|
||
if (client.getLandedState() == LandedState.Landed): | ||
print("Taking off...") | ||
if (not client.takeoff(60)): | ||
print("failed to reach takeoff altitude after 60 seconds") | ||
sys.exit(1); | ||
print("Should now be flying...") | ||
else: | ||
print("it appears the drone is already flying") | ||
|
||
client.hover(); | ||
time.sleep(5) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters