Skip to content

Commit

Permalink
show how to teleport the drone
Browse files Browse the repository at this point in the history
  • Loading branch information
lovettchris committed Dec 24, 2018
1 parent 957752f commit 488a233
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions PythonClient/multirotor/teleport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import setup_path

This comment has been minimized.

Copy link
@ichrakAB

ichrakAB Apr 24, 2019

what is setup_path here ??

This comment has been minimized.

Copy link
@lovettchris

lovettchris Apr 24, 2019

Author Member

See https://github.com/Microsoft/AirSim/blob/master/PythonClient/multirotor/setup_path.py, it's a way to setup python so it can find the client.py module in a relative path location without client.py being pip installed.

import airsim
import time

client = airsim.MultirotorClient()
client.confirmConnection()

pose = client.simGetVehiclePose()

# teleport the drone + 10 meters in x-direction
pose.position.x_val += 10

client.simSetVehiclePose(pose, True, "PX4")

time.sleep(2)

# teleport the drone back
pose.position.x_val -= 10

client.simSetVehiclePose(pose, True, "PX4")

0 comments on commit 488a233

Please sign in to comment.